From a95e6d62ad931db7299d8d7b59008feb20be1407 Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Sat, 9 Nov 2024 23:13:11 +0300 Subject: [PATCH] Major Changes --- .../Sucrose.Memory/Manage/Readonly/Content.cs | 2 ++ .../Helper/Config.cs | 30 ++++--------------- .../Sucrose.Shared.Engine/Manage/Internal.cs | 2 +- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/Library/Sucrose.Memory/Manage/Readonly/Content.cs b/src/Library/Sucrose.Memory/Manage/Readonly/Content.cs index 04a3c1044..637565d2d 100644 --- a/src/Library/Sucrose.Memory/Manage/Readonly/Content.cs +++ b/src/Library/Sucrose.Memory/Manage/Readonly/Content.cs @@ -20,6 +20,8 @@ public static class Content public static readonly string MpvPlayerConfig = "MpvPlayer.config"; + public static readonly string uMpvPlayerConfig = "uMpvPlayer.config"; + public static readonly string SucroseCompatible = "SucroseCompatible.json"; public static readonly string SucroseProperties = "SucroseProperties.json"; diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.MpvPlayer/Helper/Config.cs b/src/Shared/Engine/Sucrose.Shared.Engine.MpvPlayer/Helper/Config.cs index 0936a92aa..b59bf97a2 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.MpvPlayer/Helper/Config.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.MpvPlayer/Helper/Config.cs @@ -18,17 +18,14 @@ public static void Start() Directory.CreateDirectory(SSEMPMI.MpvPath); } - SSEMPMI.MpvConfig = Path.Combine(SSEMPMI.MpvPath, SMMRC.MpvPlayerConfig); + SSEMPMI.MpvConfig = Path.Combine(SSEMPMI.MpvPath, SMMRC.uMpvPlayerConfig); - string Content = string.Join(Environment.NewLine, SSEMI.MpvConfig); - - if (File.Exists(SSEMPMI.MpvConfig)) + if (!File.Exists(SSEMPMI.MpvConfig)) { - Content = SSSHF.Read(SSEMPMI.MpvConfig); - } + SSEMPMI.MpvConfig = Path.Combine(SSEMPMI.MpvPath, SMMRC.MpvPlayerConfig); + + string Content = string.Join(Environment.NewLine, SSEMI.MpvConfig); - if (SSSHR.IsMatch(Content, @"^hwdec=", RegexOptions.Multiline)) - { if (SMME.HardwareAcceleration) { Content = SSSHR.Replace(Content, @"^hwdec=.*$", "hwdec=auto-safe", RegexOptions.Multiline); @@ -37,24 +34,9 @@ public static void Start() { Content = SSSHR.Replace(Content, @"^hwdec=.*$", "hwdec=no", RegexOptions.Multiline); } - } - else - { - Content += Environment.NewLine + Environment.NewLine + "# Auto Generated by Sucrose #"; - - if (SMME.HardwareAcceleration) - { - Content += Environment.NewLine + "hwdec=auto-safe"; - } - else - { - Content += Environment.NewLine + "hwdec=no"; - } - Content += Environment.NewLine + "# Auto Generated by Sucrose #"; + SSSHF.Write(SSEMPMI.MpvConfig, Content); } - - SSSHF.Write(SSEMPMI.MpvConfig, Content); } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine/Manage/Internal.cs b/src/Shared/Engine/Sucrose.Shared.Engine/Manage/Internal.cs index 5f20f8dc2..bbd0c02cc 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine/Manage/Internal.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine/Manage/Internal.cs @@ -82,7 +82,7 @@ internal static class Internal public static readonly DispatcherTimer GeneralTimer = new(); - public static readonly string MpvProperties = "ew0KICAiUHJvcGVydHlMaXN0ZW5lciI6ICJTdWNyb3NlUHJvcGVydHlMaXN0ZW5lcignezB9JywgezF9KTsiLA0KICAiUHJvcGVydHlMaXN0Ijogew0KICAgICJvbmx5TXB2Ijogew0KICAgICAgInR5cGUiOiAibGFiZWwiLA0KICAgICAgInZhbHVlIjogIlByb3BlcnR5LkxvY2FsaXphdGlvbi5NcHZQbGF5ZXIiDQogICAgfSwNCiAgICAidmlkZW8tem9vbSI6IHsNCiAgICAgICJtYXgiOiA1LA0KICAgICAgIm1pbiI6IC01LA0KICAgICAgInN0ZXAiOiAwLjUsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uWm9vbSIsDQogICAgICAidHlwZSI6ICJzbGlkZXIiLA0KICAgICAgInZhbHVlIjogMA0KICAgIH0sDQogICAgInNhdHVyYXRpb24iOiB7DQogICAgICAibWF4IjogMTAwLA0KICAgICAgIm1pbiI6IC0xMDAsDQogICAgICAic3RlcCI6IDEsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uU2F0dXJhdGlvbiIsDQogICAgICAidHlwZSI6ICJzbGlkZXIiLA0KICAgICAgInZhbHVlIjogMA0KICAgIH0sDQogICAgImh1ZSI6IHsNCiAgICAgICJtYXgiOiAxMDAsDQogICAgICAibWluIjogLTEwMCwNCiAgICAgICJzdGVwIjogMSwNCiAgICAgICJ0ZXh0IjogIlByb3BlcnR5LkxvY2FsaXphdGlvbi5IdWUiLA0KICAgICAgInR5cGUiOiAic2xpZGVyIiwNCiAgICAgICJ2YWx1ZSI6IDANCiAgICB9LA0KICAgICJzaGFycGVuIjogew0KICAgICAgIm1heCI6IDEwMCwNCiAgICAgICJtaW4iOiAwLA0KICAgICAgInN0ZXAiOiAxLA0KICAgICAgInRleHQiOiAiS2Vza2lubGlrIiwNCiAgICAgICJ0eXBlIjogInNsaWRlciIsDQogICAgICAidmFsdWUiOiAwDQogICAgfSwNCiAgICAiYnJpZ2h0bmVzcyI6IHsNCiAgICAgICJtYXgiOiAxMDAsDQogICAgICAibWluIjogLTEwMCwNCiAgICAgICJzdGVwIjogMSwNCiAgICAgICJ0ZXh0IjogIlByb3BlcnR5LkxvY2FsaXphdGlvbi5CcmlnaHRuZXNzIiwNCiAgICAgICJ0eXBlIjogInNsaWRlciIsDQogICAgICAidmFsdWUiOiAwDQogICAgfSwNCiAgICAiY29udHJhc3QiOiB7DQogICAgICAibWF4IjogMTAwLA0KICAgICAgIm1pbiI6IC0xMDAsDQogICAgICAic3RlcCI6IDEsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uQ29udHJhc3QiLA0KICAgICAgInR5cGUiOiAic2xpZGVyIiwNCiAgICAgICJ2YWx1ZSI6IDANCiAgICB9LA0KICAgICJnYW1tYSI6IHsNCiAgICAgICJtYXgiOiAxMDAsDQogICAgICAibWluIjogLTEwMCwNCiAgICAgICJzdGVwIjogMSwNCiAgICAgICJ0ZXh0IjogIlByb3BlcnR5LkxvY2FsaXphdGlvbi5HYW1tYSIsDQogICAgICAidHlwZSI6ICJzbGlkZXIiLA0KICAgICAgInZhbHVlIjogMA0KICAgIH0sDQogICAgInNwZWVkIjogew0KICAgICAgIm1heCI6IDIuNSwNCiAgICAgICJtaW4iOiAwLjI1LA0KICAgICAgInN0ZXAiOiAwLjEsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uU3BlZWQiLA0KICAgICAgInR5cGUiOiAic2xpZGVyIiwNCiAgICAgICJ2YWx1ZSI6IDENCiAgICB9LA0KICAgICJtdXRlIjogew0KICAgICAgInRleHQiOiAiUHJvcGVydHkuTG9jYWxpemF0aW9uLk11dGUiLA0KICAgICAgInR5cGUiOiAiY2hlY2tib3giLA0KICAgICAgInZhbHVlIjogZmFsc2UNCiAgICB9DQogIH0NCn0="; + public static readonly string MpvProperties = "ew0KICAiUHJvcGVydHlMaXN0ZW5lciI6ICJTdWNyb3NlUHJvcGVydHlMaXN0ZW5lcignezB9JywgezF9KTsiLA0KICAiUHJvcGVydHlMaXN0Ijogew0KICAgICJvbmx5TXB2Ijogew0KICAgICAgInR5cGUiOiAibGFiZWwiLA0KICAgICAgInZhbHVlIjogIlByb3BlcnR5LkxvY2FsaXphdGlvbi5NcHZQbGF5ZXIiDQogICAgfSwNCiAgICAidmlkZW8tem9vbSI6IHsNCiAgICAgICJtYXgiOiA1LA0KICAgICAgIm1pbiI6IC01LA0KICAgICAgInN0ZXAiOiAwLjUsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uWm9vbSIsDQogICAgICAidHlwZSI6ICJzbGlkZXIiLA0KICAgICAgInZhbHVlIjogMA0KICAgIH0sDQogICAgInNhdHVyYXRpb24iOiB7DQogICAgICAibWF4IjogMTAwLA0KICAgICAgIm1pbiI6IC0xMDAsDQogICAgICAic3RlcCI6IDEsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uU2F0dXJhdGlvbiIsDQogICAgICAidHlwZSI6ICJzbGlkZXIiLA0KICAgICAgInZhbHVlIjogMA0KICAgIH0sDQogICAgImh1ZSI6IHsNCiAgICAgICJtYXgiOiAxMDAsDQogICAgICAibWluIjogLTEwMCwNCiAgICAgICJzdGVwIjogMSwNCiAgICAgICJ0ZXh0IjogIlByb3BlcnR5LkxvY2FsaXphdGlvbi5IdWUiLA0KICAgICAgInR5cGUiOiAic2xpZGVyIiwNCiAgICAgICJ2YWx1ZSI6IDANCiAgICB9LA0KICAgICJzaGFycGVuIjogew0KICAgICAgIm1heCI6IDEwMCwNCiAgICAgICJtaW4iOiAwLA0KICAgICAgInN0ZXAiOiAxLA0KICAgICAgInRleHQiOiAiUHJvcGVydHkuTG9jYWxpemF0aW9uLlNoYXJwbmVzcyIsDQogICAgICAidHlwZSI6ICJzbGlkZXIiLA0KICAgICAgInZhbHVlIjogMA0KICAgIH0sDQogICAgImJyaWdodG5lc3MiOiB7DQogICAgICAibWF4IjogMTAwLA0KICAgICAgIm1pbiI6IC0xMDAsDQogICAgICAic3RlcCI6IDEsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uQnJpZ2h0bmVzcyIsDQogICAgICAidHlwZSI6ICJzbGlkZXIiLA0KICAgICAgInZhbHVlIjogMA0KICAgIH0sDQogICAgImNvbnRyYXN0Ijogew0KICAgICAgIm1heCI6IDEwMCwNCiAgICAgICJtaW4iOiAtMTAwLA0KICAgICAgInN0ZXAiOiAxLA0KICAgICAgInRleHQiOiAiUHJvcGVydHkuTG9jYWxpemF0aW9uLkNvbnRyYXN0IiwNCiAgICAgICJ0eXBlIjogInNsaWRlciIsDQogICAgICAidmFsdWUiOiAwDQogICAgfSwNCiAgICAiZ2FtbWEiOiB7DQogICAgICAibWF4IjogMTAwLA0KICAgICAgIm1pbiI6IC0xMDAsDQogICAgICAic3RlcCI6IDEsDQogICAgICAidGV4dCI6ICJQcm9wZXJ0eS5Mb2NhbGl6YXRpb24uR2FtbWEiLA0KICAgICAgInR5cGUiOiAic2xpZGVyIiwNCiAgICAgICJ2YWx1ZSI6IDANCiAgICB9LA0KICAgICJzcGVlZCI6IHsNCiAgICAgICJtYXgiOiAyLjUsDQogICAgICAibWluIjogMC4yNSwNCiAgICAgICJzdGVwIjogMC4xLA0KICAgICAgInRleHQiOiAiUHJvcGVydHkuTG9jYWxpemF0aW9uLlNwZWVkIiwNCiAgICAgICJ0eXBlIjogInNsaWRlciIsDQogICAgICAidmFsdWUiOiAxDQogICAgfSwNCiAgICAibXV0ZSI6IHsNCiAgICAgICJ0ZXh0IjogIlByb3BlcnR5LkxvY2FsaXphdGlvbi5NdXRlIiwNCiAgICAgICJ0eXBlIjogImNoZWNrYm94IiwNCiAgICAgICJ2YWx1ZSI6IGZhbHNlDQogICAgfQ0KICB9DQp9"; public static SSESB BrowserSettings = new() {