Use update message box for dev build install button

This commit is contained in:
Jaex 2022-09-21 02:40:03 +03:00
parent 6e639b0e92
commit 2eb2536898
20 changed files with 11 additions and 73 deletions

View file

@ -36,7 +36,7 @@ public class GitHubUpdateManager : IDisposable
public TimeSpan UpdateReCheckInterval { get; private set; } = TimeSpan.FromHours(24); // If "No" button pressed in update message box then this interval will be used public TimeSpan UpdateReCheckInterval { get; private set; } = TimeSpan.FromHours(24); // If "No" button pressed in update message box then this interval will be used
public string GitHubOwner { get; set; } public string GitHubOwner { get; set; }
public string GitHubRepo { get; set; } public string GitHubRepo { get; set; }
public bool IsBeta { get; set; } // If current build is beta and latest stable release is same version as current build then it will be downloaded public bool IsDev { get; set; } // If current build is dev and latest stable release is same version as current build then it will be downloaded
public bool IsPortable { get; set; } // If current build is portable then download URL will be opened in browser instead of downloading it public bool IsPortable { get; set; } // If current build is portable then download URL will be opened in browser instead of downloading it
public bool CheckPreReleaseUpdates { get; set; } public bool CheckPreReleaseUpdates { get; set; }
@ -50,9 +50,9 @@ public GitHubUpdateManager(string owner, string repo)
GitHubRepo = repo; GitHubRepo = repo;
} }
public GitHubUpdateManager(string owner, string repo, bool beta, bool portable) : this(owner, repo) public GitHubUpdateManager(string owner, string repo, bool dev, bool portable) : this(owner, repo)
{ {
IsBeta = beta; IsDev = dev;
IsPortable = portable; IsPortable = portable;
} }
@ -94,7 +94,7 @@ public GitHubUpdateChecker CreateUpdateChecker()
{ {
return new GitHubUpdateChecker(GitHubOwner, GitHubRepo) return new GitHubUpdateChecker(GitHubOwner, GitHubRepo)
{ {
IsBeta = IsBeta, IsDev = IsDev,
IsPortable = IsPortable, IsPortable = IsPortable,
IncludePreRelease = CheckPreReleaseUpdates IncludePreRelease = CheckPreReleaseUpdates
}; };

View file

@ -39,7 +39,7 @@ public abstract class UpdateChecker
public Version CurrentVersion { get; set; } public Version CurrentVersion { get; set; }
public Version LatestVersion { get; set; } public Version LatestVersion { get; set; }
public ReleaseChannelType ReleaseType { get; set; } public ReleaseChannelType ReleaseType { get; set; }
public bool IsBeta { get; set; } public bool IsDev { get; set; }
public bool IsPortable { get; set; } public bool IsPortable { get; set; }
private string fileName; private string fileName;
@ -71,7 +71,7 @@ public void RefreshStatus()
} }
if (Status != UpdateStatus.UpdateCheckFailed && CurrentVersion != null && LatestVersion != null && !string.IsNullOrEmpty(DownloadURL) && if (Status != UpdateStatus.UpdateCheckFailed && CurrentVersion != null && LatestVersion != null && !string.IsNullOrEmpty(DownloadURL) &&
(ForceUpdate || Helpers.CompareVersion(CurrentVersion, LatestVersion) < 0 || (IsBeta && Helpers.CompareVersion(CurrentVersion, LatestVersion) == 0))) (ForceUpdate || Helpers.CompareVersion(CurrentVersion, LatestVersion) < 0 || (IsDev && Helpers.CompareVersion(CurrentVersion, LatestVersion) == 0)))
{ {
Status = UpdateStatus.UpdateAvailable; Status = UpdateStatus.UpdateAvailable;
} }

View file

@ -69,7 +69,7 @@ public UpdateMessageBox(bool activateWindow, UpdateChecker updateChecker)
sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_CurrentVersion); sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_CurrentVersion);
sbText.Append(": "); sbText.Append(": ");
sbText.Append(updateChecker.CurrentVersion); sbText.Append(updateChecker.CurrentVersion);
if (updateChecker.IsBeta) sbText.Append(" Beta"); if (updateChecker.IsDev) sbText.Append(" Dev");
sbText.AppendLine(); sbText.AppendLine();
sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_LatestVersion); sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_LatestVersion);
sbText.Append(": "); sbText.Append(": ");

