/// <summary> /// Reads a version file /// </summary> /// <param name="location">Path to version file to read</param> /// <returns>The Version Stucture</returns> private VersionInfo.versionInfoStruct readVersionFile(string location) { VersionInfo.versionInfoStruct value = new VersionInfo.versionInfoStruct(); if (File.Exists(location)) { try { string line = File.ReadAllText(location); string[] octets = new string[4]; octets = line.Split('.'); value.Major = int.Parse(octets[0]); value.Minor = int.Parse(octets[1]); value.Build = int.Parse(octets[2]); value.Revision = int.Parse(octets[3]); } catch { } } return(value); }
private bool compareVersions(VersionInfo.versionInfoStruct InstalledVersion, VersionInfo.versionInfoStruct LatestVersion) { bool result = false; try { if (LatestVersion.Major > InstalledVersion.Major) { result = true; } else if (LatestVersion.Minor > InstalledVersion.Minor) { result = true; } else if (LatestVersion.Build > InstalledVersion.Build) { result = true; } else if (LatestVersion.Revision > InstalledVersion.Revision) { result = true; } } catch { result = false; } return(result); }
/// <summary> /// Gets the current running version /// </summary> /// <returns>The version Stucture</returns> internal VersionInfo.versionInfoStruct getCurrentVersion() { VersionInfo.versionInfoStruct value = new VersionInfo.versionInfoStruct(); if (File.Exists(PATH_TO_LOCAL_VERSION)) value = readVersionFile(PATH_TO_LOCAL_VERSION); return value; }
/// <summary> /// Gets the current running version /// </summary> /// <returns>The version Stucture</returns> internal VersionInfo.versionInfoStruct getCurrentVersion() { VersionInfo.versionInfoStruct value = new VersionInfo.versionInfoStruct(); if (File.Exists(PATH_TO_LOCAL_VERSION)) { value = readVersionFile(PATH_TO_LOCAL_VERSION); } return(value); }
private void Init() { TEMP_DIRECTORY = localSettings.getTmpDirectory().ToString();// localSettings.getInstance().TEMP_DIRECTORY; if (!Directory.Exists(TEMP_DIRECTORY)) { Directory.CreateDirectory(TEMP_DIRECTORY); } txtLatestVersion.BackColor = txtLatestVersion.BackColor; txtInstalledVersion.Text = ""; txtLatestVersion.Text = "Check for Updates"; InstalledVersionInfo = VersionManagement.getInstalledVersionInfo(); txtInstalledVersion.Text = VersionManagement.getInstalledFullVersionString(); }
public frmAbout() { string descriptionText = global::Snes360SGC.Properties.Resources.Description; VersionManager appVersionManager = new VersionManager(); VersionInfo.versionInfoStruct appVersionInfo = new VersionInfo.versionInfoStruct(); appVersionInfo = appVersionManager.getCurrentVersion(); descriptionText = descriptionText.Replace("[version]", appVersionInfo.getFullVersion()); InitializeComponent(); this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = AssemblyProduct; this.labelVersion.Text = String.Format("Version {0}", appVersionInfo.getFullVersion()); this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = ""; // AssemblyCompany; this.textBoxDescription.Text = descriptionText; //AssemblyDescription; }
private void btnCheckForUpdates_Click(object sender, EventArgs e) { setLatestVersionFont(Color.Black, FontStyle.Regular); txtLatestVersion.Text = "Checking..."; LatestVersionInfo = VersionManagement.getNewestVersion(TEMP_DIRECTORY); if (VersionManagement.checkIfNewer(InstalledVersionInfo, LatestVersionInfo)) { btnUpdate.Enabled = true; getChangeLog(); setLatestVersionFont(Color.Green, FontStyle.Bold); } txtLatestVersion.Text = LatestVersionInfo.getFullVersion(); }
public VersionManager() { //Init(); this._InstalledVersionInfo = getCurrentVersion(); }
internal bool checkIfNewer(VersionInfo.versionInfoStruct installedVersion, VersionInfo.versionInfoStruct LatestVersion) { return(compareVersions(installedVersion, LatestVersion)); }
/// <summary> /// Reads a version file /// </summary> /// <param name="location">Path to version file to read</param> /// <returns>The Version Stucture</returns> private VersionInfo.versionInfoStruct readVersionFile(string location) { VersionInfo.versionInfoStruct value = new VersionInfo.versionInfoStruct(); if (File.Exists(location)) { try { string line = File.ReadAllText(location); string[] octets = new string[4]; octets = line.Split('.'); value.Major = int.Parse(octets[0]); value.Minor = int.Parse(octets[1]); value.Build = int.Parse(octets[2]); value.Revision = int.Parse(octets[3]); } catch { } } return value; }