/// <summary> /// Compare 2 versions /// </summary> /// <param name="version">La version à comparer</param> /// <returns>-1 si l'instance est inférieur, 0 s'ils sont égalent, 1 si l'instance est supérieur</returns> public int CompareTo(CIVVersion version) { // Majeur if (Major < version.Major) { return(-1); } else if (Major > version.Major) { return(1); } else { // Mineur if (Minor < version.Minor) { return(-1); } else if (Minor > version.Minor) { return(1); } else { // Build if (Build < version.Build) { return(-1); } else if (Build > version.Build) { return(1); } else { // Révision if (Revision < version.Revision) { return(-1); } else if (Revision > version.Revision) { return(1); } else { return(0); } } } } }
private void CheckUpdate() { using (CIV.CentralCenterClient.CentralCenterServiceReference.CentralCenterSoapClient client = new CIV.CentralCenterClient.CentralCenterServiceReference.CentralCenterSoapClient()) { if (client.IsCompatibleClient(App.VersionStr())) { if (client.IsLastVersion("CIV", CurrentVersion.ToString())) DoUpdateNotAvailable(); else { CIV.CentralCenterClient.CentralCenterServiceReference.ReleaseBO lastReleaseBO = client.GetLastVersion("CIV"); _lastVersion = new CIVVersion(lastReleaseBO.Number); if (LastVersion.CompareTo(CurrentVersion) > 0) { FileRelease release = new FileRelease() { Number = new CIVVersion(lastReleaseBO.Number), Release = lastReleaseBO.Release, Size = lastReleaseBO.Size, Url = lastReleaseBO.Url, History = lastReleaseBO.History, CRC = lastReleaseBO.CRC }; DoUpdateAvailable(new UpdateAvailabledEventArgs(release)); } else DoUpdateNotAvailable(); } } else if (IsNotCompatibleClient != null) IsNotCompatibleClient(this, null); } }
public void Execute(string currentVersion) { CurrentVersion = new CIVVersion(currentVersion); CIV.Common.CentralCenterServiceReference.CentralCenterSoapClient client = new Common.CentralCenterServiceReference.CentralCenterSoapClient(); CIVVersion lastVersion; CIV.Common.CentralCenterServiceReference.ReleaseBO lastReleaseBO = client.GetLastVersion("CIV"); lastVersion = new CIVVersion(lastReleaseBO.Number); if (lastVersion.CompareTo(CurrentVersion) == -1) OnUpdateNotAvailable(this, null); else OnUpdateAvailable(this, null); }
/// <summary> /// Compare 2 versions /// </summary> /// <param name="version">La version à comparer</param> /// <returns>-1 si l'instance est inférieur, 0 s'ils sont égalent, 1 si l'instance est supérieur</returns> public int CompareTo(CIVVersion version) { // Majeur if (Major < version.Major) return -1; else if (Major > version.Major) return 1; else { // Mineur if (Minor < version.Minor) return -1; else if (Minor > version.Minor) return 1; else { // Build if (Build < version.Build) return -1; else if (Build > version.Build) return 1; else { // Révision if (Revision < version.Revision) return -1; else if (Revision > version.Revision) return 1; else { return 0; } } } } }
public ProgramSettings() { Id = Guid.NewGuid(); Accounts = new List<CIVAccount>(); IsProtected = false; ShowUnitType = SIUnitTypes.Mo; Created = DateTime.Now; EmailSMTP = new SmtpSettings(); UserLanguage = SupportedLanguages.French; AutomaticSendReport = true; UploadColor = new ColorRGB(8, 141, 182); DownloadColor = new ColorRGB(221, 167, 15); CombinedColor = new ColorRGB(0, 100, 50); NextInternetAccesUpdate = DateTime.Now.AddDays(14); DisplayHistoryGraph = true; DashboardPosition = new Point(); MinimizeToTrayOnClose = false; SaveDisplayPosition = false; SystrayDisplay = true; // Affichage par défaut Display = new List<DisplayInfoTypes>(); DisplaySystray = new List<DisplayInfoTypes>(); Version = new CIVVersion("3.5.0.0"); IsPortable = File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "portable")); }
public void Execute(string currentVersion) { CurrentVersion = new CIVVersion(currentVersion); CheckUpdate(); }