View file

@ -452,11 +452,7 @@ private async void btnCheckDevBuild_Click(object sender, EventArgs e)
{ {
btnCheckDevBuild.Enabled = false; btnCheckDevBuild.Enabled = false;
if (MessageBox.Show(Resources.ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning, "ShareX", await TaskHelpers.DownloadDevBuild();
MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
await TaskHelpers.DownloadDevBuild();
}
if (!IsDisposed) if (!IsDisposed)
{ {

View file

@ -584,17 +584,6 @@ public static string ApplicationSettingsForm_btnBrowsePersonalFolderPath_Click_C
} }
} }
/// <summary>
/// Looks up a localized string similar to Development builds are for testing bug fixes and trying out new features early. Sometimes they can be less stable.
///
///Do you wish to continue?.
/// </summary>
public static string ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning {
get {
return ResourceManager.GetString("ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Would you like to reset ShareX settings?. /// Looks up a localized string similar to Would you like to reset ShareX settings?.
/// </summary> /// </summary>

View file

@ -404,9 +404,6 @@ Mittlere Maustaste um die Aktionsleiste zu schließen</value>
<data name="IntegrationHelpers_EditWithShareX" xml:space="preserve"> <data name="IntegrationHelpers_EditWithShareX" xml:space="preserve">
<value>Mit ShareX bearbeiten</value> <value>Mit ShareX bearbeiten</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Entwicklungs-Versionen können instabil sein und sind nur für Testzwecke geeignet. Möchten Sie diese trotzdem installieren?</value>
</data>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>Möchten Sie die ShareX-Einstellungen zurücksetzen?</value> <value>Möchten Sie die ShareX-Einstellungen zurücksetzen?</value>
</data> </data>

View file

@ -463,9 +463,6 @@ Clic medio para cerrar</value>
<data name="IntegrationHelpers_EditWithShareX" xml:space="preserve"> <data name="IntegrationHelpers_EditWithShareX" xml:space="preserve">
<value>Editar con ShareX</value> <value>Editar con ShareX</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Las versiones de desarrollo no son estables y solo deben usarse para realizar pruebas. ¿Desea instalar?</value>
</data>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>¿Desea restablecer la configuración de ShareX?</value> <value>¿Desea restablecer la configuración de ShareX?</value>
</data> </data>

View file

@ -465,9 +465,6 @@ Clique de la molette pour fermer</value>
<data name="UploadManager_ShowShortenURLDialog_ShortenURL" xml:space="preserve"> <data name="UploadManager_ShowShortenURLDialog_ShortenURL" xml:space="preserve">
<value>Raccourcir URL</value> <value>Raccourcir URL</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Les versions de développement peuvent être instables et doivent être utilisées uniquement à des fins de test. Voulez-vous installer ?</value>
</data>
<data name="IntegrationHelpers_EditWithShareX" xml:space="preserve"> <data name="IntegrationHelpers_EditWithShareX" xml:space="preserve">
<value>Modifier avec ShareX</value> <value>Modifier avec ShareX</value>
</data> </data>

View file

@ -450,9 +450,6 @@ ShareX を再起動しますか?</value>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>ShareXの設定をリセットしますか</value> <value>ShareXの設定をリセットしますか</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>開発中のバージョンは不安定なことがあります、またテスト目的にしか使えません。開発中バージョンをインストールしますか?</value>
</data>
<data name="AboutForm_AboutForm_Language_fa_IR" xml:space="preserve"> <data name="AboutForm_AboutForm_Language_fa_IR" xml:space="preserve">
<value>ペルシア語</value> <value>ペルシア語</value>
</data> </data>

View file

@ -242,9 +242,6 @@ Kliknij prawym przyciskiem myszy, aby otworzyć menu
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>Czy chcesz zresetować ustawienia ShareX?</value> <value>Czy chcesz zresetować ustawienia ShareX?</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Kompilacje deweloperskie mogą być niestabilne i muszą być używane tylko do celów testowych. Czy chcesz je zainstalować?</value>
</data>
<data name="ApplicationSettingsForm_cbLanguage_SelectedIndexChanged_Language_Restart" xml:space="preserve"> <data name="ApplicationSettingsForm_cbLanguage_SelectedIndexChanged_Language_Restart" xml:space="preserve">
<value>ShareX musi zostać ponownie uruchomiony, aby zmiany języka zostały zastosowane. <value>ShareX musi zostać ponownie uruchomiony, aby zmiany języka zostały zastosowane.

View file

@ -164,9 +164,6 @@ Botão do meio (scroll) para fechar</value>
<data name="ApplicationSettingsForm_btnBrowsePersonalFolderPath_Click_Choose_ShareX_personal_folder_path" xml:space="preserve"> <data name="ApplicationSettingsForm_btnBrowsePersonalFolderPath_Click_Choose_ShareX_personal_folder_path" xml:space="preserve">
<value>Escolher caminho da pasta raiz do ShareX</value> <value>Escolher caminho da pasta raiz do ShareX</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Versões de programador são instáveis e são usadas apenas para testes. Deseja continuar com a instalação?</value>
</data>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>Deseja repor as definições do ShareX?</value> <value>Deseja repor as definições do ShareX?</value>
</data> </data>

View file

@ -196,11 +196,6 @@
<data name="application_terminal" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="application_terminal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\application-terminal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\application-terminal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Development builds are for testing bug fixes and trying out new features early. Sometimes they can be less stable.
Do you wish to continue?</value>
</data>
<data name="globe" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="globe" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\globe.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\globe.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>

View file

@ -233,9 +233,6 @@ Clic în mijloc pentru a închide</value>
<data name="ApplicationSettingsForm_btnBrowsePersonalFolderPath_Click_Choose_ShareX_personal_folder_path" xml:space="preserve"> <data name="ApplicationSettingsForm_btnBrowsePersonalFolderPath_Click_Choose_ShareX_personal_folder_path" xml:space="preserve">
<value>Alegeți calea folderului personal ShareX</value> <value>Alegeți calea folderului personal ShareX</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Versiunile de dezvoltare pot fi instabile și trebuie utilizate numai în scopuri de testare. Doriți să o instalați?</value>
</data>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>Doriți să resetați setările ShareX?</value> <value>Doriți să resetați setările ShareX?</value>
</data> </data>

View file

@ -466,9 +466,6 @@
<data name="IntegrationHelpers_EditWithShareX" xml:space="preserve"> <data name="IntegrationHelpers_EditWithShareX" xml:space="preserve">
<value>Редактировать в ShareX</value> <value>Редактировать в ShareX</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Dev сборки могут быть нестабильными и должны использоваться только для тестирования. Хотите установить?</value>
</data>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>Хотите сбросить настройки ShareX?</value> <value>Хотите сбросить настройки ShareX?</value>
</data> </data>

View file

@ -471,9 +471,6 @@ Devam etmek istediğinizden emin misiniz?</value>
Sağ fare tuşu menüyü açmak için Sağ fare tuşu menüyü açmak için
Orta fare tuşu kapatmak için</value> Orta fare tuşu kapatmak için</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Geliştirici sürümleri kararsız olabilir bu yüzden deneme amaçlı kullanılmalıdır. İndirmek istediğine emin misin?</value>
</data>
<data name="WorkerTask_GetInvalidConfigResult__0__configuration_is_invalid_or_missing__Please_check__Destination_settings__window_to_configure_it_" xml:space="preserve"> <data name="WorkerTask_GetInvalidConfigResult__0__configuration_is_invalid_or_missing__Please_check__Destination_settings__window_to_configure_it_" xml:space="preserve">
<value>{0} ayarları yanlış veya eksik. Lütfen "Hedef ayarları" penceresinden ayar yapınız.</value> <value>{0} ayarları yanlış veya eksik. Lütfen "Hedef ayarları" penceresinden ayar yapınız.</value>
</data> </data>

View file

@ -178,9 +178,6 @@
<data name="ScreenshotDelay0S" xml:space="preserve"> <data name="ScreenshotDelay0S" xml:space="preserve">
<value>Затримка для знімка: {0}с</value> <value>Затримка для знімка: {0}с</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Dev-збірки можуть бути нестабільними та повинні використовуватись лише для тестування. Хочете встановити?</value>
</data>
<data name="ActionsForm_btnOK_Click_Name_can_t_be_empty_" xml:space="preserve"> <data name="ActionsForm_btnOK_Click_Name_can_t_be_empty_" xml:space="preserve">
<value>Назва не може бути порожньою.</value> <value>Назва не може бути порожньою.</value>
</data> </data>

View file

@ -376,9 +376,6 @@ Nhấn "Không" để hủy tiến trình tải lên hiện tại và tắt ch
<data name="QuickTaskMenu_ShowMenu_Continue" xml:space="preserve"> <data name="QuickTaskMenu_ShowMenu_Continue" xml:space="preserve">
<value>Tiếp tục</value> <value>Tiếp tục</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>Bản phát hành cho lập trình viên có thể không ổn định và chỉ được dùng cho mục đích kiểm thử. Bạn có muốn cài đặt nó không?</value>
</data>
<data name="AboutForm_AboutForm_Language_nl_NL" xml:space="preserve"> <data name="AboutForm_AboutForm_Language_nl_NL" xml:space="preserve">
<value>Tiếng Hà Lan</value> <value>Tiếng Hà Lan</value>
</data> </data>

View file

@ -465,9 +465,6 @@
<data name="IntegrationHelpers_EditWithShareX" xml:space="preserve"> <data name="IntegrationHelpers_EditWithShareX" xml:space="preserve">
<value>使用ShareX编辑</value> <value>使用ShareX编辑</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>开发版可能不稳定,仅用于测试目的。要安装吗?</value>
</data>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>要重置 ShareX 设置项吗?</value> <value>要重置 ShareX 设置项吗?</value>
</data> </data>

View file

@ -456,9 +456,6 @@
<data name="ActionsToolbarEditForm_Separator" xml:space="preserve"> <data name="ActionsToolbarEditForm_Separator" xml:space="preserve">
<value>分隔符</value> <value>分隔符</value>
</data> </data>
<data name="ApplicationSettingsForm_btnCheckDevBuild_Click_DevBuilds_Warning" xml:space="preserve">
<value>開發版可能不穩定,僅供測試用途。要安裝嗎?</value>
</data>
<data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve"> <data name="ApplicationSettingsForm_btnResetSettings_Click_WouldYouLikeToResetShareXSettings" xml:space="preserve">
<value>要重設 ShareX 設定嗎?</value> <value>要重設 ShareX 設定嗎?</value>
</data> </data>

View file

@ -1867,23 +1867,20 @@ public static async Task DownloadDevBuild()
{ {
GitHubUpdateChecker updateChecker = new GitHubUpdateChecker("ShareX", "DevBuilds") GitHubUpdateChecker updateChecker = new GitHubUpdateChecker("ShareX", "DevBuilds")
{ {
IsBeta = true, IsDev = true,
IsPortable = Program.Portable IsPortable = Program.Portable
}; };
await updateChecker.CheckUpdateAsync(); await updateChecker.CheckUpdateAsync();
if (updateChecker.Status == UpdateStatus.UpdateAvailable) UpdateMessageBox.Start(updateChecker);
{
updateChecker.DownloadUpdate();
}
} }
public static async Task DownloadAppVeyorBuild() public static async Task DownloadAppVeyorBuild()
{ {
AppVeyorUpdateChecker updateChecker = new AppVeyorUpdateChecker() AppVeyorUpdateChecker updateChecker = new AppVeyorUpdateChecker()
{ {
IsBeta = true, IsDev = true,
IsPortable = Program.Portable, IsPortable = Program.Portable,
Branch = "develop" Branch = "develop"
}; };