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">
+
+
+
+
+
+
-
-
-
+
+
+
+
+
(downloadString);
+ if (GitHub.tag_name != Globals.version)
+ {
+ Misc.UpdateMessage updateMessage = new UpdateMessage(
+ GitHub,
+ "Update Found");
+ updateMessage.Show();
+ }
+ else
+ {
+ Misc.Message msg = new Misc.Message("No Updates found");
+ msg.Show();
+ }
+ }
+ catch (Exception ex)
+ {
+ Misc.Message error = new Misc.Message(ex.ToString());
+ error.Show();
+ }
+
+
+ }
}
}
diff --git a/WeeXnes/Misc/Message.xaml.cs b/WeeXnes/Misc/Message.xaml.cs
index 21862d5..ba2f7df 100644
--- a/WeeXnes/Misc/Message.xaml.cs
+++ b/WeeXnes/Misc/Message.xaml.cs
@@ -19,10 +19,11 @@ namespace WeeXnes.Misc
///
public partial class Message : Window
{
- public Message(string _message)
+ public Message(string _message, string _title = "Message")
{
InitializeComponent();
MessageLabel.Content = _message;
+ this.Title = _title;
}
private void okButton_Click(object sender, RoutedEventArgs e)
diff --git a/WeeXnes/Misc/UpdateMessage.xaml b/WeeXnes/Misc/UpdateMessage.xaml
new file mode 100644
index 0000000..2ea9c04
--- /dev/null
+++ b/WeeXnes/Misc/UpdateMessage.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WeeXnes/Misc/UpdateMessage.xaml.cs b/WeeXnes/Misc/UpdateMessage.xaml.cs
new file mode 100644
index 0000000..d77ed8c
--- /dev/null
+++ b/WeeXnes/Misc/UpdateMessage.xaml.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Net;
+using System.Windows;
+using WeeXnes.Core;
+using Application = System.Windows.Forms.Application;
+
+namespace WeeXnes.Misc
+{
+ public partial class UpdateMessage : Window
+ {
+ public static ApiResponse GitHub;
+ public UpdateMessage(ApiResponse _GitHub, string _title = "Message")
+ {
+ InitializeComponent();
+ string content = "Your Version: " + Globals.version + "\n" +
+ "Current Version: " + _GitHub.tag_name;
+ MessageLabel.Content = content;
+ this.Title = _title;
+ GitHub = _GitHub;
+ }
+
+ public static void downloadAssets()
+ {
+ checkForFile();
+ WebClient client = new WebClient();
+ client.DownloadFile(GitHub.download_url, GitHub.file_name);
+ }
+ private static void checkForFile()
+ {
+ if (File.Exists(GitHub.file_name))
+ {
+ File.Delete(GitHub.file_name);
+ }
+ }
+ private void OkButton_OnClick(object sender, RoutedEventArgs e)
+ {
+ downloadAssets();
+ try
+ {
+ string path = Application.StartupPath;
+ string fileName = Path.GetFileName(Application.ExecutablePath);
+ string pid = Process.GetCurrentProcess().Id.ToString();
+ Process updateProc = Process.Start("Update.exe", "\"" + path + "\"" + " " + "\"" + fileName + "\"" + " " + "\"" + pid + "\"" + " " + "\"" + GitHub.file_name + "\"");
+ }
+ catch (Exception ex)
+ {
+ Misc.Message message = new Misc.Message(ex.ToString());
+ message.Show();
+
+ }
+ this.Close();
+ }
+
+ private void CancelButton_OnClick(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/WeeXnes/WeeXnes.csproj b/WeeXnes/WeeXnes.csproj
index ca4c82e..1131c4b 100644
--- a/WeeXnes/WeeXnes.csproj
+++ b/WeeXnes/WeeXnes.csproj
@@ -59,6 +59,10 @@
MSBuild:Compile
Designer
+
+
+ UpdateMessage.xaml
+
MSBuild:Compile
@@ -78,6 +82,7 @@
Code
+