Skip to content

Commit

Permalink
Major Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed May 13, 2024
1 parent db32994 commit 5a219bd
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.CefSharp/Sucrose.Live.CefSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WinEventHook" Version="0.3.6" />
<PackageReference Include="RawInput.Sharp" Version="0.1.3" />
<PackageReference Include="Skylark.Wing" Version="3.1.4.4" />
<PackageReference Include="Skylark.Standard" Version="3.1.5.2" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.WebView/Sucrose.Live.WebView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WinEventHook" Version="0.3.6" />
<PackageReference Include="RawInput.Sharp" Version="0.1.3" />
<PackageReference Include="Skylark.Wing" Version="3.1.4.4" />
<PackageReference Include="Skylark.Standard" Version="3.1.5.2" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2526-prerelease" />
Expand Down
39 changes: 39 additions & 0 deletions src/Portal/Sucrose.Portal/Extension/ThemeCreate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using SMR = Sucrose.Memory.Readonly;
using SSDEWT = Sucrose.Shared.Dependency.Enum.WallpaperType;

namespace Sucrose.Portal.Extension
{
internal static class ThemeCreate
{
public static string GetAuthor()
{
return Environment.UserName;
}

public static string GetContact()
{
string Result = string.Empty;

if (SMR.Randomise.Next(2) == 0)
{
Result = $"{GetAuthor()}@example.com";
}
else
{
Result = $"https://{GetAuthor()}.com";
}

return Result.ToLowerInvariant();
}

public static string GetTitle(string Name)
{
return Name;
}

public static string GetDescription(string Name, SSDEWT Type)
{
return $"{Name} - {Type} Wallpaper";
}
}
}
54 changes: 52 additions & 2 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Wpf.Ui.Controls;
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
using SEAT = Skylark.Enum.AssemblyType;
using SHA = Skylark.Helper.Assemblies;
using SHG = Skylark.Helper.Generator;
using SMMM = Sucrose.Manager.Manage.Manager;
using SMR = Sucrose.Memory.Readonly;
using SPETC = Sucrose.Portal.Extension.ThemeCreate;
using SPETL = Sucrose.Portal.Extension.ThumbnailLoader;
using SPMI = Sucrose.Portal.Manage.Internal;
using SRER = Sucrose.Resources.Extension.Resources;
Expand Down Expand Up @@ -79,20 +81,29 @@ private void GifCreate_Click(object sender, RoutedEventArgs e)
IsPrimaryButtonEnabled = true;
GifCard.Visibility = Visibility.Visible;
CreateCard.Visibility = Visibility.Collapsed;

GifAuthor.Text = SPETC.GetAuthor();
GifContact.Text = SPETC.GetContact();
}

private void UrlCreate_Click(object sender, RoutedEventArgs e)
{
IsPrimaryButtonEnabled = true;
UrlCard.Visibility = Visibility.Visible;
CreateCard.Visibility = Visibility.Collapsed;

UrlAuthor.Text = SPETC.GetAuthor();
UrlContact.Text = SPETC.GetContact();
}

private void WebCreate_Click(object sender, RoutedEventArgs e)
{
IsPrimaryButtonEnabled = true;
WebCard.Visibility = Visibility.Visible;
CreateCard.Visibility = Visibility.Collapsed;

//WebAuthor.Text = SPETC.GetAuthor();
//WebContact.Text = SPETC.GetContact();
}

private void GifDelete_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -136,6 +147,8 @@ private async void GifArea_Drop(object sender, DragEventArgs e)

if (Extension is ".gif")
{
GifDescription.Text = SPETC.GetDescription(Path.GetFileNameWithoutExtension(Record), SSDEWT.Gif);
GifTitle.Text = SPETC.GetTitle(Path.GetFileNameWithoutExtension(Record));
GifImagine.Source = await Loader.LoadAsync(Record);
GifDelete.Visibility = Visibility.Visible;
GifIcon.Visibility = Visibility.Collapsed;
Expand Down Expand Up @@ -165,6 +178,9 @@ private void VideoCreate_Click(object sender, RoutedEventArgs e)
IsPrimaryButtonEnabled = true;
VideoCard.Visibility = Visibility.Visible;
CreateCard.Visibility = Visibility.Collapsed;

VideoAuthor.Text = SPETC.GetAuthor();
VideoContact.Text = SPETC.GetContact();
}

private void VideoArea_DragLeave(object sender, DragEventArgs e)
Expand Down Expand Up @@ -217,6 +233,8 @@ private async void VideoArea_Drop(object sender, DragEventArgs e)

if (Extension is ".mp4" or ".avi" or ".mov" or ".mkv" or ".ogv" or ".flv" or ".wmv" or ".hevc" or ".webm" or ".mpeg" or ".mpeg1" or ".mpeg2" or ".mpeg4")
{
VideoDescription.Text = SPETC.GetDescription(Path.GetFileNameWithoutExtension(Record), SSDEWT.Video);
VideoTitle.Text = SPETC.GetTitle(Path.GetFileNameWithoutExtension(Record));
VideoImagine.Source = await Loader.LoadAsync(Record);
VideoDelete.Visibility = Visibility.Visible;
VideoIcon.Visibility = Visibility.Collapsed;
Expand All @@ -234,6 +252,9 @@ private void YouTubeCreate_Click(object sender, RoutedEventArgs e)
IsPrimaryButtonEnabled = true;
YouTubeCard.Visibility = Visibility.Visible;
CreateCard.Visibility = Visibility.Collapsed;

YouTubeAuthor.Text = SPETC.GetAuthor();
YouTubeContact.Text = SPETC.GetContact();
}

private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -284,6 +305,9 @@ private void ApplicationCreate_Click(object sender, RoutedEventArgs e)
IsPrimaryButtonEnabled = true;
CreateCard.Visibility = Visibility.Collapsed;
ApplicationCard.Visibility = Visibility.Visible;

//ApplicationAuthor.Text = SPETC.GetAuthor();
//ApplicationContact.Text = SPETC.GetContact();
}

private void ContentDialog_PreviewKeyDown(object sender, KeyEventArgs e)
Expand Down Expand Up @@ -429,7 +453,20 @@ protected override async void OnButtonClick(ContentDialogButton Button)
}
else
{
await Task.Run(async () => await ExtractResources(Thumbnail, Theme));
try
{
using FileStream Stream = new(Path.Combine(Theme, Thumbnail), FileMode.Create);

BitmapEncoder Encoder = new JpegBitmapEncoder();

Encoder.Frames.Add(BitmapFrame.Create((BitmapSource)GifImagine.Source));

Encoder.Save(Stream);
}
catch
{
await Task.Run(async () => await ExtractResources(Thumbnail, Theme));
}
}

if (File.Exists($"{GifPreview.Content}"))
Expand Down Expand Up @@ -683,7 +720,20 @@ protected override async void OnButtonClick(ContentDialogButton Button)
}
else
{
await Task.Run(async () => await ExtractResources(Thumbnail, Theme));
try
{
using FileStream Stream = new(Path.Combine(Theme, Thumbnail), FileMode.Create);

BitmapEncoder Encoder = new JpegBitmapEncoder();

Encoder.Frames.Add(BitmapFrame.Create((BitmapSource)VideoImagine.Source));

Encoder.Save(Stream);
}
catch
{
await Task.Run(async () => await ExtractResources(Thumbnail, Theme));
}
}

if (File.Exists($"{VideoPreview.Content}"))
Expand Down
Loading

0 comments on commit 5a219bd

Please sign in to comment.