Skip to content

Commit

Permalink
Autoupdater Applied
Browse files Browse the repository at this point in the history
  • Loading branch information
JWLMT88 committed Jun 26, 2023
1 parent ed62299 commit c9fa986
Show file tree
Hide file tree
Showing 25 changed files with 211 additions and 93 deletions.
76 changes: 75 additions & 1 deletion srvlocal_gui/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using Guna.UI2.WinForms;
using User = srvlocal_gui.AppMananger.User;
using System.Security.Cryptography;
using ToastNotifications;
using ToastNotifications.Core;

namespace srvlocal_gui
{
Expand Down Expand Up @@ -163,7 +165,7 @@ Settings setting()

try
{

CheckForUpdates();
LicenseEvaluation();

var quote = await Helper.GetQuoteOfTheDayAsync();
Expand Down Expand Up @@ -295,6 +297,78 @@ private void LicenseEvaluation()
}
}

public Task CheckForUpdates()
{
try
{
var updater = Updater.Instance();

var latestVersion = updater.GetLatestVersion(owner, repo);
var latestChanges = updater.GetLatestChanges(owner, repo);
var currentVersion = System.Windows.Forms.Application.ProductVersion;

switch (UpdateDetected)
{
case true:
string html = Markdig.Markdown.ToHtml(latestChanges);
var _read = ReadMeDialog.Instance();
_read.htmlCode = html;
_read.name = "Latest Release";
_read.version = latestVersion;
_read.Show();
_read.BringToFront();
break;
default:

Logger.Instance.Log("Started Updater (mode: MANUALY)", Logger.LogLevel.Info);

Task.Run(() =>
{
this.Invoke((MethodInvoker)delegate
{
if (updater.HasNewRelease(owner, repo))
{
Logger.Instance.Log($"Updater found a new Version. Latest Version: {latestVersion}, Current Version: {currentVersion}.", Logger.LogLevel.Info);
Console.WriteLine("A new release is available.");
NotyFi(false, $"A new release is available. \nYour Version : {currentVersion}\nLatest Version : {latestVersion}", "Updater");
UpdateDetected = true;
bntCheck.Text = "Download";
string html = Markdig.Markdown.ToHtml(latestChanges);
var _read = ReadMeDialog.Instance();
_read.htmlCode = html;
_read.name = "Latest Release";
_read.version = latestVersion;
_read.Show();
}
else
{
Logger.Instance.Log($"Youre Up to date. Current Version: {currentVersion}.", Logger.LogLevel.Info);
Console.WriteLine("No new release available.");
richTxtStatus.Text = "";
NotyFi(false, $"No new release available.\nYou are perfect.", "Updater");
}
});
});
break;
}

return Task.CompletedTask;
}
catch (Exception ex)
{
Logger.Instance.Log(ex.Message, Logger.LogLevel.Error);
return Task.CompletedTask;
}
}

