Skip to content

Commit

Permalink
Preparing Other Setting Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 10, 2023
1 parent 0c2b373 commit c7f92c3
Show file tree
Hide file tree
Showing 21 changed files with 120 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Library/Sucrose.Memory/Constant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public static class Constant

public const string UpdateType = "UpdateType";

public const string ChannelType = "ChannelType";

public const string MemoryUsage = "MemoryUsage";

public const string LibraryMove = "LibraryMove";
Expand Down
2 changes: 1 addition & 1 deletion src/Library/Sucrose.Memory/Readonly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static class Readonly

public static readonly string LauncherMutex = "{Sucrose-Wallpaper-Engine-Launcher}";

public static readonly string UserAgent = "Sucrose/1.1 (Wallpaper Engine) SucroseWebKit";
public static readonly string UserAgent = "Sucrose/1.2 (Wallpaper Engine) SucroseWebKit";

public static readonly string BrowseWebsite = $"https://github.com/{Owner}/{Repository}";

Expand Down
3 changes: 3 additions & 0 deletions src/Portal/Sucrose.Portal/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using SHS = Skylark.Helper.Skymath;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SSCECT = Sucrose.Shared.Core.Enum.ChannelType;
using SSCEUT = Sucrose.Shared.Core.Enum.UpdateType;
using SSDEDT = Sucrose.Shared.Dependency.Enum.DisplayType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PerformanceType;
Expand Down Expand Up @@ -48,6 +49,8 @@ internal static class Manager

public static SSCEUT UpdateType => SMMI.UpdateSettingManager.GetSetting(SMC.UpdateType, SSCEUT.Compressed);

public static SSCECT ChannelType => SMMI.UpdateSettingManager.GetSetting(SMC.ChannelType, SSCECT.Release);

public static SEST ScreenType => SMMI.EngineSettingManager.GetSetting(SMC.ScreenType, SEST.DisplayBound);

public static int Port => SHS.Clamp(SMMI.LauncherSettingManager.GetSettingStable(SMC.Port, 0), 0, 65535);
Expand Down
1 change: 1 addition & 0 deletions src/Portal/Sucrose.Portal/Sucrose.Portal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Downloader" Version="3.0.6" />
<PackageReference Include="Skylark.Wing" Version="3.1.1.4" />
<PackageReference Include="XamlFlair.WPF" Version="1.2.13" />
<PackageReference Include="WPF-UI" Version="3.0.0-preview.7" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using SMR = Sucrose.Memory.Readonly;
using SPMM = Sucrose.Portal.Manage.Manager;
using SPVCEC = Sucrose.Portal.Views.Controls.ExpanderCard;
using SSCECT = Sucrose.Shared.Core.Enum.ChannelType;
using SSCEUT = Sucrose.Shared.Core.Enum.UpdateType;
using SSRER = Sucrose.Shared.Resources.Extension.Resources;
using SSSMI = Sucrose.Shared.Store.Manage.Internal;
Expand Down Expand Up @@ -221,6 +222,31 @@ private void InitializeViewModel()

Contents.Add(UpdateArea);

SPVCEC Channel = new()
{
Margin = new Thickness(0, 10, 0, 0),
Expandable = false
};

Channel.LeftIcon.Symbol = SymbolRegular.ChannelShare24;
Channel.Title.Text = SSRER.GetValue("Portal", "OtherSettingPage", "Channel");
Channel.Description.Text = SSRER.GetValue("Portal", "OtherSettingPage", "Channel", "Description");

ComboBox ChannelType = new();

ChannelType.SelectionChanged += (s, e) => ChannelTypeSelected(ChannelType.SelectedIndex);

foreach (SSCECT Type in Enum.GetValues(typeof(SSCECT)))
{
ChannelType.Items.Add(SSRER.GetValue("Portal", "Enum", "ChannelType", $"{Type}"));
}

ChannelType.SelectedIndex = (int)SPMM.ChannelType;

Channel.HeaderFrame = ChannelType;

Contents.Add(Channel);

SPVCEC Update = new()
{
Margin = new Thickness(0, 10, 0, 0),
Expand Down Expand Up @@ -367,6 +393,16 @@ private void UpdateTypeSelected(int Index)
}
}

private void ChannelTypeSelected(int Index)
{
if (Index != (int)SPMM.ChannelType)
{
SSCECT Type = (SSCECT)Index;

SMMI.UpdateSettingManager.SetSetting(SMC.ChannelType, Type);
}
}

