From 74fe3323f63b5ab2184ede1cb106d8bf5089865e Mon Sep 17 00:00:00 2001 From: dudantas Date: Tue, 7 Feb 2023 10:27:23 -0300 Subject: [PATCH] improve: some changes to launcher Added to create shortcut Added launcher_config.json for read launcher configs from url Fixed some other things --- .gitignore | 2 + CanaryLauncher.csproj | 97 +++++++++ CanaryLauncher.sln | 25 +++ CanaryLauncherUpdate.csproj | 91 --------- .../PublishProfiles/FolderProfile.pubxml | 12 -- .../PublishProfiles/FolderProfile.pubxml.user | 9 - App.xaml => src/App.xaml | 0 App.xaml.cs => src/App.xaml.cs | 13 +- AssemblyInfo.cs => src/AssemblyInfo.cs | 0 src/ClientConfig.cs | 38 ++++ MainWindow.xaml => src/MainWindow.xaml | 25 +-- MainWindow.xaml.cs => src/MainWindow.xaml.cs | 188 ++++++++++++------ SplashScreen.xaml => src/SplashScreen.xaml | 0 .../SplashScreen.xaml.cs | 70 ++++--- 14 files changed, 346 insertions(+), 224 deletions(-) create mode 100644 CanaryLauncher.csproj create mode 100644 CanaryLauncher.sln delete mode 100644 CanaryLauncherUpdate.csproj delete mode 100644 Properties/PublishProfiles/FolderProfile.pubxml delete mode 100644 Properties/PublishProfiles/FolderProfile.pubxml.user rename App.xaml => src/App.xaml (100%) rename App.xaml.cs => src/App.xaml.cs (63%) rename AssemblyInfo.cs => src/AssemblyInfo.cs (100%) create mode 100644 src/ClientConfig.cs rename MainWindow.xaml => src/MainWindow.xaml (92%) rename MainWindow.xaml.cs => src/MainWindow.xaml.cs (53%) rename SplashScreen.xaml => src/SplashScreen.xaml (100%) rename SplashScreen.xaml.cs => src/SplashScreen.xaml.cs (51%) diff --git a/.gitignore b/.gitignore index 6970b3e..c497c96 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ obj # Build results Properties/ +.vs/ +.obj/ diff --git a/CanaryLauncher.csproj b/CanaryLauncher.csproj new file mode 100644 index 0000000..e1d5a5f --- /dev/null +++ b/CanaryLauncher.csproj @@ -0,0 +1,97 @@ + + + + + Debug + AnyCPU + {E21D451C-4724-4738-A716-DD441AD38747} + WinExe + CanaryLauncher + icon.ico + CanaryLauncher + v4.8 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + + + + + + + + + + + + + + + diff --git a/CanaryLauncher.sln b/CanaryLauncher.sln new file mode 100644 index 0000000..74d1c05 --- /dev/null +++ b/CanaryLauncher.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CanaryLauncher", "CanaryLauncher.csproj", "{E21D451C-4724-4738-A716-DD441AD38747}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E21D451C-4724-4738-A716-DD441AD38747}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E21D451C-4724-4738-A716-DD441AD38747}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E21D451C-4724-4738-A716-DD441AD38747}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E21D451C-4724-4738-A716-DD441AD38747}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F0CE66E6-7311-4CFA-8866-0B11975F833A} + EndGlobalSection +EndGlobal diff --git a/CanaryLauncherUpdate.csproj b/CanaryLauncherUpdate.csproj deleted file mode 100644 index 0fe9380..0000000 --- a/CanaryLauncherUpdate.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - WinExe - net6.0-windows - enable - true - true - icon.ico - CanaryLauncher - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - True - \ - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - - - - - True - \ - - - - diff --git a/Properties/PublishProfiles/FolderProfile.pubxml b/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index 4ac9958..0000000 --- a/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Release - Any CPU - bin\Release\net6.0-windows\publish\ - FileSystem - - \ No newline at end of file diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user deleted file mode 100644 index 10965bb..0000000 --- a/Properties/PublishProfiles/FolderProfile.pubxml.user +++ /dev/null @@ -1,9 +0,0 @@ - - - - - True|2022-10-07T16:56:25.9223960Z;True|2022-10-07T13:54:42.8724885-03:00;True|2022-10-07T13:16:26.4419014-03:00; - - \ No newline at end of file diff --git a/App.xaml b/src/App.xaml similarity index 100% rename from App.xaml rename to src/App.xaml diff --git a/App.xaml.cs b/src/App.xaml.cs similarity index 63% rename from App.xaml.cs rename to src/App.xaml.cs index 30e601e..642ac69 100644 --- a/App.xaml.cs +++ b/src/App.xaml.cs @@ -11,7 +11,14 @@ namespace CanaryLauncherUpdate /// /// Interaction logic for App.xaml /// - public partial class App : Application - { - } + public class Program + { + [STAThread] + public static void Main(string[] args) + { + App app = new App(); + app.InitializeComponent(); + app.Run(); + } + } } diff --git a/AssemblyInfo.cs b/src/AssemblyInfo.cs similarity index 100% rename from AssemblyInfo.cs rename to src/AssemblyInfo.cs diff --git a/src/ClientConfig.cs b/src/ClientConfig.cs new file mode 100644 index 0000000..0500688 --- /dev/null +++ b/src/ClientConfig.cs @@ -0,0 +1,38 @@ +using System; +using System.Windows; +using System.Net; +using System.IO; +using System.Collections.Generic; +using System.Net.Http; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace LauncherConfig +{ + public class ClientConfig + { + public string clientVersion { get; set; } + public string launcherVersion { get; set; } + public bool replaceFolders { get; set; } + public ReplaceFolderName[] replaceFolderName { get; set; } + public string clientFolder { get; set; } + public string newClientUrl { get; set; } + public string newConfigUrl { get; set; } + public string clientExecutable { get; set; } + + public static ClientConfig loadFromFile(string url) + { + using (HttpClient client = new HttpClient()) + { + Task jsonTask = client.GetStringAsync(url); + string jsonString = jsonTask.Result; + return JsonConvert.DeserializeObject(jsonString); + } + } + } + + public class ReplaceFolderName + { + public string name { get; set; } + } +} diff --git a/MainWindow.xaml b/src/MainWindow.xaml similarity index 92% rename from MainWindow.xaml rename to src/MainWindow.xaml index 064435c..aef50b2 100644 --- a/MainWindow.xaml +++ b/src/MainWindow.xaml @@ -41,7 +41,7 @@ - + -