mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-09-01 19:51:28 +02:00
Improved Updater to fully support Patreon/Free channels in parallel
This commit is contained in:
48
Code/Forms/UpdaterForm.Designer.cs
generated
48
Code/Forms/UpdaterForm.Designer.cs
generated
@@ -31,13 +31,14 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdaterForm));
|
||||
this.titleLabel = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.updateBtn = new System.Windows.Forms.Button();
|
||||
this.updatePatreonBtn = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.installedLabel = new System.Windows.Forms.Label();
|
||||
this.latestLabel = new System.Windows.Forms.Label();
|
||||
this.statusLabel = new System.Windows.Forms.Label();
|
||||
this.downloadingLabel = new System.Windows.Forms.Label();
|
||||
this.updateFreeBtn = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// titleLabel
|
||||
@@ -64,20 +65,19 @@
|
||||
this.label13.TabIndex = 35;
|
||||
this.label13.Text = "Installed Version:";
|
||||
//
|
||||
// updateBtn
|
||||
// updatePatreonBtn
|
||||
//
|
||||
this.updateBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.updateBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||
this.updateBtn.Enabled = false;
|
||||
this.updateBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.updateBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.updateBtn.Location = new System.Drawing.Point(12, 229);
|
||||
this.updateBtn.Name = "updateBtn";
|
||||
this.updateBtn.Size = new System.Drawing.Size(203, 40);
|
||||
this.updateBtn.TabIndex = 36;
|
||||
this.updateBtn.Text = "Update!";
|
||||
this.updateBtn.UseVisualStyleBackColor = true;
|
||||
this.updateBtn.Click += new System.EventHandler(this.updateBtn_Click);
|
||||
this.updatePatreonBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.updatePatreonBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||
this.updatePatreonBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.updatePatreonBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.updatePatreonBtn.Location = new System.Drawing.Point(12, 229);
|
||||
this.updatePatreonBtn.Name = "updatePatreonBtn";
|
||||
this.updatePatreonBtn.Size = new System.Drawing.Size(203, 40);
|
||||
this.updatePatreonBtn.TabIndex = 36;
|
||||
this.updatePatreonBtn.Text = "Download Patreon Version";
|
||||
this.updatePatreonBtn.UseVisualStyleBackColor = true;
|
||||
this.updatePatreonBtn.Click += new System.EventHandler(this.updatePatreonBtn_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
@@ -150,19 +150,34 @@
|
||||
this.downloadingLabel.Size = new System.Drawing.Size(0, 16);
|
||||
this.downloadingLabel.TabIndex = 42;
|
||||
//
|
||||
// updateFreeBtn
|
||||
//
|
||||
this.updateFreeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.updateFreeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||
this.updateFreeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.updateFreeBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.updateFreeBtn.Location = new System.Drawing.Point(221, 229);
|
||||
this.updateFreeBtn.Name = "updateFreeBtn";
|
||||
this.updateFreeBtn.Size = new System.Drawing.Size(203, 40);
|
||||
this.updateFreeBtn.TabIndex = 43;
|
||||
this.updateFreeBtn.Text = "Download Free Version";
|
||||
this.updateFreeBtn.UseVisualStyleBackColor = true;
|
||||
this.updateFreeBtn.Click += new System.EventHandler(this.updateFreeBtn_Click);
|
||||
//
|
||||
// UpdaterForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
|
||||
this.ClientSize = new System.Drawing.Size(624, 281);
|
||||
this.Controls.Add(this.updateFreeBtn);
|
||||
this.Controls.Add(this.downloadingLabel);
|
||||
this.Controls.Add(this.statusLabel);
|
||||
this.Controls.Add(this.latestLabel);
|
||||
this.Controls.Add(this.installedLabel);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.updateBtn);
|
||||
this.Controls.Add(this.updatePatreonBtn);
|
||||
this.Controls.Add(this.label13);
|
||||
this.Controls.Add(this.titleLabel);
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
@@ -181,12 +196,13 @@
|
||||
|
||||
private System.Windows.Forms.Label titleLabel;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.Button updateBtn;
|
||||
private System.Windows.Forms.Button updatePatreonBtn;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label installedLabel;
|
||||
private System.Windows.Forms.Label latestLabel;
|
||||
private System.Windows.Forms.Label statusLabel;
|
||||
private System.Windows.Forms.Label downloadingLabel;
|
||||
private System.Windows.Forms.Button updateFreeBtn;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,8 @@ namespace Flowframes.Forms
|
||||
public partial class UpdaterForm : Form
|
||||
{
|
||||
SemVer installed;
|
||||
SemVer latest;
|
||||
SemVer latestPat;
|
||||
SemVer latestFree;
|
||||
|
||||
public UpdaterForm()
|
||||
{
|
||||
@@ -21,32 +22,38 @@ namespace Flowframes.Forms
|
||||
private async void UpdaterForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
installed = Updater.GetInstalledVer();
|
||||
latest = Updater.GetLatestVer();
|
||||
latestPat = Updater.GetLatestVer(true);
|
||||
latestFree = Updater.GetLatestVer(false);
|
||||
|
||||
installedLabel.Text = "v" + installed;
|
||||
installedLabel.Text = installed.ToString();
|
||||
await Task.Delay(100);
|
||||
latestLabel.Text = "v" + latest;
|
||||
latestLabel.Text = $"{latestPat} (Patreon/Beta) - {latestFree} (Free/Stable)";
|
||||
|
||||
if (installedLabel.Text == latestLabel.Text)
|
||||
if (Updater.VersionMatches(installed, latestFree))
|
||||
{
|
||||
updateBtn.Text = "Redownload Latest Version";
|
||||
statusLabel.Text = "Latest Version Is Installed.";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Updater.IsVersionNewer(installed, latest))
|
||||
{
|
||||
updateBtn.Text = "Update To Latest Version!";
|
||||
statusLabel.Text = "Update Available!";
|
||||
}
|
||||
else
|
||||
{
|
||||
updateBtn.Text = "Rollback To Public Version";
|
||||
statusLabel.Text = "Using Newer Version Than Latest Public Release.";
|
||||
}
|
||||
statusLabel.Text = "Latest Free Version Is Installed.";
|
||||
|
||||
if (Updater.IsVersionNewer(installed, latestPat))
|
||||
statusLabel.Text += "\nBeta Update Available On Patreon.";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
updateBtn.Enabled = true;
|
||||
if (Updater.VersionMatches(installed, latestPat))
|
||||
{
|
||||
statusLabel.Text = "Latest Patreon/Beta Version Is Installed.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (Updater.IsVersionNewer(installed, latestPat))
|
||||
{
|
||||
statusLabel.Text = "Update available on Patreon!";
|
||||
|
||||
if (Updater.IsVersionNewer(installed, latestFree))
|
||||
statusLabel.Text += " - Beta Updates Available On Patreon and Itch.io.";
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float lastProg = -1f;
|
||||
@@ -57,11 +64,18 @@ namespace Flowframes.Forms
|
||||
downloadingLabel.Text = str;
|
||||
}
|
||||
|
||||
private async void updateBtn_Click(object sender, EventArgs e)
|
||||
private void updatePatreonBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
string link = Updater.GetLatestVerLink();
|
||||
string link = Updater.GetLatestVerLink(true);
|
||||
if(!string.IsNullOrWhiteSpace(link))
|
||||
Process.Start(link);
|
||||
}
|
||||
|
||||
private void updateFreeBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
string link = Updater.GetLatestVerLink(false);
|
||||
if (!string.IsNullOrWhiteSpace(link))
|
||||
Process.Start(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,8 +94,6 @@ namespace Flowframes.Main
|
||||
await Task.Delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
//IOUtils.ZeroPadDir(copyPath, "*", Padding.interpFrames);
|
||||
}
|
||||
|
||||
static async Task Encode(i.OutMode mode, string framesPath, string outPath, float fps, float changeFps = -1, bool keepOriginalFpsVid = true)
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Flowframes.OS
|
||||
{
|
||||
class Updater
|
||||
{
|
||||
public static string latestVerUrl = "https://dl.nmkd.de/flowframes/exe/latest.ini";
|
||||
public static string latestVerUrl = "https://dl.nmkd.de/flowframes/exe/ver.ini";
|
||||
|
||||
public static SemVer GetInstalledVer()
|
||||
{
|
||||
@@ -61,22 +61,24 @@ namespace Flowframes.OS
|
||||
return v1.major == v2.major && v1.minor == v2.minor && v1.patch == v2.patch;
|
||||
}
|
||||
|
||||
public static SemVer GetLatestVer ()
|
||||
public static SemVer GetLatestVer (bool patreon)
|
||||
{
|
||||
var client = new WebClient();
|
||||
return new SemVer(client.DownloadString(latestVerUrl).SplitIntoLines()[0]);
|
||||
int line = patreon ? 0 : 2;
|
||||
return new SemVer(client.DownloadString(latestVerUrl).SplitIntoLines()[line]);
|
||||
}
|
||||
|
||||
public static string GetLatestVerLink()
|
||||
public static string GetLatestVerLink(bool patreon)
|
||||
{
|
||||
int line = patreon ? 1 : 3;
|
||||
var client = new WebClient();
|
||||
try
|
||||
{
|
||||
return client.DownloadString(latestVerUrl).SplitIntoLines()[1].Trim();
|
||||
return client.DownloadString(latestVerUrl).SplitIntoLines()[line].Trim();
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Log("Failed to get latest version link from latest.ini!", true);
|
||||
Logger.Log("Failed to get latest version link from ver.ini!", true);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -132,13 +134,16 @@ namespace Flowframes.OS
|
||||
|
||||
public static async Task AsyncUpdateCheck ()
|
||||
{
|
||||
SemVer latest = GetLatestVer();
|
||||
SemVer installed = GetInstalledVer();
|
||||
SemVer latestPat = GetLatestVer(true);
|
||||
SemVer latestFree = GetLatestVer(false);
|
||||
|
||||
if (IsVersionNewer(installed, latest))
|
||||
Logger.Log($"An update for Flowframes ({latest}) is available! Download it from the Updater.");
|
||||
else
|
||||
Logger.Log($"Flowframes is up to date ({installed}).");
|
||||
Logger.Log($"You are running Flowframes {installed}. The latest Patreon version is {latestPat}, the latest free version is {latestFree}.");
|
||||
|
||||
// if (IsVersionNewer(installed, latest))
|
||||
// Logger.Log($"An update for Flowframes ({latest}) is available! Download it from the Updater.");
|
||||
// else
|
||||
// Logger.Log($"Flowframes is up to date ({installed}).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user