private void DiscordStateChecked(bool State)
{
SMMI.HookSettingManager.SetSetting(SMC.DiscordState, State);
Expand Down
12 changes: 12 additions & 0 deletions src/Shared/Sucrose.Shared.Core/Enum/ChannelType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;

namespace Sucrose.Shared.Core.Enum
{
internal enum ChannelType
{
[DisplayAttribute(Name = "Release", Description = "Release")]
Release,
[DisplayAttribute(Name = "PreRelease", Description = "Pre-Release")]
PreRelease
}
}
8 changes: 8 additions & 0 deletions src/Shared/Sucrose.Shared.Core/Helper/Attribute.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using SSCECT = Sucrose.Shared.Core.Enum.ChannelType;
using SSCEFT = Sucrose.Shared.Core.Enum.FrameworkType;
using SSCEUT = Sucrose.Shared.Core.Enum.UpdateType;

Expand All @@ -20,5 +21,12 @@ public static DisplayAttribute GetDisplay(SSCEUT Enum)

return Field?.GetCustomAttribute<DisplayAttribute>();
}

public static DisplayAttribute GetDisplay(SSCECT Enum)
{
FieldInfo Field = Enum.GetType().GetField(Enum.ToString());

return Field?.GetCustomAttribute<DisplayAttribute>();
}
}
}
18 changes: 18 additions & 0 deletions src/Shared/Sucrose.Shared.Core/Helper/Channel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using SSCECT = Sucrose.Shared.Core.Enum.ChannelType;
using SSCHA = Sucrose.Shared.Core.Helper.Attribute;

namespace Sucrose.Shared.Core.Helper
{
internal static class Channel
{
public static string GetName(SSCECT Type)
{
return SSCHA.GetDisplay(Type).GetName();
}

public static string GetDescription(SSCECT Type)
{
return SSCHA.GetDisplay(Type).GetDescription();
}
}
}
2 changes: 2 additions & 0 deletions src/Shared/Sucrose.Shared.Core/Sucrose.Shared.Core.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
<Import_RootNamespace>Sucrose.Shared.Core</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Enum\ChannelType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Enum\UpdateType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Enum\FrameworkType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Attribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Channel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Update.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Memory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Version.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<system:String x:Key="Portal.Enum.WindowBackdropType.Tabbed">Gestuft</system:String>
<system:String x:Key="Portal.Enum.WindowBackdropType.Acrylic">Acryl</system:String>

<system:String x:Key="Portal.Enum.ChannelType.Release">Standard</system:String>
<system:String x:Key="Portal.Enum.ChannelType.PreRelease">Entwickler</system:String>

<system:String x:Key="Portal.Enum.ExpandScreenType.Default">Standard</system:String>

<system:String x:Key="Portal.Enum.UpdateType.Compressed">Komprimiert</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<system:String x:Key="Portal.Enum.WindowBackdropType.Tabbed">Tabbed</system:String>
<system:String x:Key="Portal.Enum.WindowBackdropType.Acrylic">Acrylic</system:String>

<system:String x:Key="Portal.Enum.ChannelType.Release">Default</system:String>
<system:String x:Key="Portal.Enum.ChannelType.PreRelease">Developer</system:String>

<system:String x:Key="Portal.Enum.ExpandScreenType.Default">Default</system:String>

<system:String x:Key="Portal.Enum.UpdateType.Compressed">Compressed</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<system:String x:Key="Portal.Enum.WindowBackdropType.Tabbed">Con Pestañas</system:String>
<system:String x:Key="Portal.Enum.WindowBackdropType.Acrylic">Acrílico</system:String>

<system:String x:Key="Portal.Enum.ChannelType.Release">Por Defecto</system:String>
<system:String x:Key="Portal.Enum.ChannelType.PreRelease">Desarrollador</system:String>

<system:String x:Key="Portal.Enum.ExpandScreenType.Default">Por Defecto</system:String>

<system:String x:Key="Portal.Enum.UpdateType.Compressed">Comprimido</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<system:String x:Key="Portal.Enum.WindowBackdropType.Tabbed">Onglets</system:String>
<system:String x:Key="Portal.Enum.WindowBackdropType.Acrylic">Acrylique</system:String>

<system:String x:Key="Portal.Enum.ChannelType.Release">Par Défaut</system:String>
<system:String x:Key="Portal.Enum.ChannelType.PreRelease">Développeur</system:String>

<system:String x:Key="Portal.Enum.ExpandScreenType.Default">Défaut</system:String>

<system:String x:Key="Portal.Enum.UpdateType.Compressed">Compressé</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<system:String x:Key="Portal.Enum.WindowBackdropType.Tabbed">Z Kartami</system:String>
<system:String x:Key="Portal.Enum.WindowBackdropType.Acrylic">Akryl</system:String>

<system:String x:Key="Portal.Enum.ChannelType.Release">Domyślny</system:String>
<system:String x:Key="Portal.Enum.ChannelType.PreRelease">Deweloper</system:String>

<system:String x:Key="Portal.Enum.ExpandScreenType.Default">Domyślny</system:String>

