Compare commits

..

No commits in common. "dev" and "main" have entirely different histories.
dev ... main

11 changed files with 391 additions and 825 deletions

View File

@ -2,10 +2,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="toast_mcl.App" x:Class="toast_mcl.App"
xmlns:sty="using:FluentAvalonia.Styling" xmlns:sty="using:FluentAvalonia.Styling"
RequestedThemeVariant="Dark"> RequestedThemeVariant="Dark"
>
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. --> <!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles> <Application.Styles>
<!--<FluentTheme />-->
<sty:FluentAvaloniaTheme /> <sty:FluentAvaloniaTheme />
</Application.Styles> </Application.Styles>
<Application.Resources> <Application.Resources>

1047
LICENSE

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,11 @@
Title="toast_mcl"> Title="toast_mcl">
<Grid> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TabControl> <TabControl>
<TabItem Header="主页"> <TabItem Header="主页">
<ContentControl> <ContentControl>
@ -35,6 +40,7 @@
<local:About/> <local:About/>
</ContentControl> </ContentControl>
</TabItem> </TabItem>
</TabControl> </TabControl>
</Grid> </Grid>
</Window> </Window>

View File

@ -1,6 +1,5 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="toast_mcl.About"> x:Class="toast_mcl.About">
<UniformGrid Columns="1" Rows="1" HorizontalAlignment="Center" VerticalAlignment="Center"> This is About
</UniformGrid>
</UserControl> </UserControl>

View File

@ -1,31 +1,23 @@
using Avalonia; using Avalonia;
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using toast_mcl;
namespace toast_mcl namespace toast_mcl
{ {
internal class Program internal class Program
{ {
// 初始化代码。 // Initialization code. Don't use any Avalonia, third-party APIs or any
// 在调用AppMain之前请不要使用任何Avalonia、第三方API或任何依赖于SynchronizationContext的代码 // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// 因为这些东西尚未初始化,可能会导致错误。 // yet and stuff might break.
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args) => BuildAvaloniaApp()
{
Base.Init();
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args); .StartWithClassicDesktopLifetime(args);
}
// Avalonia配置,请勿删除;也被可视化设计器使用。 // Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp()
{ => AppBuilder.Configure<App>()
return AppBuilder.Configure<App>()
.UsePlatformDetect() .UsePlatformDetect()
.WithFont_LXGWWenKai() .WithFont_LXGWWenKai()
.LogToTrace(); .LogToTrace();
} }
}
} }

View File

@ -1,26 +0,0 @@
using System;
using toast_mcl.Programs;
namespace toast_mcl;
public static class Base
{
// 版本号处理
public enum VersionTypes
{
Alpha,
Beta,
Release
}
public static VersionTypes VersionType = VersionTypes.Alpha;
public static Version Version = new Version(0, 0, 1);
// 获取程序目录
public static string AppDirectory = AppDomain.CurrentDomain.BaseDirectory;
// 初始化
public static void Init()
{
ConfigUtils.Init();
}
}

View File

@ -1,15 +0,0 @@
using System;
using toast_mcl;
namespace toast_mcl.Config;
public class ConfigSettings
{
public AppSettings ?AppSettings { get; set; }
}
public class AppSettings
{
public Version Version { get; set; } = Base.Version;
public string VersionType { get; set; } = Base.VersionType.ToString();
}

View File

@ -1,66 +0,0 @@
using System.Linq;
using System.IO;
using Newtonsoft.Json;
using toast_mcl.Config;
using System;
namespace toast_mcl.Programs;
public static class ConfigUtils
{
/// <summary>
///
/// </summary>
public static ConfigSettings ?Settings { get; private set;}
private static readonly string ConfigFolderPath = Path.Combine(Base.AppDirectory, "toast_mc");
private static readonly string ConfigFilePath = Path.Combine(ConfigFolderPath, "config.json");
public static void Init()
{
if (!Directory.Exists(ConfigFolderPath))
{
Directory.CreateDirectory(ConfigFolderPath);
}
if (!File.Exists(ConfigFilePath))
{
CreateDefaultConfig();
}
LoadConfig();
}
private static void CreateDefaultConfig()
{
Settings = DefaultConfig.GetDefaultConfig();
SaveConfig();
}
public static void LoadConfig()
{
if (File.Exists(ConfigFilePath))
{
string configJson = File.ReadAllText(ConfigFilePath);
Settings = JsonConvert.DeserializeObject<ConfigSettings>(configJson);
}
else
{
CreateDefaultConfig();
}
var ConfigVersion = Settings?.AppSettings?.Version;
if (ConfigVersion != Base.Version)
{
var oldSettings = Settings;
UpdateConfig();
}
}
private static void UpdateConfig()
{
}
public static void SaveConfig()
{
string configJson = JsonConvert.SerializeObject(Settings, Formatting.Indented);
File.WriteAllText(ConfigFilePath, configJson);
}
}

View File

@ -1,20 +0,0 @@
using System;
using toast_mcl;
namespace toast_mcl.Config;
public static class DefaultConfig
{
public static ConfigSettings GetDefaultConfig()
{
return new ConfigSettings
{
AppSettings = new AppSettings
{
Version = Base.Version,
VersionType = Base.VersionType.ToString()
},
};
}
}

View File

@ -1,4 +1 @@
# Toast Minecraft Launcher # toast_mcl
[![Gitea](https://img.shields.io/badge/Gitea-609926)](https://git.hope-now.top:8443/HopeNowStudio/toast_mcl)

View File

@ -25,8 +25,6 @@
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.6" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.6" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.6" /> <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.6" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.5.0" />
<PackageReference Include="FluentAvaloniaUI" Version="2.0.5" /> <PackageReference Include="FluentAvaloniaUI" Version="2.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
</Project> </Project>