private void label1_Click(object sender, EventArgs e)
{
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion srvlocal_gui/bin/Debug/net7.0-windows/license.labl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<USERID>32956</USERID>
<BACKGROUND>default</BACKGROUND>
<USERRIGHTSTATUS>default</USERRIGHTSTATUS>
<CODE>8IO3mAn2s-1JgA=U</CODE>
<CODE>04Z182vY5-O9UG=I</CODE>
<installagnt>true</installagnt>
<assembly>
<name>LILO App Builder (LAB)</name>
Expand Down
11 changes: 11 additions & 0 deletions srvlocal_gui/bin/Debug/net7.0-windows/log.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
2023-06-26 23:41:16 [INFO] - Started GUI...
2023-06-26 23:41:16 [INFO] - Directory allready satisfied.
2023-06-26 23:41:16 [INFO] - Directory allready satisfied.
2023-06-26 23:41:16 [INFO] - Directory allready satisfied.
2023-06-26 23:41:16 [INFO] - Settings file was not found. Initializing SettingsManager and generating it.
2023-06-26 23:41:16 [INFO] - You are an administrator.
2023-06-26 23:41:25 [WARNING] - Missing resources : config.xml, log.txt,
2023-06-26 23:41:29 [INFO] - Started Updater (mode: MANUALY)
2023-06-26 23:41:29 [INFO] - Starting license evaluation.
2023-06-26 23:41:30 [INFO] - Youre Up to date. Current Version: 1.3.1.
2023-06-26 23:41:31 [ERROR] - Response status code does not indicate success: 429 (Too Many Requests).
Binary file not shown.
52 changes: 0 additions & 52 deletions srvlocal_gui/bin/Debug/net7.0-windows/security_text.xml

This file was deleted.

56 changes: 28 additions & 28 deletions srvlocal_gui/bin/Debug/net7.0-windows/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
"HashedPassword": "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918",
"CanChangeConfig": true,
"FavouriteColor": {
"R": 0,
"G": 0,
"B": 0,
"A": 0,
"IsKnownColor": false,
"IsEmpty": true,
"IsNamedColor": false,
"R": 240,
"G": 248,
"B": 255,
"A": 255,
"IsKnownColor": true,
"IsEmpty": false,
"IsNamedColor": true,
"IsSystemColor": false,
"Name": "0"
"Name": "AliceBlue"
},
"ButtonColor": {
"R": 0,
"G": 0,
"B": 0,
"A": 0,
"R": 94,
"G": 148,
"B": 255,
"A": 255,
"IsKnownColor": false,
"IsEmpty": true,
"IsEmpty": false,
"IsNamedColor": false,
"IsSystemColor": false,
"Name": "0"
"Name": "ff5e94ff"
}
},
{
Expand All @@ -45,26 +45,26 @@
"HashedPassword": "140bedbf9c3f6d56a9846d2ba7088798683f4da0c248231336e6a05679e4fdfe",
"CanChangeConfig": false,
"FavouriteColor": {
"R": 0,
"G": 0,
"B": 0,
"A": 0,
"IsKnownColor": false,
"IsEmpty": true,
"IsNamedColor": false,
"R": 240,
"G": 255,
"B": 255,
"A": 255,
"IsKnownColor": true,
"IsEmpty": false,
"IsNamedColor": true,
"IsSystemColor": false,
"Name": "0"
"Name": "Azure"
},
"ButtonColor": {
"R": 0,
"G": 0,
"B": 0,
"A": 0,
"R": 94,
"G": 148,
"B": 255,
"A": 255,
"IsKnownColor": false,
"IsEmpty": true,
"IsEmpty": false,
"IsNamedColor": false,
"IsSystemColor": false,
"Name": "0"
"Name": "ff5e94ff"
}
}
]
Expand Down
20 changes: 18 additions & 2 deletions srvlocal_gui/bin/Debug/net7.0-windows/srvlocal_gui.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v7.0": {
"srvlocal_gui/1.3": {
"srvlocal_gui/1.3.1": {
"dependencies": {
"AForge.Video": "2.2.5",
"AForge.Video.DirectShow": "2.2.5",
Expand Down Expand Up @@ -37,6 +37,7 @@
"ReactorUI.Skia.WinForms": "0.0.41-beta",
"SaaUI.Winforms": "1.1.0",
"System.Data.SQLite": "1.0.117",
"ToastNotifications": "2.5.1",
"UI.for.WinForms.AllControls.Net70.Trial": "2023.1.314",
"Windows-Forms-Aero": "3.1.1",
"Winform.Metroframework.Design": "1.4.0",
Expand Down Expand Up @@ -2469,6 +2470,14 @@
"System.Xml.ReaderWriter": "4.3.0"
}
},
"ToastNotifications/2.5.1": {
"runtime": {
"lib/net40/ToastNotifications.dll": {
"assemblyVersion": "2.5.1.0",
"fileVersion": "2.5.1.0"
}
}
},
"Topten.RichTextKit/0.4.151": {
"dependencies": {
"SkiaSharp": "2.88.2",
Expand Down Expand Up @@ -2889,7 +2898,7 @@
}
},
"libraries": {
"srvlocal_gui/1.3": {
"srvlocal_gui/1.3.1": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down Expand Up @@ -4455,6 +4464,13 @@
"path": "system.xml.xdocument/4.3.0",
"hashPath": "system.xml.xdocument.4.3.0.nupkg.sha512"
},
"ToastNotifications/2.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-0ZBWG0FCPafwbIzNhjWgC0GEOyk51GF3rYWrh5QJ61ZxDEoLgdDsEUt8HMxYN7lRLVt/mWhtgdbe4OmhXfwtkA==",
"path": "toastnotifications/2.5.1",
"hashPath": "toastnotifications.2.5.1.nupkg.sha512"
},
"Topten.RichTextKit/0.4.151": {
"type": "package",
"serviceable": true,
Expand Down
Binary file modified srvlocal_gui/bin/Debug/net7.0-windows/srvlocal_gui.dll
Binary file not shown.
Binary file modified srvlocal_gui/bin/Debug/net7.0-windows/srvlocal_gui.exe
Binary file not shown.
Binary file modified srvlocal_gui/obj/Debug/net7.0-windows/apphost.exe
Binary file not shown.
Binary file modified srvlocal_gui/obj/Debug/net7.0-windows/ref/srvlocal_gui.dll
Binary file not shown.
Binary file modified srvlocal_gui/obj/Debug/net7.0-windows/refint/srvlocal_gui.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright© 2023 - JW Limited")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("An easy way to Build and Run youre LILO Apps")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.3.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.3")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.3.1.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.3.1")]
[assembly: System.Reflection.AssemblyProductAttribute("Local Server Manager")]
[assembly: System.Reflection.AssemblyTitleAttribute("srvlocal_gui")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.3.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.3.1.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9a7b17d71d86ed736b4bdf95f55e02d469c42a81
5f4abb91926032870f55ca4d928d4151d4843807
Binary file modified srvlocal_gui/obj/Debug/net7.0-windows/srvlocal_gui.assets.cache
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c734045e56d1dc5fdd06b40c6cd7c3ed04f2abc2
f0799d27992e61952fd28afbc7ec608f0d5975d6
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,4 @@ C:\Users\joeva\Documents\GitHub\LILO-LocalServer\srvlocal_gui\bin\Debug\net7.0-w
C:\Users\joeva\Documents\GitHub\LILO-LocalServer\srvlocal_gui\bin\Debug\net7.0-windows\NAudio.WinMM.dll
C:\Users\joeva\Documents\GitHub\LILO-LocalServer\srvlocal_gui\obj\Debug\net7.0-windows\srvlocal_gui.AppMananger.ChangePassword.resources
C:\Users\joeva\Documents\GitHub\LILO-LocalServer\srvlocal_gui\obj\Debug\net7.0-windows\srvlocal_gui.AppMananger.ChangeColor.resources
C:\Users\joeva\Documents\GitHub\LILO-LocalServer\srvlocal_gui\bin\Debug\net7.0-windows\ToastNotifications.dll
Original file line number Diff line number Diff line change
Expand Up @@ -3116,6 +3116,14 @@
}
}
},
"ToastNotifications/2.5.1": {
"runtime": {
"lib/net40/ToastNotifications.dll": {
"assemblyVersion": "2.5.1.0",
"fileVersion": "2.5.1.0"
}
}
},
"Topten.RichTextKit/0.4.151": {
"dependencies": {
"SkiaSharp": "2.88.2",
Expand Down Expand Up @@ -5049,6 +5057,13 @@
"path": "system.xml.xdocument/4.3.0",
"hashPath": "system.xml.xdocument.4.3.0.nupkg.sha512"
},
"ToastNotifications/2.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-0ZBWG0FCPafwbIzNhjWgC0GEOyk51GF3rYWrh5QJ61ZxDEoLgdDsEUt8HMxYN7lRLVt/mWhtgdbe4OmhXfwtkA==",
"path": "toastnotifications/2.5.1",
"hashPath": "toastnotifications.2.5.1.nupkg.sha512"
},
"Topten.RichTextKit/0.4.151": {
"type": "package",
"serviceable": true,
Expand Down
Binary file modified srvlocal_gui/obj/Debug/net7.0-windows/srvlocal_gui.dll
Binary file not shown.
Loading

0 comments on commit c9fa986

Please sign in to comment.