Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 68a83b052a | |||
| d689eee7fa |
Binary file not shown.
@@ -8,7 +8,7 @@
|
|||||||
<StartupObject />
|
<StartupObject />
|
||||||
<SignAssembly>False</SignAssembly>
|
<SignAssembly>False</SignAssembly>
|
||||||
<IsPublishable>True</IsPublishable>
|
<IsPublishable>True</IsPublishable>
|
||||||
<AssemblyVersion>1.0.0.3</AssemblyVersion>
|
<AssemblyVersion>1.0.0.10</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -30,18 +31,18 @@ public class Program
|
|||||||
[Obsolete]
|
[Obsolete]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Loading resources ...");
|
||||||
|
|
||||||
Directory.CreateDirectory("./Data/Resources");
|
Directory.CreateDirectory("./Data/Resources");
|
||||||
Directory.CreateDirectory("./Data/Plugins/Commands");
|
Directory.CreateDirectory("./Data/Plugins/Commands");
|
||||||
Directory.CreateDirectory("./Data/Plugins/Events");
|
Directory.CreateDirectory("./Data/Plugins/Events");
|
||||||
PreLoadComponents().Wait();
|
PreLoadComponents().Wait();
|
||||||
|
do
|
||||||
|
|
||||||
if (!Config.ContainsKey("ServerID"))
|
|
||||||
{
|
{
|
||||||
do
|
if (!Config.ContainsKey("ServerID"))
|
||||||
{
|
{
|
||||||
Console.Clear();
|
|
||||||
|
|
||||||
Console.WriteLine("Please enter the server ID: ");
|
Console.WriteLine("Please enter the server ID: ");
|
||||||
Console_Utilities.WriteColorText("You can find it in the Server Settings at &r\"Widget\"&c section");
|
Console_Utilities.WriteColorText("You can find it in the Server Settings at &r\"Widget\"&c section");
|
||||||
Console.WriteLine("Example: 1234567890123456789");
|
Console.WriteLine("Example: 1234567890123456789");
|
||||||
@@ -56,49 +57,48 @@ public class Program
|
|||||||
string SID = key.KeyChar + Console.ReadLine();
|
string SID = key.KeyChar + Console.ReadLine();
|
||||||
if (SID.Length != 18)
|
if (SID.Length != 18)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Your server ID is not 18 characters long. Please try again.");
|
Console.Clear();
|
||||||
|
Console_Utilities.WriteColorText("&rYour server ID is not 18 characters long. Please try again. \n");
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Config.AddValueToVariables("ServerID", SID, false);
|
Config.AddValueToVariables("ServerID", SID, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
} while (true);
|
|
||||||
|
|
||||||
}
|
if (!Config.ContainsKey("token") || Config.GetValue<string>("token") == null || (Config.GetValue<string>("token")?.Length != 70 && Config.GetValue<string>("token")?.Length != 59))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Please insert your token");
|
||||||
|
Console.Write("Token = ");
|
||||||
|
var token = Console.ReadLine();
|
||||||
|
if (token?.Length == 59 || token?.Length == 70)
|
||||||
|
Config.AddValueToVariables("token", token, true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.Clear();
|
||||||
|
Console_Utilities.WriteColorText("&rThe token length is invalid !");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!Config.ContainsKey("token") || Config.GetValue<string>("token") == null || Config.GetValue<string>("token")?.Length != 70)
|
if (!Config.ContainsKey("prefix") || Config.GetValue<string>("prefix") == null || Config.GetValue<string>("prefix")?.Length != 1)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Please insert your token");
|
Console.WriteLine("Please insert your prefix (max. 1 character long):");
|
||||||
Console.Write("Token = ");
|
Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces, numbers, '/' or '\\' allowed");
|
||||||
var token = Console.ReadLine();
|
Console.Write("Prefix = ");
|
||||||
if (token?.Length == 59 || token?.Length == 70)
|
var prefix = Console.ReadLine()![0];
|
||||||
Config.AddValueToVariables("token", token, true);
|
|
||||||
else
|
|
||||||
Console.WriteLine("Invalid token");
|
|
||||||
|
|
||||||
Console.WriteLine("Please insert your prefix (max. 1 character long):");
|
if (prefix == ' ' || char.IsDigit(prefix) || prefix == '/' || prefix == '\\')
|
||||||
Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed");
|
{
|
||||||
Console.Write("Prefix = ");
|
Console.Clear();
|
||||||
var prefix = Console.ReadLine()![0];
|
Console_Utilities.WriteColorText("&rThe prefix is invalid");
|
||||||
|
continue;
|
||||||
if (prefix == ' ' || char.IsDigit(prefix))
|
}
|
||||||
return;
|
Config.AddValueToVariables("prefix", prefix.ToString(), false);
|
||||||
Config.AddValueToVariables("prefix", prefix.ToString(), false);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!Config.ContainsKey("prefix") || Config.GetValue<string>("prefix") == default)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Please insert your prefix (max. 1 character long):");
|
|
||||||
Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed");
|
|
||||||
Console.Write("Prefix = ");
|
|
||||||
var prefix = Console.ReadLine()![0];
|
|
||||||
if (prefix == ' ') return;
|
|
||||||
Config.AddValueToVariables("prefix", prefix.ToString(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
} while (true);
|
||||||
|
|
||||||
HandleInput(args).Wait();
|
HandleInput(args).Wait();
|
||||||
}
|
}
|
||||||
@@ -346,6 +346,8 @@ public class Program
|
|||||||
|
|
||||||
private static async Task PreLoadComponents()
|
private static async Task PreLoadComponents()
|
||||||
{
|
{
|
||||||
|
Console_Utilities.ProgressBar main = new Console_Utilities.ProgressBar(ProgressBarType.NO_END);
|
||||||
|
main.Start();
|
||||||
await Config.LoadConfig();
|
await Config.LoadConfig();
|
||||||
if (Config.ContainsKey("DeleteLogsAtStartup"))
|
if (Config.ContainsKey("DeleteLogsAtStartup"))
|
||||||
if (Config.GetValue<bool>("DeleteLogsAtStartup"))
|
if (Config.GetValue<bool>("DeleteLogsAtStartup"))
|
||||||
@@ -375,7 +377,11 @@ public class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<string> onlineSettingsList = await ServerCom.ReadTextFromURL("https://raw.githubusercontent.com/Wizzy69/installer/discord-bot-files/OnlineData");
|
List<string> onlineSettingsList = await ServerCom.ReadTextFromURL("https://raw.githubusercontent.com/Wizzy69/installer/discord-bot-files/OnlineData");
|
||||||
|
main.Stop();
|
||||||
foreach (var key in onlineSettingsList)
|
foreach (var key in onlineSettingsList)
|
||||||
{
|
{
|
||||||
if (key.Length <= 3 || !key.Contains(' ')) continue;
|
if (key.Length <= 3 || !key.Contains(' ')) continue;
|
||||||
@@ -387,42 +393,45 @@ public class Program
|
|||||||
string newVersion = s[1];
|
string newVersion = s[1];
|
||||||
if (!newVersion.Equals(Config.GetValue<string>("Version")))
|
if (!newVersion.Equals(Config.GetValue<string>("Version")))
|
||||||
{
|
{
|
||||||
Console.WriteLine("A new version has been released on github page.");
|
if (Functions.GetOperatingSystem() == PluginManager.Others.OperatingSystem.WINDOWS)
|
||||||
Console.WriteLine("Download the new version using the following link wrote in yellow");
|
|
||||||
Console_Utilities.WriteColorText("&y" + Config.GetValue<string>("GitURL") + "&c");
|
|
||||||
|
|
||||||
Console.WriteLine();
|
|
||||||
Console.WriteLine("Your product will work just fine on this outdated version, but an update is recommended.\n" +
|
|
||||||
"From now on, this version is no longer supported"
|
|
||||||
);
|
|
||||||
Console_Utilities.WriteColorText("&rUse at your own risk&c");
|
|
||||||
|
|
||||||
Console_Utilities.WriteColorText("&mCurrent Version: " + Config.GetValue<string>("Version") + "&c");
|
|
||||||
Console_Utilities.WriteColorText("&gNew Version: " + newVersion + "&c");
|
|
||||||
|
|
||||||
Console.WriteLine("\n\n");
|
|
||||||
await Task.Delay(1000);
|
|
||||||
|
|
||||||
int waitTime = 10; //wait time to proceed
|
|
||||||
|
|
||||||
Console.Write($"The bot will start in {waitTime} seconds");
|
|
||||||
while (waitTime > 0)
|
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
|
||||||
waitTime--;
|
string url = $"https://github.com/Wizzy69/SethDiscordBot/releases/download/v{newVersion}/net6.0.zip";
|
||||||
Console.SetCursorPosition("The bot will start in ".Length, Console.CursorTop);
|
//string url2 = $"https://github.com/Wizzy69/SethDiscordBot/releases/download/v{newVersion}-preview/net6.0.zip";
|
||||||
Console.Write(" ");
|
Process.Start("./Updater/Updater.exe", $"/update {url} ./DiscordBot.exe ./");
|
||||||
Console.SetCursorPosition("The bot will start in ".Length, Console.CursorTop);
|
|
||||||
Console.Write(waitTime + " seconds");
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string url = $"https://github.com/Wizzy69/SethDiscordBot/releases/download/v{newVersion}/net6.0_linux.zip";
|
||||||
|
Process.Start("./Updater/Updater", $"/update {url} ./DiscordBot ./");
|
||||||
|
}
|
||||||
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "UpdaterVersion":
|
||||||
|
string updaternewversion = s[1];
|
||||||
|
if (Config.UpdaterVersion != updaternewversion)
|
||||||
|
{
|
||||||
|
Console.Clear();
|
||||||
|
Console.WriteLine("Installing updater ...\nDo NOT close the bot during update !");
|
||||||
|
Console_Utilities.ProgressBar bar = new Console_Utilities.ProgressBar(ProgressBarType.NO_END);
|
||||||
|
bar.Start();
|
||||||
|
await ServerCom.DownloadFileNoProgressAsync("https://github.com/Wizzy69/installer/releases/download/release-1-discordbot/Updater.zip", "./Updater.zip");
|
||||||
|
await Functions.ExtractArchive("./Updater.zip", "./", null, UnzipProgressType.PercentageFromTotalSize);
|
||||||
|
Config.UpdaterVersion = updaternewversion;
|
||||||
|
File.Delete("Updater.zip");
|
||||||
|
await Config.SaveConfig(SaveType.NORMAL);
|
||||||
|
bar.Stop();
|
||||||
|
Console.Clear();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console_Utilities.Initialize();
|
|
||||||
|
|
||||||
Config.SaveConfig(SaveType.NORMAL);
|
Console_Utilities.Initialize();
|
||||||
|
await Config.SaveConfig(SaveType.NORMAL);
|
||||||
|
Console.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace PluginManager
|
|||||||
{
|
{
|
||||||
internal class AppConfig
|
internal class AppConfig
|
||||||
{
|
{
|
||||||
|
public string UpdaterVersion { get; set; }
|
||||||
public Dictionary<string, object>? ApplicationVariables { get; init; }
|
public Dictionary<string, object>? ApplicationVariables { get; init; }
|
||||||
public List<string>? ProtectedKeyWords { get; init; }
|
public List<string>? ProtectedKeyWords { get; init; }
|
||||||
public Dictionary<string, string>? PluginVersions { get; init; }
|
public Dictionary<string, string>? PluginVersions { get; init; }
|
||||||
@@ -77,6 +78,8 @@ namespace PluginManager
|
|||||||
|
|
||||||
private static AppConfig? appConfig { get; set; }
|
private static AppConfig? appConfig { get; set; }
|
||||||
|
|
||||||
|
public static string UpdaterVersion { get => appConfig.UpdaterVersion; set => appConfig.UpdaterVersion = value; }
|
||||||
|
|
||||||
public static string GetPluginVersion(string pluginName) => appConfig!.PluginVersions![pluginName];
|
public static string GetPluginVersion(string pluginName) => appConfig!.PluginVersions![pluginName];
|
||||||
public static void SetPluginVersion(string pluginName, string newVersion)
|
public static void SetPluginVersion(string pluginName, string newVersion)
|
||||||
{
|
{
|
||||||
@@ -220,7 +223,7 @@ namespace PluginManager
|
|||||||
Functions.WriteLogFile($"Loaded {appConfig.ApplicationVariables!.Keys.Count} application variables.\nLoaded {appConfig.ProtectedKeyWords!.Count} readonly variables.");
|
Functions.WriteLogFile($"Loaded {appConfig.ApplicationVariables!.Keys.Count} application variables.\nLoaded {appConfig.ProtectedKeyWords!.Count} readonly variables.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appConfig = new() { ApplicationVariables = new Dictionary<string, object>(), ProtectedKeyWords = new List<string>(), PluginVersions = new Dictionary<string, string>() };
|
appConfig = new() { ApplicationVariables = new Dictionary<string, object>(), ProtectedKeyWords = new List<string>(), PluginVersions = new Dictionary<string, string>(), UpdaterVersion = "-1" };
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ContainsValue<T>(T value) => appConfig!.ApplicationVariables!.ContainsValue(value!);
|
public static bool ContainsValue<T>(T value) => appConfig!.ApplicationVariables!.ContainsValue(value!);
|
||||||
|
|||||||
@@ -193,29 +193,11 @@ public class ConsoleCommandsHandler
|
|||||||
|
|
||||||
if (split[0].EndsWith(".zip") || split[0].EndsWith(".pak") || split[0].EndsWith(".pkg"))
|
if (split[0].EndsWith(".zip") || split[0].EndsWith(".pak") || split[0].EndsWith(".pkg"))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Extracting {split[1]}");
|
Console.WriteLine($"Extracting {split[1]} ...");
|
||||||
var proc = 0f;
|
var bar = new Console_Utilities.ProgressBar(ProgressBarType.NO_END) { Max = 100f, Color = ConsoleColor.Green };
|
||||||
var isExtracting = true;
|
bar.Start();
|
||||||
var bar = new Console_Utilities.ProgressBar(ProgressBarType.NORMAL) { Max = 100f, Color = ConsoleColor.Green };
|
await Functions.ExtractArchive("./" + split[1], "./", null, UnzipProgressType.PercentageFromTotalSize);
|
||||||
|
bar.Stop();
|
||||||
IProgress<float> extractProgress = new Progress<float>(value => { proc = value; });
|
|
||||||
new Thread(new Task(() =>
|
|
||||||
{
|
|
||||||
while (isExtracting)
|
|
||||||
{
|
|
||||||
bar.Update(proc);
|
|
||||||
if (proc >= 99.9f)
|
|
||||||
isExtracting = false;
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).Start
|
|
||||||
).Start();
|
|
||||||
await Functions.ExtractArchive("./" + split[1], "./", extractProgress, UnzipProgressType.PercentageFromTotalSize);
|
|
||||||
bar.Update(100f);
|
|
||||||
isExtracting = false;
|
|
||||||
await Task.Delay(1000);
|
|
||||||
bar.Update(100);
|
|
||||||
Console.WriteLine("\n");
|
Console.WriteLine("\n");
|
||||||
File.Delete("./" + split[1]);
|
File.Delete("./" + split[1]);
|
||||||
}
|
}
|
||||||
@@ -277,21 +259,13 @@ public class ConsoleCommandsHandler
|
|||||||
{
|
{
|
||||||
if (client is null)
|
if (client is null)
|
||||||
return;
|
return;
|
||||||
bool run = true;
|
Console_Utilities.ProgressBar bar = new Console_Utilities.ProgressBar(ProgressBarType.NO_END);
|
||||||
var t = new Thread(() =>
|
|
||||||
{
|
bar.Start();
|
||||||
Console_Utilities.ProgressBar bar = new Console_Utilities.ProgressBar(ProgressBarType.NO_END);
|
|
||||||
while (run)
|
|
||||||
{
|
|
||||||
bar.Update(1);
|
|
||||||
Thread.Sleep(50);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
t.Start();
|
|
||||||
await Config.SaveConfig(SaveType.NORMAL);
|
await Config.SaveConfig(SaveType.NORMAL);
|
||||||
await Config.SaveConfig(SaveType.BACKUP);
|
await Config.SaveConfig(SaveType.BACKUP);
|
||||||
await Task.Delay(4000);
|
await Task.Delay(4000);
|
||||||
run = false;
|
bar.Stop();
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
await client.StopAsync();
|
await client.StopAsync();
|
||||||
await client.DisposeAsync();
|
await client.DisposeAsync();
|
||||||
|
|||||||
@@ -79,5 +79,11 @@ namespace PluginManager.Online
|
|||||||
pbar.Update(100f);
|
pbar.Update(100f);
|
||||||
isDownloading = false;
|
isDownloading = false;
|
||||||
}
|
}
|
||||||
|
public static async Task DownloadFileNoProgressAsync(string URL, string location)
|
||||||
|
{
|
||||||
|
IProgress<float> progress = new Progress<float>();
|
||||||
|
await DownloadFileAsync(URL, location, progress);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,32 @@ namespace PluginManager.Others
|
|||||||
private int position = 1;
|
private int position = 1;
|
||||||
private bool positive = true;
|
private bool positive = true;
|
||||||
|
|
||||||
|
private bool isRunning;
|
||||||
|
|
||||||
|
public async void Start()
|
||||||
|
{
|
||||||
|
if (type != ProgressBarType.NO_END)
|
||||||
|
throw new Exception("Only NO_END progress bar can use this method");
|
||||||
|
if (isRunning)
|
||||||
|
throw new Exception("This progress bar is already running");
|
||||||
|
|
||||||
|
isRunning = true;
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
UpdateNoEnd();
|
||||||
|
await System.Threading.Tasks.Task.Delay(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (type != ProgressBarType.NO_END)
|
||||||
|
throw new Exception("Only NO_END progress bar can use this method");
|
||||||
|
if (!isRunning)
|
||||||
|
throw new Exception("Can not stop a progressbar that did not start");
|
||||||
|
isRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(float progress)
|
public void Update(float progress)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|||||||
@@ -168,9 +168,7 @@ namespace PluginManager.Others
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static async Task ExtractArchive(string zip, string folder, IProgress<float> progress, UnzipProgressType type)
|
public static async Task ExtractArchive(string zip, string folder, IProgress<float> progress, UnzipProgressType type)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
|
Directory.CreateDirectory(folder);
|
||||||
|
|
||||||
|
|
||||||
using (ZipArchive archive = ZipFile.OpenRead(zip))
|
using (ZipArchive archive = ZipFile.OpenRead(zip))
|
||||||
{
|
{
|
||||||
if (type == UnzipProgressType.PercentageFromNumberOfFiles)
|
if (type == UnzipProgressType.PercentageFromNumberOfFiles)
|
||||||
@@ -194,7 +192,8 @@ namespace PluginManager.Others
|
|||||||
|
|
||||||
currentZIPFile++;
|
currentZIPFile++;
|
||||||
await Task.Delay(10);
|
await Task.Delay(10);
|
||||||
progress.Report((float)currentZIPFile / totalZIPFiles * 100);
|
if (progress != null)
|
||||||
|
progress.Report((float)currentZIPFile / totalZIPFiles * 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == UnzipProgressType.PercentageFromTotalSize)
|
else if (type == UnzipProgressType.PercentageFromTotalSize)
|
||||||
@@ -224,7 +223,8 @@ namespace PluginManager.Others
|
|||||||
}
|
}
|
||||||
|
|
||||||
await Task.Delay(10);
|
await Task.Delay(10);
|
||||||
progress.Report((float)currentSize / zipSize * 100);
|
if (progress != null)
|
||||||
|
progress.Report((float)currentSize / zipSize * 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ Plugin Types:
|
|||||||
1. Commands
|
1. Commands
|
||||||
2. Events
|
2. Events
|
||||||
|
|
||||||
<!--
|
|
||||||
Project Structure
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
### How to create a plugin
|
### How to create a plugin
|
||||||
|
|
||||||
First of all, Create a new project (class library) in Visual Studio.
|
First of all, Create a new project (class library) in Visual Studio.
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_LevelingSystem", "CMD_L
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "Roles\Roles.csproj", "{954F2AA9-6624-4554-946D-0F17B84487C3}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "Roles\Roles.csproj", "{954F2AA9-6624-4554-946D-0F17B84487C3}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Others", "Others", "{727BBA0B-9114-4BC8-B9A8-3F461449A564}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -57,6 +61,10 @@ Global
|
|||||||
{954F2AA9-6624-4554-946D-0F17B84487C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{954F2AA9-6624-4554-946D-0F17B84487C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{954F2AA9-6624-4554-946D-0F17B84487C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{954F2AA9-6624-4554-946D-0F17B84487C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{954F2AA9-6624-4554-946D-0F17B84487C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
{954F2AA9-6624-4554-946D-0F17B84487C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -69,6 +77,8 @@ Global
|
|||||||
{EEC445DC-0C4B-43EA-8694-606BA0390B77} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
|
{EEC445DC-0C4B-43EA-8694-606BA0390B77} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
|
||||||
{1A4E49FF-9A0A-4C54-AF35-CFFBA64353D9} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
{1A4E49FF-9A0A-4C54-AF35-CFFBA64353D9} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
||||||
{954F2AA9-6624-4554-946D-0F17B84487C3} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
{954F2AA9-6624-4554-946D-0F17B84487C3} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
||||||
|
{727BBA0B-9114-4BC8-B9A8-3F461449A564} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E}
|
||||||
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525} = {727BBA0B-9114-4BC8-B9A8-3F461449A564}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF}
|
SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF}
|
||||||
|
|||||||
454
Updater/.gitignore
vendored
Normal file
454
Updater/.gitignore
vendored
Normal file
@@ -0,0 +1,454 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# Tye
|
||||||
|
.tye/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
##
|
||||||
|
## Visual studio for Mac
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
# globs
|
||||||
|
Makefile.in
|
||||||
|
*.userprefs
|
||||||
|
*.usertasks
|
||||||
|
config.make
|
||||||
|
config.status
|
||||||
|
aclocal.m4
|
||||||
|
install-sh
|
||||||
|
autom4te.cache/
|
||||||
|
*.tar.gz
|
||||||
|
tarballs/
|
||||||
|
test-results/
|
||||||
|
|
||||||
|
# Mac bundle stuff
|
||||||
|
*.dmg
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
##
|
||||||
|
## Visual Studio Code
|
||||||
|
##
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
7
Updater/App.axaml
Normal file
7
Updater/App.axaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<Application xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="Updater.App">
|
||||||
|
<Application.Styles>
|
||||||
|
<FluentTheme Mode="Dark"/>
|
||||||
|
</Application.Styles>
|
||||||
|
</Application>
|
||||||
24
Updater/App.axaml.cs
Normal file
24
Updater/App.axaml.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace Updater
|
||||||
|
{
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
{
|
||||||
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
|
{
|
||||||
|
desktop.MainWindow = new MainWindow() { Width = 250, Height = 50 };
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnFrameworkInitializationCompleted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Updater/MainWindow.axaml
Normal file
12
Updater/MainWindow.axaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="250" d:DesignHeight="50"
|
||||||
|
x:Class="Updater.MainWindow"
|
||||||
|
Title="Updater">
|
||||||
|
<StackPanel Margin="0">
|
||||||
|
<Label Content="Updating ... "/>
|
||||||
|
<ProgressBar x:Class="Updater.MainWindow" x:Name="progressBar1" IsIndeterminate="True" />
|
||||||
|
</StackPanel>
|
||||||
|
</Window>
|
||||||
36
Updater/MainWindow.axaml.cs
Normal file
36
Updater/MainWindow.axaml.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Updater
|
||||||
|
{
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
Activated += (sender, e) => FormActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void FormActive()
|
||||||
|
{
|
||||||
|
if (Program.Command != "/update")
|
||||||
|
return;
|
||||||
|
await Task.Delay(3000);
|
||||||
|
WebClient c = new WebClient();
|
||||||
|
Directory.CreateDirectory("./Updater/Downloads");
|
||||||
|
await c.DownloadFileTaskAsync(Program.Link, "./Updater/Downloads/Update.zip");
|
||||||
|
await Task.Run(() => ZipFile.ExtractToDirectory("./Updater/Downloads/Update.zip", Program.Location, true));
|
||||||
|
Process.Start(Program.AppToOpen);
|
||||||
|
File.Delete("./Updater/Downloads/Update.zip");
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Updater/Program.cs
Normal file
34
Updater/Program.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Updater
|
||||||
|
{
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
|
||||||
|
public static string Command, Link, AppToOpen, Location;
|
||||||
|
|
||||||
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
|
// yet and stuff might break.
|
||||||
|
[STAThread]
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Command = args[0];
|
||||||
|
Link = args[1];
|
||||||
|
AppToOpen = args[2];
|
||||||
|
Location = string.Join(' ', args, 3, args.Length - 3);
|
||||||
|
BuildAvaloniaApp()
|
||||||
|
.StartWithClassicDesktopLifetime(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
|
=> AppBuilder.Configure<App>()
|
||||||
|
.UsePlatformDetect()
|
||||||
|
.LogToTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Updater/Updater.csproj
Normal file
27
Updater/Updater.csproj
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<!--Avalonia doesen't support TrimMode=link currently,but we are working on that https://github.com/AvaloniaUI/Avalonia/issues/6892 -->
|
||||||
|
<TrimMode>copyused</TrimMode>
|
||||||
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove=".gitignore" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<!--This helps with theme dll-s trimming.
|
||||||
|
If you will publish your application in self-contained mode with p:PublishTrimmed=true and it will use Fluent theme Default theme will be trimmed from the output and vice versa.
|
||||||
|
https://github.com/AvaloniaUI/Avalonia/issues/5593 -->
|
||||||
|
<TrimmableAssembly Include="Avalonia.Themes.Fluent" />
|
||||||
|
<TrimmableAssembly Include="Avalonia.Themes.Default" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||||
|
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
|
||||||
|
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||||
|
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
|
||||||
|
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user