Exemple #1
0
        void AdditionalTimingClick(object sender, EventArgs e)
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "additional_timing";
            bool   val = false;

            val = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // If the value is true, then set it to false and uncheck menu item,
            // else, set it to true.
            if (val)
            {
                val = false;
            }
            else
            {
                val = true;
            }

            // Set the menu item check state.
            this.additionalTiming.Checked = val;

            // Update the database
            d.SetKey(key, val.ToString());
        }
Exemple #2
0
        void checkForUpdate(bool automatic)
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key          = "automatic_update_check";
            bool   performCheck = false;

            performCheck = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // Check to see if we should even perform a check
            if (performCheck && automatic)
            {
                try
                {
                    string url  = "https://github.com/phendryx/superputty/raw/master/VERSION";
                    string text = "";
                    using (WebClient client = new WebClient())
                    {
                        text = client.DownloadString(url);
                    }

                    string[] version = System.Text.RegularExpressions.Regex.Split(text, @"\|");

                    string   thisVersion = "";
                    object[] attrs       = System.Reflection.Assembly.GetEntryAssembly().GetCustomAttributes(true);
                    foreach (object o in attrs)
                    {
                        if (o.GetType() == typeof(System.Reflection.AssemblyFileVersionAttribute))
                        {
                            thisVersion = ((System.Reflection.AssemblyFileVersionAttribute)o).Version;
                        }
                    }

                    if (thisVersion != version[0])
                    {
                        if (MessageBox.Show("There is a new version available. Would you like to open the dicussion page to download it?", "SuperPutty - New version available!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            Process.Start(version[1]);
                        }
                    }
                    else
                    {
                        if (!automatic)
                        {
                            MessageBox.Show("No new version available.", "SuperPutty");
                        }
                    }
                }
                catch (WebException e)
                {
                    if (!automatic)
                    {
                        MessageBox.Show("Error while checking for updates: " + e.Message, "SuperPutty");
                    }
                }
            }
        }
Exemple #3
0
 void ToolbarViewSessionsClick(object sender, EventArgs e)
 {
     if (m_Sessions.Visible == false)
     {
         showSessionTreeview();
         Classes.Database d = new SuperPutty.Classes.Database();
         d.Open();
         d.SetKey("ShowSessionTreeview", "true");
     }
 }
Exemple #4
0
        private void setAdditionalTimingMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "additional_timing";
            bool   val = false;

            val = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // Set the checked property
            this.additionalTiming.Checked = val;
        }
Exemple #5
0
        private void setAutomaticUpdateCheckMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "automatic_update_check";
            bool   val = false;

            val = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // Set the checked property
            this.automaticUpdateCheckToolStripMenuItem.Checked = val;
        }
Exemple #6
0
        private void firstTimeAutomaticUpdateCheck()
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "automatic_update_check";
            string val = d.GetKey(key);

            // If the value hasnt been set, then the user has not chosen.
            if (val == "")
            {
                bool enabled = false;
                if (MessageBox.Show("Do you wish to enable automatic update checks?", "SuperPutty", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    enabled = true;
                }

                // Store the users decision
                d.SetKey(key, enabled.ToString());

                MessageBox.Show("You may enable/disable automatic update checks by navigating to the File->Settings menu.", "SuperPutty", MessageBoxButtons.OK);
            }
        }
 void SessionTreeviewFormClosed(object sender, FormClosedEventArgs e)
 {
     Classes.Database d = new SuperPutty.Classes.Database();
         d.Open();
         d.SetKey("ShowSessionTreeview", "false");
 }
        private void setAutomaticUpdateCheckMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "automatic_update_check";
            bool val = false;
            val = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // Set the checked property
            this.automaticUpdateCheckToolStripMenuItem.Checked = val;
        }
 void ToolbarViewSessionsClick(object sender, EventArgs e)
 {
     if (m_Sessions.Visible == false)
     {
         showSessionTreeview();
         Classes.Database d = new SuperPutty.Classes.Database();
         d.Open();
         d.SetKey("ShowSessionTreeview", "true");
     }
 }
Exemple #10
0
        private void setAdditionalTimingMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "additional_timing";
            bool val = false;
            val = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // Set the checked property
            this.additionalTiming.Checked = val;
        }
Exemple #11
0
        private void firstTimeAutomaticUpdateCheck()
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "automatic_update_check";
            string val = d.GetKey(key);

            // If the value hasnt been set, then the user has not chosen.
            if (val == "")
            {
                bool enabled = false;
                if (MessageBox.Show("Do you wish to enable automatic update checks?", "SuperPutty", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    enabled = true;
                }

                // Store the users decision
                d.SetKey(key, enabled.ToString());

                MessageBox.Show("You may enable/disable automatic update checks by navigating to the File->Settings menu.", "SuperPutty", MessageBoxButtons.OK);
            }
        }
Exemple #12
0
        void checkForUpdate(bool automatic)
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "automatic_update_check";
            bool performCheck = false;
            performCheck = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // Check to see if we should even perform a check
            if (performCheck && automatic)
            {
                try
                {
                    string url = "https://github.com/phendryx/superputty/raw/master/VERSION";
                    string text = "";
                    using (WebClient client = new WebClient())
                    {
                        text = client.DownloadString(url);
                    }

                    string[] version = System.Text.RegularExpressions.Regex.Split(text, @"\|");

                    string thisVersion = "";
                    object[] attrs = System.Reflection.Assembly.GetEntryAssembly().GetCustomAttributes(true);
                    foreach (object o in attrs)
                    {
                        if (o.GetType() == typeof(System.Reflection.AssemblyFileVersionAttribute))
                        {
                            thisVersion = ((System.Reflection.AssemblyFileVersionAttribute)o).Version;
                        }
                    }

                    if (thisVersion != version[0])
                    {
                        if (MessageBox.Show("There is a new version available. Would you like to open the dicussion page to download it?", "SuperPutty - New version available!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            Process.Start(version[1]);
                        }
                    }
                    else
                    {
                        if (!automatic)
                        {
                            MessageBox.Show("No new version available.", "SuperPutty");
                        }
                    }
                }
                catch (WebException e)
                {
                    if (!automatic)
                    {
                        MessageBox.Show("Error while checking for updates: " + e.Message, "SuperPutty");
                    }
                }
            }
        }
Exemple #13
0
        void AutomaticUpdateCheckToolStripMenuItemClick(object sender, EventArgs e)
        {
            // Get the current value from the database
            Classes.Database d = new SuperPutty.Classes.Database();
            d.Open();
            string key = "automatic_update_check";
            bool val = false;
            val = d.GetKey(key) == "" ? false : bool.Parse(d.GetKey(key));

            // If the value is true, then set it to false and uncheck menu item,
            // else, set it to true.
            if (val)
            {
                val = false;
            }
            else
            {
                val = true;
            }

            // Set the menu item check state.
            this.automaticUpdateCheckToolStripMenuItem.Checked = val;

            // Update the database
            d.SetKey(key, val.ToString());
        }
Exemple #14
0
 void SessionTreeviewFormClosed(object sender, FormClosedEventArgs e)
 {
     Classes.Database d = new SuperPutty.Classes.Database();
     d.Open();
     d.SetKey("ShowSessionTreeview", "false");
 }