<system:String x:Key="Portal.Enum.UpdateType.Compressed">Skompresowany</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<system:String x:Key="Portal.Enum.WindowBackdropType.Tabbed">Sekmeli</system:String>
<system:String x:Key="Portal.Enum.WindowBackdropType.Acrylic">Akrilik</system:String>

<system:String x:Key="Portal.Enum.ChannelType.Release">Varsayılan</system:String>
<system:String x:Key="Portal.Enum.ChannelType.PreRelease">Geliştirici</system:String>

<system:String x:Key="Portal.Enum.ExpandScreenType.Default">Varsayılan</system:String>

<system:String x:Key="Portal.Enum.UpdateType.Compressed">Sıkıştırılmış</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey">Bitte geben Sie einen persönlichen Zugriffstoken ein</system:String>
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey.Valid">Bitte geben Sie einen gültigen persönlichen Zugriffstoken ein</system:String>

<system:String x:Key="Portal.OtherSettingPage.Channel">Update-Kanal</system:String>
<system:String x:Key="Portal.OtherSettingPage.Channel.Description">Der Kanal, über den Updates durchgeführt oder nicht durchgeführt werden sollen.</system:String>

<system:String x:Key="Portal.OtherSettingPage.Update">Aktualisierungsmethode</system:String>
<system:String x:Key="Portal.OtherSettingPage.Update.Description">Die Methode, die für den Aktualisierungsvorgang verwendet wird.</system:String>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey">Please enter a personal access token</system:String>
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey.Valid">Please enter a valid personal access token</system:String>

<system:String x:Key="Portal.OtherSettingPage.Channel">Update Channel</system:String>
<system:String x:Key="Portal.OtherSettingPage.Channel.Description">The channel through which updates will or will not be performed.</system:String>

<system:String x:Key="Portal.OtherSettingPage.Update">Update Method</system:String>
<system:String x:Key="Portal.OtherSettingPage.Update.Description">The method used for the update process.</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey">Por favor, ingresa un token de acceso personal</system:String>
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey.Valid">Por favor, ingresa un token de acceso personal válido</system:String>


<system:String x:Key="Portal.OtherSettingPage.Channel">Canal de Actualización</system:String>
<system:String x:Key="Portal.OtherSettingPage.Channel.Description">El canal a través del cual se realizarán o no las actualizaciones.</system:String>

<system:String x:Key="Portal.OtherSettingPage.Update">Método de Actualización</system:String>
<system:String x:Key="Portal.OtherSettingPage.Update.Description">El método utilizado para el proceso de actualización.</system:String>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey">Veuillez entrer un jeton d'accès personnel</system:String>
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey.Valid">Veuillez entrer un jeton d'accès personnel valide</system:String>

<system:String x:Key="Portal.OtherSettingPage.Channel">Canal de Mise à Jour</system:String>
<system:String x:Key="Portal.OtherSettingPage.Channel.Description">Le canal par lequel les mises à jour seront effectuées ou non.</system:String>

<system:String x:Key="Portal.OtherSettingPage.Update">Méthode de Mise à Jour</system:String>
<system:String x:Key="Portal.OtherSettingPage.Update.Description">La méthode utilisée pour le processus de mise à jour.</system:String>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey">Proszę wprowadzić osobisty token dostępu</system:String>
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey.Valid">Proszę wprowadzić prawidłowy osobisty token dostępu</system:String>

<system:String x:Key="Portal.OtherSettingPage.Channel">Kanał Aktualizacji</system:String>
<system:String x:Key="Portal.OtherSettingPage.Channel.Description">Kanał, przez który będą lub nie będą wykonywane aktualizacje.</system:String>

<system:String x:Key="Portal.OtherSettingPage.Update">Metoda Aktualizacji</system:String>
<system:String x:Key="Portal.OtherSettingPage.Update.Description">Metoda używana w procesie aktualizacji.</system:String>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey">Lütfen bir kişisel erişim belirteci girin</system:String>
<system:String x:Key="Portal.OtherSettingPage.Key.PersonalKey.Valid">Lütfen geçerli bir kişisel erişim belirteci girin</system:String>

<system:String x:Key="Portal.OtherSettingPage.Channel">Güncelleme Kanalı</system:String>
<system:String x:Key="Portal.OtherSettingPage.Channel.Description">Güncelleme işleminin hangi kanal üzerinden yapılıp yapılmayacağı.</system:String>

<system:String x:Key="Portal.OtherSettingPage.Update">Güncelleme Yöntemi</system:String>
<system:String x:Key="Portal.OtherSettingPage.Update.Description">Güncelleme işleminin hangi yöntemle yapılıp yapılmayacağı.</system:String>

Expand Down

0 comments on commit c7f92c3

Please sign in to comment.