Append "Dev" to dev build version

This commit is contained in:
Jaex 2022-09-22 00:57:04 +03:00
parent 6a8ce7abb0
commit 50cfd920d0
4 changed files with 10 additions and 11 deletions

View file

@ -81,7 +81,7 @@ private void CheckUpdate()
UpdateChecker updateChecker = CreateUpdateChecker(); UpdateChecker updateChecker = CreateUpdateChecker();
updateChecker.CheckUpdate(); updateChecker.CheckUpdate();
if (UpdateMessageBox.Start(updateChecker, firstUpdateCheck, Links.Changelog) == DialogResult.No) if (UpdateMessageBox.Start(updateChecker, firstUpdateCheck) == DialogResult.No)
{ {
AutoUpdateEnabled = false; AutoUpdateEnabled = false;
} }

View file

@ -112,7 +112,7 @@ private void UpdateControls()
private void llblUpdateAvailable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void llblUpdateAvailable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
UpdateMessageBox.Start(updateChecker, true, Links.Changelog); UpdateMessageBox.Start(updateChecker);
} }
} }
} }

View file

@ -35,14 +35,12 @@ public partial class UpdateMessageBox : Form
public static bool IsOpen { get; private set; } public static bool IsOpen { get; private set; }
public bool ActivateWindow { get; private set; } public bool ActivateWindow { get; private set; }
public string ChangelogURL { get; private set; }
protected override bool ShowWithoutActivation => !ActivateWindow; protected override bool ShowWithoutActivation => !ActivateWindow;
public UpdateMessageBox(UpdateChecker updateChecker, bool activateWindow = true, string changelogURL = null) public UpdateMessageBox(UpdateChecker updateChecker, bool activateWindow = true, bool devBuild = false)
{ {
ActivateWindow = activateWindow; ActivateWindow = activateWindow;
ChangelogURL = changelogURL;
InitializeComponent(); InitializeComponent();
ShareXResources.ApplyTheme(this); ShareXResources.ApplyTheme(this);
@ -75,14 +73,15 @@ public UpdateMessageBox(UpdateChecker updateChecker, bool activateWindow = true,
sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_LatestVersion); sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_LatestVersion);
sbText.Append(": "); sbText.Append(": ");
sbText.Append(updateChecker.LatestVersion); sbText.Append(updateChecker.LatestVersion);
if (devBuild) sbText.Append(" Dev");
if (updateChecker is GitHubUpdateChecker githubUpdateChecker && githubUpdateChecker.IsPreRelease) sbText.Append(" (Pre-release)"); if (updateChecker is GitHubUpdateChecker githubUpdateChecker && githubUpdateChecker.IsPreRelease) sbText.Append(" (Pre-release)");
lblText.Text = sbText.ToString(); lblText.Text = sbText.ToString();
lblViewChangelog.Visible = !string.IsNullOrEmpty(ChangelogURL); lblViewChangelog.Visible = !devBuild;
} }
public static DialogResult Start(UpdateChecker updateChecker, bool activateWindow = true, string changelogURL = null) public static DialogResult Start(UpdateChecker updateChecker, bool activateWindow = true, bool devBuild = false)
{ {
DialogResult result = DialogResult.None; DialogResult result = DialogResult.None;
@ -92,7 +91,7 @@ public static DialogResult Start(UpdateChecker updateChecker, bool activateWindo
try try
{ {
using (UpdateMessageBox messageBox = new UpdateMessageBox(updateChecker, activateWindow, changelogURL)) using (UpdateMessageBox messageBox = new UpdateMessageBox(updateChecker, activateWindow, devBuild))
{ {
result = messageBox.ShowDialog(); result = messageBox.ShowDialog();
} }
@ -129,7 +128,7 @@ private void UpdateMessageBox_FormClosing(object sender, FormClosingEventArgs e)
private void lblViewChangelog_Click(object sender, EventArgs e) private void lblViewChangelog_Click(object sender, EventArgs e)
{ {
URLHelpers.OpenURL(ChangelogURL); URLHelpers.OpenURL(Links.Changelog);
} }
private void btnYes_MouseClick(object sender, MouseEventArgs e) private void btnYes_MouseClick(object sender, MouseEventArgs e)

View file

@ -1873,7 +1873,7 @@ public static async Task DownloadDevBuild()
await updateChecker.CheckUpdateAsync(); await updateChecker.CheckUpdateAsync();
UpdateMessageBox.Start(updateChecker); UpdateMessageBox.Start(updateChecker, true, true);
} }
public static async Task DownloadAppVeyorBuild() public static async Task DownloadAppVeyorBuild()
@ -1887,7 +1887,7 @@ public static async Task DownloadAppVeyorBuild()
await updateChecker.CheckUpdateAsync(); await updateChecker.CheckUpdateAsync();
UpdateMessageBox.Start(updateChecker); UpdateMessageBox.Start(updateChecker, true, true);
} }
public static Image CreateQRCode(string text, int width, int height) public static Image CreateQRCode(string text, int width, int height)