コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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();
        }
コード例 #8
0
 public VersionManager()
 {
     //Init();
     this._InstalledVersionInfo = getCurrentVersion();
 }
コード例 #9
0
 internal bool checkIfNewer(VersionInfo.versionInfoStruct installedVersion, VersionInfo.versionInfoStruct LatestVersion)
 {
     return(compareVersions(installedVersion, LatestVersion));
 }
コード例 #10
0
 public VersionManager()
 {
     //Init();
     this._InstalledVersionInfo = getCurrentVersion();
 }
コード例 #11
0
        /// <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;
        }