diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Management.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Management.cs index e6315cba9..ab5191f2c 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Management.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Management.cs @@ -9,10 +9,14 @@ internal static class Management { public static void SetProcesses() { - Process.GetProcesses() - .Where(Process => Process.ProcessName.Contains(SMR.CefSharpProcessName) && SSSHM.GetCommandLine(Process).Contains(SMR.AppName) && !SSECSMI.Processes.Contains(Process.Id)) - .ToList() - .ForEach(Process => SSECSMI.Processes.Add(Process.Id)); + try + { + Process.GetProcesses() + .Where(Process => Process.ProcessName.Contains(SMR.CefSharpProcessName) && SSSHM.GetCommandLine(Process).Contains(SMR.AppName) && !SSECSMI.Processes.Contains(Process.Id)) + .ToList() + .ForEach(Process => SSECSMI.Processes.Add(Process.Id)); + } + catch { } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Url.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Url.cs index 7e26efc88..28e10050b 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Url.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Url.cs @@ -19,7 +19,11 @@ public static async void SetVolume(int Volume) } catch { - SWEACAM.SetApplicationVolume(Process, Volume); + try + { + SWEACAM.SetApplicationVolume(Process, Volume); + } + catch { } } } } diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Web.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Web.cs index 182d76996..5c5e2a4b1 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Web.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Helper/Web.cs @@ -1,8 +1,11 @@ using CefSharp; using SHS = Skylark.Helper.Skymath; +using SSECSHM = Sucrose.Shared.Engine.CefSharp.Helper.Management; using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal; using SSEHC = Sucrose.Shared.Engine.Helper.Compatible; using SSEMI = Sucrose.Shared.Engine.Manage.Internal; +using SWEACAM = Skylark.Wing.Extension.AudioController.AudioManager; +using SWEVPCAM = Skylark.Wing.Extension.VideoPlayerController.AudioManager; namespace Sucrose.Shared.Engine.CefSharp.Helper { @@ -17,5 +20,36 @@ public static void StartCompatible() SSEMI.CompatibleTimer.Start(); } } + + public static async void SetVolume(int Volume) + { + if (SSECSMI.Processes.Any()) + { + foreach (int Process in SSECSMI.Processes.ToList()) + { + try + { + SWEVPCAM.SetApplicationVolume(Process, Volume); + } + catch + { + try + { + SWEACAM.SetApplicationVolume(Process, Volume); + } + catch { } + } + } + } + + if (SSECSMI.Try < 3) + { + await Task.Run(() => + { + SSECSMI.Try++; + SSECSHM.SetProcesses(); + }); + } + } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/View/Web.xaml.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/View/Web.xaml.cs index 8fb38e237..3762caf5d 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/View/Web.xaml.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/View/Web.xaml.cs @@ -1,8 +1,10 @@ using System.Windows; using SSECSEW = Sucrose.Shared.Engine.CefSharp.Event.Web; using SSECSHCCM = Sucrose.Shared.Engine.CefSharp.Handler.CustomContextMenu; +using SSECSHW = Sucrose.Shared.Engine.CefSharp.Helper.Web; using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal; using SSEEH = Sucrose.Shared.Engine.Event.Handler; +using SSEHD = Sucrose.Shared.Engine.Helper.Data; using SSEHR = Sucrose.Shared.Engine.Helper.Run; using SSEMI = Sucrose.Shared.Engine.Manage.Internal; @@ -44,6 +46,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e) Dispose(); SSEHR.Control(); + + SSECSHW.SetVolume(SSEHD.GetVolume()); } public void Dispose() diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Management.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Management.cs index dcbcbd053..c4fad9402 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Management.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Management.cs @@ -9,10 +9,14 @@ internal static class Management { public static void SetProcesses() { - Process.GetProcesses() - .Where(Process => Process.ProcessName.Contains(SMR.WebViewProcessName) && SSSHM.GetCommandLine(Process).Contains(SMR.AppName) && !SSEWVMI.Processes.Contains(Process.Id)) - .ToList() - .ForEach(Process => SSEWVMI.Processes.Add(Process.Id)); + try + { + Process.GetProcesses() + .Where(Process => Process.ProcessName.Contains(SMR.WebViewProcessName) && SSSHM.GetCommandLine(Process).Contains(SMR.AppName) && !SSEWVMI.Processes.Contains(Process.Id)) + .ToList() + .ForEach(Process => SSEWVMI.Processes.Add(Process.Id)); + } + catch { } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Url.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Url.cs index 948626aff..1f64251b3 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Url.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Url.cs @@ -19,7 +19,11 @@ public static async void SetVolume(int Volume) } catch { - SWEACAM.SetApplicationVolume(Process, Volume); + try + { + SWEACAM.SetApplicationVolume(Process, Volume); + } + catch { } } } } diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Web.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Web.cs index 456b771ac..eccd3954b 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Web.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Web.cs @@ -1,7 +1,10 @@ using SHS = Skylark.Helper.Skymath; using SSEHC = Sucrose.Shared.Engine.Helper.Compatible; using SSEMI = Sucrose.Shared.Engine.Manage.Internal; +using SSEWVHM = Sucrose.Shared.Engine.WebView.Helper.Management; using SSEWVMI = Sucrose.Shared.Engine.WebView.Manage.Internal; +using SWEACAM = Skylark.Wing.Extension.AudioController.AudioManager; +using SWEVPCAM = Skylark.Wing.Extension.VideoPlayerController.AudioManager; namespace Sucrose.Shared.Engine.WebView.Helper { @@ -16,5 +19,36 @@ public static void StartCompatible() SSEMI.CompatibleTimer.Start(); } } + + public static async void SetVolume(int Volume) + { + if (SSEWVMI.Processes.Any()) + { + foreach (int Process in SSEWVMI.Processes.ToList()) + { + try + { + SWEVPCAM.SetApplicationVolume(Process, Volume); + } + catch + { + try + { + SWEACAM.SetApplicationVolume(Process, Volume); + } + catch { } + } + } + } + + if (SSEWVMI.Try < 3) + { + await Task.Run(() => + { + SSEWVMI.Try++; + SSEWVHM.SetProcesses(); + }); + } + } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/View/Web.xaml.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/View/Web.xaml.cs index 25eec749d..55815992f 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/View/Web.xaml.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/View/Web.xaml.cs @@ -1,8 +1,10 @@ using System.Windows; using SSEEH = Sucrose.Shared.Engine.Event.Handler; +using SSEHD = Sucrose.Shared.Engine.Helper.Data; using SSEHR = Sucrose.Shared.Engine.Helper.Run; using SSEMI = Sucrose.Shared.Engine.Manage.Internal; using SSEWVEW = Sucrose.Shared.Engine.WebView.Event.Web; +using SSEWVHW = Sucrose.Shared.Engine.WebView.Helper.Web; using SSEWVMI = Sucrose.Shared.Engine.WebView.Manage.Internal; namespace Sucrose.Shared.Engine.WebView.View @@ -37,6 +39,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e) Dispose(); SSEHR.Control(); + + SSEWVHW.SetVolume(SSEHD.GetVolume()); } public void Dispose()