Exemplo n.º 1
0
        /// <summary>
        /// Checks for update
        ///
        /// Sets UpdateAvailable to true if an update was found and
        /// Sets UpdateAvailable to false if an update was not found
        /// </summary>
        public void CheckForUpdate()
        {
            if (!ReadUpdateXML())
            {
                Log.Error("Couldn't read update information.");
                return;
            }

            UpdateAvailable = CurrentVersion.CompareTo(NewVersion) < 0;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks for update
        ///
        /// Sets UpdateAvailable to true if an update was found and
        /// Sets UpdateAvailable to false if an update was not found
        /// </summary>
        public void CheckForUpdate()
        {
            if (!ReadUpdateXML())
            {
                Log.Error(Language.Resource.COULDNT_READ_UPDATE_INFORMATION);
                return;
            }

            UpdateAvailable = CurrentVersion.CompareTo(NewVersion) < 0;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Compares 'UpdatedVersion' and 'CurrentVersion' to identify the difference (outdated or up-to-date, etc.)
        /// </summary>
        /// <returns></returns>
        public VersionStatus RunVersionCheck()
        {
            var updated = UpdatedVersion;
            var status  = VersionStatus.Undetermined;

            //add a build and revision of '0' (v[M].[m].[0.0]) if one isn't defined, by creating a new temporary version object
            if (updated.Build == -1)
            {
                updated = new Version($"{UpdateData.tag_name.TrimStart('v')}.0.0");
            }

            //add a revision of '0' if one isn't defined, by creating a new temporary version object
            if (updated.Revision == -1)
            {
                updated = new Version($"{UpdateData.tag_name.TrimStart('v')}.0");
            }

            try
            {
                //null-checks
                if (Valid)
                {
                    //execute version check
                    var comparison = CurrentVersion.CompareTo(updated);

                    //outdated
                    if (comparison < 0)
                    {
                        status = VersionStatus.Outdated;
                    }
                    //up-to-date
                    else if (comparison == 0)
                    {
                        status = VersionStatus.UpToDate;
                    }
                    //bumped
                    else
                    {
                        status = VersionStatus.Bumped;
                    }
                }
            }
            catch
            {
                //ignore
            }

            //finalise and return the result
            return(status);
        }
Exemplo n.º 4
0
        public bool IsUpdateAvailable()
        {
            if (LatestVersion == null)
            {
                return(false);
            }
            else
            {
                if (CurrentVersion.CompareTo(LatestVersion) < 0)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Checks for update
        ///
        /// Sets UpdateAvailable to true if an update was found and
        /// Sets UpdateAvailable to false if an update was not found
        /// </summary>
        public void CheckForUpdate()
        {
            try {
                Dns.GetHostAddresses("getwnmp.org");
            } catch (Exception) {
                Log.Error("Couldn't connect to update server.");
                return;
            }

            if (!ReadUpdateXML())
            {
                Log.Error("Couldn't read update information.");
                return;
            }

            UpdateAvailable = CurrentVersion.CompareTo(NewVersion) < 0;
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Check the current application version against the latest version hosted on GitHub. If this version is outdated,
        ///     then download and run the latest version installer.
        /// </summary>
        public static void CheckApplicationVersion()
        {
            try
            {
                MainWindow.Window.SetStatus("Checking application for new update...");

                var latestVersion = new Version(GitHubData.TagName);

                if (CurrentVersion.CompareTo(latestVersion) < 0)
                {
                    DownloadAndRunInstaller();
                }
                else
                {
                    MainWindow.Window.SetStatus($"You're currently using the latest version of AtomicX ({GitHubData.Name})");
                }
            }
            catch (Exception ex)
            {
                MainWindow.Window.SetStatus($"Unable to check for new version for the moment. Error: {ex.Message}", ex);
            }
        }
Exemplo n.º 7
0
        private void SetUpdateMessage()
        {
            VersionUpdateMessage = string.Empty;

            var lastVersion = Properties.Settings.Default.UpdateManager_LastVersion;
            var lastCheck   = Properties.Settings.Default.UpdateManager_LastCheck;

            if (lastVersion != null)
            {
                if (CurrentVersion.CompareTo(lastVersion) < 0)
                {
                    VersionUpdateMessage += $"Update {lastVersion} is available.";
                }
                else
                {
                    VersionUpdateMessage += "Updated.";
                }
            }

            if (lastCheck.HasValue)
            {
                VersionUpdateMessage += $" Last update check on {lastCheck.Value.Humanize()}.";
            }
        }
Exemplo n.º 8
0
        void MyButtonHandler(object sender, EventArgs e)
        {
            try
            {
                if (prevbtn != null)
                {
                    prevbtn.BackColor = Color.White;
                }
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                //selectedCatalogueID = btn.Text;
                fillItemPrivileges(btn.Name.Substring(3));
                btn.BackColor = Color.SkyBlue;
                prevbtn       = btn;
                string btnText  = btn.Name;
                string frmName  = "";
                String formText = "";
                if (Utilities.checkStringInArray(btn.Name.Substring(3), userOptionArray) >= 0)
                {
                    foreach (menuitem menu in menuitems)
                    {
                        if (btn.Name.Substring(3).Equals(menu.menuItemID))
                        {
                            if (menu.versionrequired.Trim().Length > 0)
                            {
                                if (CurrentVersion.CompareTo(menu.versionrequired) < 0)
                                {
                                    MessageBox.Show("This options requires version " + menu.versionrequired + " or higher");
                                    return;
                                }
                            }
                            frmName         = menu.pageLink;
                            formText        = menu.shortDescription;
                            currentDocument = menu.documentID;
                            currentMenuID   = menu.menuItemID;
                            break;
                        }
                    }
                    Type CAType = Type.GetType("CSLERP." + frmName);
                    currentFormDescription = formText;
                    try
                    {
                        FormCollection fc = Application.OpenForms;
                        foreach (Form frm in fc)
                        {
                            if (frm.Name.Equals(frmName))
                            {
                                frm.BringToFront();
                                frm.Focus();
                                return;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }

                    var  myObj  = Activator.CreateInstance(CAType);
                    Form myForm = (Form)myObj;
                    //-------
                    myForm.ControlBox  = false;
                    myForm.MinimizeBox = false;
                    myForm.MaximizeBox = false;
                    ////myForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                    myForm.FormBorderStyle = FormBorderStyle.Fixed3D;
                    myForm.Dock            = DockStyle.Fill;
                    ////this.FormBorderStyle = FormBorderStyle.None;
                    //-------
                    Label lblFormText   = new Label();
                    Label lblMenuItemID = new Label();
                    lblFormText.Text      = Main.currentFormDescription;
                    lblFormText.Size      = new Size(300, 20);
                    lblFormText.Font      = new Font("Arial", 10, FontStyle.Italic);
                    lblFormText.ForeColor = Color.Blue;
                    lblFormText.Location  = new Point(750, 520);
                    lblFormText.TextAlign = ContentAlignment.MiddleRight;
                    myForm.Controls["pnlUI"].Controls.Add(lblFormText);
                    myForm.Controls["pnlUI"].Controls.Add(lblMenuItemID);
                    lblFormText.Name      = "FormName";
                    lblFormText.Text      = formText.Trim();
                    lblMenuItemID.Name    = "MenuItemID";
                    lblMenuItemID.Text    = btn.Name.Substring(3).Trim();
                    lblMenuItemID.Visible = false;
                    //-------
                    Panel prPanel = Utilities.createProcessPanel();
                    try
                    {
                        myForm.Controls["pnlUI"].Controls.Add(prPanel);
                    }
                    catch (Exception ex)
                    {
                    }
                    //-------
                    this.IsMdiContainer           = true;
                    myForm.TopLevel               = false;
                    myForm.Text                   = btn.Text;
                    myForm.Size                   = new Size(1150, 635);
                    myForm.Controls["pnlUI"].Size = new Size(1100, 540);
                    //////myForm.Controls["pnlBottomActions"].Size = new Size(1100, 42);
                    pnlMainContent.Controls.Add(myForm);
                    myForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                    ////myForm.Dock = DockStyle.Fill;
                    myForm.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Main() : Error 5");
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Compares current version ot latest online version.
 /// > 0 - Current version is newer
 /// = 0 - Same version
 /// < 0 - A newer version available</summary>
 /// <returns></returns>
 public int CompareVersions()
 {
     return(CurrentVersion.CompareTo(LatestVersion));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Indicates if a new update is available.
 /// </summary>
 /// <returns>
 /// True if an update is available, or false if there is no update
 /// available.
 /// </returns>
 public bool IsUpdateAvailable()
 {
     return(CurrentVersion.CompareTo(LatestVersion) < 0);
 }
Exemplo n.º 11
0
 // > 0 - Newer version available
 // = 0 - Same version
 // < 0 - Current version is newer
 public int CompareVersions()
 {
     return(CurrentVersion.CompareTo(LatestStableRelease));
 }