diff --git a/Release_Tool/Program.cs b/Release_Tool/Program.cs index 3c3f83c..9396485 100644 --- a/Release_Tool/Program.cs +++ b/Release_Tool/Program.cs @@ -105,6 +105,7 @@ namespace Release_Tool files.Add(new file(@"WeeXnes\bin\Release\DiscordRPC.dll", "DiscordRPC.dll")); files.Add(new file(@"WeeXnes\bin\Release\Newtonsoft.Json.dll", "Newtonsoft.Json.dll")); files.Add(new file(@"Autostart\bin\Release\Autostart.exe", "Autostart.exe")); + files.Add(new file(@"Update\bin\Release\Update.exe", "Update.exe")); } } } \ No newline at end of file diff --git a/Update/Program.cs b/Update/Program.cs new file mode 100644 index 0000000..15a5102 --- /dev/null +++ b/Update/Program.cs @@ -0,0 +1,65 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.IO.Compression; + +namespace Update +{ + internal class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Path: " + args[0]); + Console.WriteLine("FileName: " + args[1]); + Console.WriteLine("PID: " + args[2]); + Console.WriteLine("New File: " + args[3]); + Process p = Process.GetProcessById(Convert.ToInt32(args[2])); + p.Kill(); + p.WaitForExit(); + try + { + ZipArchiveHelper.ExtractToDirectory(args[3], args[0], true); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + ZipArchiveHelper.ExtractToDirectory(args[3], args[0], true); + } + Process.Start(args[0] + "\\" + args[1]); + if (File.Exists(args[3])) + { + File.Delete(args[3]); + } + + } + } + public static class ZipArchiveHelper + { + public static void ExtractToDirectory(string archiveFileName, string destinationDirectoryName, bool overwrite) + { + if (!overwrite) + { + ZipFile.ExtractToDirectory(archiveFileName, destinationDirectoryName); + } + else + { + using (var archive = ZipFile.OpenRead(archiveFileName)) + { + + foreach (var file in archive.Entries) + { + var completeFileName = Path.Combine(destinationDirectoryName, file.FullName); + var directory = Path.GetDirectoryName(completeFileName); + + if (!Directory.Exists(directory) && !string.IsNullOrEmpty(directory)) + Directory.CreateDirectory(directory); + + if (file.Name != "") + file.ExtractToFile(completeFileName, true); + } + + } + } + } + } +} \ No newline at end of file diff --git a/Update/Properties/AssemblyInfo.cs b/Update/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ee59963 --- /dev/null +++ b/Update/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Update")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Update")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6F2F689B-F4E3-4204-BA72-624BE46020AD")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Update/Update.csproj b/Update/Update.csproj new file mode 100644 index 0000000..6886dde --- /dev/null +++ b/Update/Update.csproj @@ -0,0 +1,56 @@ + + + + + Debug + AnyCPU + {6F2F689B-F4E3-4204-BA72-624BE46020AD} + Exe + Properties + Update + Update + v4.8 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + diff --git a/WeeXnes.sln b/WeeXnes.sln index 7f70992..6e2fc20 100644 --- a/WeeXnes.sln +++ b/WeeXnes.sln @@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeeXnes_UAC", "WeeXnes_UAC\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Release_Tool", "Release_Tool\Release_Tool.csproj", "{4C09AD12-B48E-40ED-B418-CF868889E317}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{6F2F689B-F4E3-4204-BA72-624BE46020AD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,5 +32,9 @@ Global {4C09AD12-B48E-40ED-B418-CF868889E317}.Debug|Any CPU.Build.0 = Debug|Any CPU {4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.ActiveCfg = Release|Any CPU {4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.Build.0 = Release|Any CPU + {6F2F689B-F4E3-4204-BA72-624BE46020AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F2F689B-F4E3-4204-BA72-624BE46020AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F2F689B-F4E3-4204-BA72-624BE46020AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F2F689B-F4E3-4204-BA72-624BE46020AD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/WeeXnes/Core/ApiResponse.cs b/WeeXnes/Core/ApiResponse.cs new file mode 100644 index 0000000..934d262 --- /dev/null +++ b/WeeXnes/Core/ApiResponse.cs @@ -0,0 +1,30 @@ +namespace WeeXnes.Core +{ + public class ApiResponse + { + public string download_url { get; set; } + public string file_name { get; set; } + public string tag_name { get; set; } + public string name { get; set; } + public string description { get; set; } + public ApiResponse(string _download_url, string _file_name, string _tag_name, string _name, string _description) + { + this.download_url = _download_url; + this.file_name = _file_name; + this.tag_name = _tag_name; + this.name = _name; + this.description = _description; + } + + public override string ToString() + { + string returnval = + "download_url: " + this.download_url + "\n" + + "file_name: " + this.file_name + "\n" + + "tag_name: " + this.tag_name + "\n" + + "name: " + this.name + "\n" + + "description: " + this.description; + return returnval; + } + } +} \ No newline at end of file diff --git a/WeeXnes/Core/Globals.cs b/WeeXnes/Core/Globals.cs index 12484b0..153ae95 100644 --- a/WeeXnes/Core/Globals.cs +++ b/WeeXnes/Core/Globals.cs @@ -15,9 +15,10 @@ namespace WeeXnes.Core public static string encryptionKey = "8zf5#RdyQ]$4x4_"; public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes"); public static string SettingsFileName = "settings.ini"; - public static string version = "2.6"; + public static string version = "2.7"; public static bool info_isRpcRunning = false; public static bool info_RpcAutoStart; + public static string apiUrl = "http://www.weexnes.com:5169/"; public static UpdateVar settings_alwaysOnTop = new UpdateVar(); @@ -42,7 +43,7 @@ namespace WeeXnes.Core } public static class SettingsManager { - private static INIFile SettingsFile = new INIFile( + public static INIFile SettingsFile = new INIFile( Globals.AppDataPath + "\\" + Globals.SettingsFileName, true ); diff --git a/WeeXnes/MVVM/View/SettingView.xaml b/WeeXnes/MVVM/View/SettingView.xaml index 32a5308..23fdb40 100644 --- a/WeeXnes/MVVM/View/SettingView.xaml +++ b/WeeXnes/MVVM/View/SettingView.xaml @@ -36,22 +36,36 @@ Background="#22202f" CornerRadius="10" Margin="10,40,10,10"> + + + + + + - - - + +