Skip to content

Commit

Permalink
Major Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Nov 3, 2024
1 parent dfb3083 commit 3405875
Show file tree
Hide file tree
Showing 26 changed files with 329 additions and 60 deletions.
23 changes: 17 additions & 6 deletions src/Live/Sucrose.Live.CefSharp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
using SSECSVV = Sucrose.Shared.Engine.CefSharp.View.Video;
using SSECSVW = Sucrose.Shared.Engine.CefSharp.View.Web;
using SSECSVYT = Sucrose.Shared.Engine.CefSharp.View.YouTube;
using SSEELHS = Sucrose.Shared.Engine.Extension.LocalHttpServer;
using SSEHC = Sucrose.Shared.Engine.Helper.Cycyling;
using SSEHP = Sucrose.Shared.Engine.Helper.Properties;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
Expand All @@ -59,6 +60,7 @@ namespace Sucrose.Live.CefSharp
public partial class App : Application
{
private static bool HasError { get; set; } = true;
private static SSEELHS LocalServer { get; set; }

public App()
{
Expand Down Expand Up @@ -123,6 +125,7 @@ public App()

protected void Close()
{
Task.Run(LocalServer.Stop);
Environment.Exit(0);
Current.Shutdown();
Shutdown();
Expand Down Expand Up @@ -270,8 +273,10 @@ protected void Configure()

CefSettings Settings = new()
{
Locale = SMMG.Culture,
UserAgent = SMMG.UserAgent,
PersistSessionCookies = true,
WindowlessRenderingEnabled = true,
CachePath = Path.Combine(SMMRP.ApplicationData, SMMRG.AppName, SMMRF.Cache, SMMRF.CefSharp)
};

Expand Down Expand Up @@ -302,7 +307,7 @@ protected void Configure()
//Example of checking if a call to Cef.Initialize has already been made, we require this for
//our .Net 5.0 Single File Publish example, you don't typically need to perform this check
//if you call Cef.Initialze within your WPF App constructor.
if (!Cef.IsInitialized)
if (Cef.IsInitialized is null or false)
{
//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(Settings, performDependencyCheck: true, browserProcessHandler: null);
Expand Down Expand Up @@ -373,26 +378,32 @@ protected void Configure()
SSEMI.Compatible.State = true;
}

LocalServer = new(Path.Combine(SSEMI.LibraryLocation, SSEMI.LibrarySelected));

Task.Run(() => LocalServer.StartAsync());

SSEMI.Host = LocalServer.GetUrl();

switch (SSEMI.Info.Type)
{
case SSDEWT.Gif:
SSECSVG Gif = new(Source);
SSECSVG Gif = new();
Gif.Show();
break;
case SSDEWT.Url:
SSECSVU Url = new(Source);
SSECSVU Url = new();
Url.Show();
break;
case SSDEWT.Web:
SSECSVW Web = new(Source);
SSECSVW Web = new();
Web.Show();
break;
case SSDEWT.Video:
SSECSVV Video = new(Source);
SSECSVV Video = new();
Video.Show();
break;
case SSDEWT.YouTube:
SSECSVYT YouTube = new(Source);
SSECSVYT YouTube = new();
YouTube.Show();
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<PackageReference Include="RawInput.Sharp" Version="0.1.3" />
<PackageReference Include="Skylark.Wing" Version="3.1.7.5" />
<PackageReference Include="Skylark.Standard" Version="3.1.6.7" />
<PackageReference Include="CefSharp.Wpf.HwndHost" Version="126.2.70" />
<PackageReference Include="CefSharp.Wpf.HwndHost" Version="130.1.90" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net48'))">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class Gif
{
public static void CefEngineLoaded(object sender, RoutedEventArgs e)
{
Uri Gif = SSEHS.GetSource(SSECSMI.Gif);
Uri Gif = SSEHS.GetSource(SSEMI.Info.Source, SSEMI.Host);

string Path = SSEHS.GetGifContentPath();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void CefEngineInitialized(object sender, EventArgs e)

public static void CefEngineLoaded(object sender, RoutedEventArgs e)
{
SSECSMI.CefEngine.Address = SSECSMI.Url;
SSECSMI.CefEngine.Address = SSEMI.Info.Source;
}

public static void CefEngineInitializedChanged(object sender, EventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using SMME = Sucrose.Manager.Manage.Engine;
using SSECSHV = Sucrose.Shared.Engine.CefSharp.Helper.Video;
using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal;
using SSEHS = Sucrose.Shared.Engine.Helper.Source;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;

namespace Sucrose.Shared.Engine.CefSharp.Event
Expand All @@ -11,7 +12,7 @@ internal static class Video
{
public static void CefEngineLoaded(object sender, RoutedEventArgs e)
{
//
SSECSMI.CefEngine.Address = SSEHS.GetSource(SSEMI.Info.Source, SSEMI.Host).ToString();
}

public static void CefEngineInitializedChanged(object sender, EventArgs e)
Expand Down
5 changes: 3 additions & 2 deletions src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Web.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CefSharp;
using System.IO;
using System.Windows;
using Application = System.Windows.Application;
using SEIT = Skylark.Enum.InputType;
using SMME = Sucrose.Manager.Manage.Engine;
using SSECSEI = Sucrose.Shared.Engine.CefSharp.Extension.Interaction;
Expand All @@ -19,7 +20,7 @@ internal static class Web
{
public static void CefEngineLoaded(object sender, RoutedEventArgs e)
{
SSECSMI.CefEngine.Address = SSEHS.GetSource(SSECSMI.Web).ToString();
SSECSMI.CefEngine.Address = SSEHS.GetSource(SSEMI.Info.Source, SSEMI.Host).ToString();
}

public static void CefEngineInitializedChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -66,7 +67,7 @@ public static void CefEngineFrameLoadEnd(object sender, FrameLoadEndEventArgs e)

private static async void PropertiesWatcher(object sender, FileSystemEventArgs e)
{
await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
await Application.Current.Dispatcher.InvokeAsync(async () =>
{
try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CefSharp;
using System.Windows;
using SMME = Sucrose.Manager.Manage.Engine;
using SMMRC = Sucrose.Memory.Manage.Readonly.Content;
using SSECSHYT = Sucrose.Shared.Engine.CefSharp.Helper.YouTube;
using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal;
using SSEHS = Sucrose.Shared.Engine.Helper.Source;
Expand All @@ -13,14 +14,14 @@ internal static class YouTube
{
public static void CefEngineLoaded(object sender, RoutedEventArgs e)
{
string Video = SSTHV.GetYouTubeVideoId(SSECSMI.YouTube);
string Playlist = SSTHV.GetYouTubePlaylistId(SSECSMI.YouTube);
string Video = SSTHV.GetYouTubeVideoId(SSEMI.Info.Source);
string Playlist = SSTHV.GetYouTubePlaylistId(SSEMI.Info.Source);

string Path = SSEHS.GetYouTubeContentPath();

SSEHS.WriteYouTubeContent(Path, Video, Playlist);

SSECSMI.CefEngine.Address = SSEHS.GetSource(Path).ToString();
SSECSMI.CefEngine.Address = SSEHS.GetSource(SMMRC.YouTube, SSEMI.Host).ToString();
}

public static void CefEngineInitializedChanged(object sender, EventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ public static void GetInputHandle()

IntPtr InputHandle = SWNM.FindWindowEx(SSECSMI.CefHandle, IntPtr.Zero, "Chrome_WidgetWin_0", null);

if (!InputHandle.Equals(IntPtr.Zero))
if (InputHandle.Equals(IntPtr.Zero))
{
SSECSMI.CefHandle = InputHandle;
InputHandle = SWNM.FindWindowEx(SSECSMI.CefHandle, IntPtr.Zero, "Chrome_WidgetWin_1", null);
}

SSECSMI.CefHandle = InputHandle;
}

public static void GetIntermediateHandle()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CefSharp;
using Application = System.Windows.Application;
using SMMCB = Sucrose.Memory.Manage.Constant.Backgroundog;
using SMMI = Sucrose.Manager.Manage.Internal;
using SPMI = Sucrose.Pipe.Manage.Internal;
Expand Down Expand Up @@ -89,7 +90,7 @@ public static void StartCompatible()
{
SSPSBSS.Handler(e);

await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
await Application.Current.Dispatcher.InvokeAsync(async () =>
{
try
{
Expand Down Expand Up @@ -118,7 +119,7 @@ await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
{
SSSSBSS.Handler(s, e);

await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
await Application.Current.Dispatcher.InvokeAsync(async () =>
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@ internal static class Internal

public static bool State = true;

public static string Gif = string.Empty;

public static string Url = string.Empty;

public static string Web = string.Empty;

public static CefEngine CefEngine = new();

public static IBrowserHost CefHost = null;

public static string YouTube = string.Empty;

public static IntPtr CefHandle = IntPtr.Zero;

public static BrowserSettings CefSettings => new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Extension\Screenshot.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Handler\CustomContextMenu.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Execute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Input.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Handle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Management.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Web.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Video.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Sucrose.Shared.Engine.CefSharp.View
/// </summary>
public sealed partial class Gif : Window, IDisposable
{
public Gif(string Gif)
public Gif()
{
InitializeComponent();

Expand All @@ -29,8 +29,6 @@ public Gif(string Gif)

Content = SSECSMI.CefEngine;

SSECSMI.Gif = Gif;

SSECSMI.CefEngine.BrowserSettings = SSECSMI.CefSettings;

SSEMI.GeneralTimer.Tick += new EventHandler(GeneralTimer_Tick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Sucrose.Shared.Engine.CefSharp.View
/// </summary>
public sealed partial class Url : Window, IDisposable
{
public Url(string Url)
public Url()
{
InitializeComponent();

Expand All @@ -30,8 +30,6 @@ public Url(string Url)

Content = SSECSMI.CefEngine;

SSECSMI.Url = Url;

SSECSMI.CefEngine.BrowserSettings = SSECSMI.CefSettings;

SSEMI.GeneralTimer.Tick += new EventHandler(GeneralTimer_Tick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEHS = Sucrose.Shared.Engine.Helper.Source;
using SSEHV = Sucrose.Shared.Engine.Helper.Volume;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;

Expand All @@ -19,7 +18,7 @@ namespace Sucrose.Shared.Engine.CefSharp.View
/// </summary>
public sealed partial class Video : Window, IDisposable
{
public Video(string Video)
public Video()
{
InitializeComponent();

Expand All @@ -31,8 +30,6 @@ public Video(string Video)

Content = SSECSMI.CefEngine;

SSECSMI.CefEngine.Address = SSEHS.GetSource(Video).ToString();

SSECSMI.CefEngine.BrowserSettings = SSECSMI.CefSettings;

SSEMI.GeneralTimer.Tick += new EventHandler(GeneralTimer_Tick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Sucrose.Shared.Engine.CefSharp.View
/// </summary>
public sealed partial class Web : Window, IDisposable
{
public Web(string Web)
public Web()
{
InitializeComponent();

Expand All @@ -30,8 +30,6 @@ public Web(string Web)

Content = SSECSMI.CefEngine;

SSECSMI.Web = Web;

SSECSMI.CefEngine.BrowserSettings = SSECSMI.CefSettings;

SSEMI.GeneralTimer.Tick += new EventHandler(GeneralTimer_Tick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Sucrose.Shared.Engine.CefSharp.View
/// </summary>
public sealed partial class YouTube : Window, IDisposable
{
public YouTube(string YouTube)
public YouTube()
{
InitializeComponent();

Expand All @@ -30,8 +30,6 @@ public YouTube(string YouTube)

Content = SSECSMI.CefEngine;

SSECSMI.YouTube = YouTube;

SSECSMI.CefEngine.BrowserSettings = SSECSMI.CefSettings;

SSEMI.GeneralTimer.Tick += new EventHandler(GeneralTimer_Tick);
Expand Down
3 changes: 2 additions & 1 deletion src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Web.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.Web.WebView2.Core;
using System.Collections;
using System.IO;
using Application = System.Windows.Application;
using SEIT = Skylark.Enum.InputType;
using SELLT = Skylark.Enum.LevelLogType;
using SMME = Sucrose.Manager.Manage.Engine;
Expand All @@ -23,7 +24,7 @@ internal static class Web
{
private static async void PropertiesWatcher(object sender, FileSystemEventArgs e)
{
await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
await Application.Current.Dispatcher.InvokeAsync(async () =>
{
try
{
Expand Down
7 changes: 4 additions & 3 deletions src/Shared/Engine/Sucrose.Shared.Engine.WebView/Helper/Web.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SMMCB = Sucrose.Memory.Manage.Constant.Backgroundog;
using Application = System.Windows.Application;
using SMMCB = Sucrose.Memory.Manage.Constant.Backgroundog;
using SMMI = Sucrose.Manager.Manage.Internal;
using SPMI = Sucrose.Pipe.Manage.Internal;
using SSDECT = Sucrose.Shared.Dependency.Enum.CommunicationType;
Expand Down Expand Up @@ -72,7 +73,7 @@ public static void StartCompatible()
{
SSPSBSS.Handler(e);

await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
await Application.Current.Dispatcher.InvokeAsync(async () =>
{
try
{
Expand Down Expand Up @@ -101,7 +102,7 @@ await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
{
SSSSBSS.Handler(s, e);

await System.Windows.Application.Current.Dispatcher.InvokeAsync(async () =>
await Application.Current.Dispatcher.InvokeAsync(async () =>
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Event\YouTube.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extension\Interaction.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extension\Screenshot.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Input.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Handle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Management.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Url.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Gif.cs" />
Expand Down
Loading

0 comments on commit 3405875

Please sign in to comment.