diff --git a/mRemoteNGTests/App/UpdaterTests.cs b/mRemoteNGTests/App/UpdaterTests.cs index a4b8d535..46febb63 100644 --- a/mRemoteNGTests/App/UpdaterTests.cs +++ b/mRemoteNGTests/App/UpdaterTests.cs @@ -1,6 +1,7 @@ using System; using mRemoteNG.App.Info; using mRemoteNG.App.Update; +using mRemoteNGTests.Properties; using NUnit.Framework; namespace mRemoteNGTests.App @@ -8,15 +9,12 @@ namespace mRemoteNGTests.App [TestFixture] public class UpdaterTests { +#if !PORTABLE [Test] public void UpdateStableChannel() { GeneralAppInfo.ApplicationVersion = "1.0.0.0"; - var _upd = new AppUpdater(); - var e = _upd.DownloadString(UpdateChannelInfo.GetUpdateChannelInfo(UpdateChannelInfo.STABLE)); - Assert.That(e.Cancelled, Is.False); - Assert.That(e.Error, Is.Null); - var CurrentUpdateInfo = UpdateInfo.FromString(e.Result); + var CurrentUpdateInfo = UpdateInfo.FromString(Resources.update); Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True); Version v; Version.TryParse(GeneralAppInfo.ApplicationVersion, out v); @@ -28,11 +26,7 @@ namespace mRemoteNGTests.App public void UpdateBetaChannel() { GeneralAppInfo.ApplicationVersion = "1.0.0.0"; - var _upd = new AppUpdater(); - var e = _upd.DownloadString(UpdateChannelInfo.GetUpdateChannelInfo(UpdateChannelInfo.BETA)); - Assert.That(e.Cancelled, Is.False); - Assert.That(e.Error, Is.Null); - var CurrentUpdateInfo = UpdateInfo.FromString(e.Result); + var CurrentUpdateInfo = UpdateInfo.FromString(Resources.beta_update); Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True); Version v; Version.TryParse(GeneralAppInfo.ApplicationVersion, out v); @@ -44,16 +38,50 @@ namespace mRemoteNGTests.App public void UpdateDevChannel() { GeneralAppInfo.ApplicationVersion = "1.0.0.0"; - var _upd = new AppUpdater(); - var e = _upd.DownloadString(UpdateChannelInfo.GetUpdateChannelInfo(UpdateChannelInfo.DEV)); - Assert.That(e.Cancelled, Is.False); - Assert.That(e.Error, Is.Null); - var CurrentUpdateInfo = UpdateInfo.FromString(e.Result); + var CurrentUpdateInfo = UpdateInfo.FromString(Resources.dev_update); Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True); Version v; Version.TryParse(GeneralAppInfo.ApplicationVersion, out v); var IsNewer = CurrentUpdateInfo.Version > v; Assert.That(IsNewer, Is.True); } + +#else + [Test] + public void UpdateStablePortableChannel() + { + GeneralAppInfo.ApplicationVersion = "1.0.0.0"; + var CurrentUpdateInfo = UpdateInfo.FromString(Resources.update_portable); + Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True); + Version v; + Version.TryParse(GeneralAppInfo.ApplicationVersion, out v); + var IsNewer = CurrentUpdateInfo.Version > v; + Assert.That(IsNewer, Is.True); + } + + [Test] + public void UpdateBetaPortableChannel() + { + GeneralAppInfo.ApplicationVersion = "1.0.0.0"; + var CurrentUpdateInfo = UpdateInfo.FromString(Resources.beta_update_portable); + Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True); + Version v; + Version.TryParse(GeneralAppInfo.ApplicationVersion, out v); + var IsNewer = CurrentUpdateInfo.Version > v; + Assert.That(IsNewer, Is.True); + } + + [Test] + public void UpdateDevPortableChannel() + { + GeneralAppInfo.ApplicationVersion = "1.0.0.0"; + var CurrentUpdateInfo = UpdateInfo.FromString(Resources.dev_update_portable); + Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True); + Version v; + Version.TryParse(GeneralAppInfo.ApplicationVersion, out v); + var IsNewer = CurrentUpdateInfo.Version > v; + Assert.That(IsNewer, Is.True); + } +#endif } } diff --git a/mRemoteNGTests/Properties/Resources.Designer.cs b/mRemoteNGTests/Properties/Resources.Designer.cs index b47fce60..ebc09adb 100644 --- a/mRemoteNGTests/Properties/Resources.Designer.cs +++ b/mRemoteNGTests/Properties/Resources.Designer.cs @@ -60,6 +60,32 @@ namespace mRemoteNGTests.Properties { } } + /// + /// Looks up a localized string similar to Version: 1.75.6164.27544 + ///dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Installer-1.75.6179.28160.msi + ///clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT + ///CertificateThumbprint: 0CEA828E5C787EA8AA89268D83816C1EA03375BA + ///Checksum: A1E50ACAC4CB8023527E1E7A0E682459 + ///. + /// + internal static string beta_update { + get { + return ResourceManager.GetString("beta_update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version: 1.75.6170.27478 + ///dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Portable-1.75.6179.28241.zip + ///clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT + ///Checksum: 1C35EA199F58001BC4EBB164D8B3D11C. + /// + internal static string beta_update_portable { + get { + return ResourceManager.GetString("beta_update_portable", resourceCulture); + } + } + /// /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> ///<Connections Name="Connections" Export="False" Protected="95syzRuZ4mRxpNkZQzoyX8SDpQXLyMq3GncO8o4SyTBoYvn3TAWgn05ZEU2DrjkM" ConfVersion="2.5"> @@ -142,6 +168,32 @@ namespace mRemoteNGTests.Properties { } } + /// + /// Looks up a localized string similar to Version: 1.75.6164.27544 + ///dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Installer-1.75.6179.28160.msi + ///clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT + ///CertificateThumbprint: 0CEA828E5C787EA8AA89268D83816C1EA03375BA + ///Checksum: A1E50ACAC4CB8023527E1E7A0E682459 + ///. + /// + internal static string dev_update { + get { + return ResourceManager.GetString("dev_update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version: 1.75.6170.27478 + ///dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Portable-1.75.6179.28241.zip + ///clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT + ///Checksum: 1C35EA199F58001BC4EBB164D8B3D11C. + /// + internal static string dev_update_portable { + get { + return ResourceManager.GetString("dev_update_portable", resourceCulture); + } + } + /// /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-16"?> ///<!-- ****************************************************************--> @@ -276,5 +328,30 @@ namespace mRemoteNGTests.Properties { return ResourceManager.GetString("test_remotedesktopconnection_rdp", resourceCulture); } } + + /// + /// Looks up a localized string similar to Version: 1.72.5065.32737 + ///dURL: http://downloads.mremoteng.org/mRemoteNG-Installer-1.72.exe + ///clURL: http://update.mremoteng.org/changes-1.72.txt + ///CertificateThumbprint: 1cbd910dbd6e77f26506e7f600736972f700673f + ///. + /// + internal static string update { + get { + return ResourceManager.GetString("update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version: 1.75.6170.27478 + ///dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Portable-1.75.6179.28241.zip + ///clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT + ///Checksum: 1C35EA199F58001BC4EBB164D8B3D11C. + /// + internal static string update_portable { + get { + return ResourceManager.GetString("update_portable", resourceCulture); + } + } } } diff --git a/mRemoteNGTests/Properties/Resources.resx b/mRemoteNGTests/Properties/Resources.resx index 0fe45ee4..902712d2 100644 --- a/mRemoteNGTests/Properties/Resources.resx +++ b/mRemoteNGTests/Properties/Resources.resx @@ -118,6 +118,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\beta-update.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\Resources\beta-update-portable.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\confCons_v2_5.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 @@ -142,6 +148,12 @@ ..\Resources\confCons_v2_6_passwordis_Password_fullencryption.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\Resources\dev-update.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\Resources\dev-update-portable.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\test_puttyConnectionManager_database.dat;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 @@ -163,4 +175,10 @@ ..\Resources\test_remotedesktopconnection.rdp;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + + ..\Resources\update.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\Resources\update-portable.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/mRemoteNGTests/Resources/beta-update-portable.txt b/mRemoteNGTests/Resources/beta-update-portable.txt new file mode 100644 index 00000000..86a8e362 --- /dev/null +++ b/mRemoteNGTests/Resources/beta-update-portable.txt @@ -0,0 +1,4 @@ +Version: 1.75.6170.27478 +dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Portable-1.75.6179.28241.zip +clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT +Checksum: 1C35EA199F58001BC4EBB164D8B3D11C \ No newline at end of file diff --git a/mRemoteNGTests/Resources/beta-update.txt b/mRemoteNGTests/Resources/beta-update.txt new file mode 100644 index 00000000..1e6beeb0 --- /dev/null +++ b/mRemoteNGTests/Resources/beta-update.txt @@ -0,0 +1,5 @@ +Version: 1.75.6164.27544 +dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Installer-1.75.6179.28160.msi +clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT +CertificateThumbprint: 0CEA828E5C787EA8AA89268D83816C1EA03375BA +Checksum: A1E50ACAC4CB8023527E1E7A0E682459 \ No newline at end of file diff --git a/mRemoteNGTests/Resources/dev-update-portable.txt b/mRemoteNGTests/Resources/dev-update-portable.txt new file mode 100644 index 00000000..86a8e362 --- /dev/null +++ b/mRemoteNGTests/Resources/dev-update-portable.txt @@ -0,0 +1,4 @@ +Version: 1.75.6170.27478 +dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Portable-1.75.6179.28241.zip +clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT +Checksum: 1C35EA199F58001BC4EBB164D8B3D11C \ No newline at end of file diff --git a/mRemoteNGTests/Resources/dev-update.txt b/mRemoteNGTests/Resources/dev-update.txt new file mode 100644 index 00000000..1e6beeb0 --- /dev/null +++ b/mRemoteNGTests/Resources/dev-update.txt @@ -0,0 +1,5 @@ +Version: 1.75.6164.27544 +dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Installer-1.75.6179.28160.msi +clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT +CertificateThumbprint: 0CEA828E5C787EA8AA89268D83816C1EA03375BA +Checksum: A1E50ACAC4CB8023527E1E7A0E682459 \ No newline at end of file diff --git a/mRemoteNGTests/Resources/update-portable.txt b/mRemoteNGTests/Resources/update-portable.txt new file mode 100644 index 00000000..86a8e362 --- /dev/null +++ b/mRemoteNGTests/Resources/update-portable.txt @@ -0,0 +1,4 @@ +Version: 1.75.6170.27478 +dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Portable-1.75.6179.28241.zip +clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT +Checksum: 1C35EA199F58001BC4EBB164D8B3D11C \ No newline at end of file diff --git a/mRemoteNGTests/Resources/update.txt b/mRemoteNGTests/Resources/update.txt new file mode 100644 index 00000000..1e6beeb0 --- /dev/null +++ b/mRemoteNGTests/Resources/update.txt @@ -0,0 +1,5 @@ +Version: 1.75.6164.27544 +dURL: https://github.com/mRemoteNG/mRemoteNG/releases/download/v1.75Beta3/mRemoteNG-Installer-1.75.6179.28160.msi +clURL: https://raw.githubusercontent.com/mRemoteNG/mRemoteNG/v1.75Beta3/CHANGELOG.TXT +CertificateThumbprint: 0CEA828E5C787EA8AA89268D83816C1EA03375BA +Checksum: A1E50ACAC4CB8023527E1E7A0E682459 \ No newline at end of file diff --git a/mRemoteNGTests/mRemoteNGTests.csproj b/mRemoteNGTests/mRemoteNGTests.csproj index d317f353..ca6f77c0 100644 --- a/mRemoteNGTests/mRemoteNGTests.csproj +++ b/mRemoteNGTests/mRemoteNGTests.csproj @@ -208,6 +208,14 @@ + + + + + + + + diff --git a/mRemoteV1/App/Info/UpdateChannelInfo.cs b/mRemoteV1/App/Info/UpdateChannelInfo.cs index 624116ae..1ec19d9f 100644 --- a/mRemoteV1/App/Info/UpdateChannelInfo.cs +++ b/mRemoteV1/App/Info/UpdateChannelInfo.cs @@ -24,12 +24,6 @@ namespace mRemoteNG.App.Info return GetUpdateTxtUri(channel); } - public static Uri GetUpdateChannelInfo(string s) - { - var channel = IsValidChannel(s) ? s : STABLE; - return GetUpdateTxtUri(channel); - } - private static string GetChannelFileName(string channel) { #if PORTABLE