Updated Networking classes

This commit is contained in:
miku-666
2022-12-19 17:36:00 +01:00
parent 554370752d
commit 92fbb752dc
2 changed files with 21 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ namespace PckStudio.Classes.Networking
{
class Network
{
public static string Version = "6.51";
public static string Version = Application.ProductVersion;
public static bool IsBeta = true;
public static bool Portable = false;
public static bool NeedsUpdate = false;
@@ -21,6 +21,8 @@ namespace PckStudio.Classes.Networking
using WebClient wc = new WebClient();
try
{
Update.CheckForUpdate(null); // TODO
Uri versionUri = new Uri(MainURL, IsBeta ? BetaUpdatePath : UpdatePath);
Console.WriteLine(versionUri);
string serverVersion = wc.DownloadString(versionUri);

View File

@@ -7,6 +7,18 @@ using System.Windows.Forms;
namespace PckStudio.Classes.Networking
{
public enum UpdateResult
{
// Base Failure value
Failure = -1,
// Base Success value
Success,
UpdateAvailable,
UpdateFailure,
}
class UpdateOptions
{
public bool IsBeta { get; set; }
@@ -35,6 +47,12 @@ namespace PckStudio.Classes.Networking
static class Update
{
public static UpdateResult CheckForUpdate(UpdateOptions options)
{
// TODO: implement this
return UpdateResult.Failure;
}
public static void UpdateProgram(UpdateOptions options)
{
string updateURL = options.Domain;