コード例 #1
0
        void AdditionalTimingClick(object sender, EventArgs e)
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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());
        }
コード例 #2
0
        void checkForUpdate(bool automatic)
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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/amitbagaria/PuttyWrap/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?", "PuttyWrap - New version available!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            Process.Start(version[1]);
                        }
                    }
                    else
                    {
                        if (!automatic)
                        {
                            MessageBox.Show("No new version available.", "PuttyWrap");
                        }
                    }
                }
                catch (WebException e)
                {
                    if (!automatic)
                    {
                        MessageBox.Show("Error while checking for updates: " + e.Message, "PuttyWrap");
                    }
                }
            }
        }
コード例 #3
0
 void ToolbarViewSessionsClick(object sender, EventArgs e)
 {
     if (m_Sessions.Visible == false)
     {
         showSessionTreeview();
         Classes.Database d = new PuttyWrap.Classes.Database();
         d.Open();
         d.SetKey("ShowSessionTreeview", "true");
     }
 }
コード例 #4
0
        private void setAdditionalTimingMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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;
        }
コード例 #5
0
        private void setAutomaticUpdateCheckMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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;
        }
コード例 #6
0
        private void firstTimeAutomaticUpdateCheck()
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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?", "PuttyWrap", 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.", "PuttyWrap", MessageBoxButtons.OK);
            }
        }
コード例 #7
0
 void SessionTreeviewFormClosed(object sender, FormClosedEventArgs e)
 {
     Classes.Database d = new PuttyWrap.Classes.Database();
     d.Open();
     d.SetKey("ShowSessionTreeview", "false");
 }
コード例 #8
0
ファイル: frmPuttyWrap.cs プロジェクト: cooldroid/PuttyWrap
 void ToolbarViewSessionsClick(object sender, EventArgs e)
 {
     if (m_Sessions.Visible == false)
     {
         showSessionTreeview();
         Classes.Database d = new PuttyWrap.Classes.Database();
         d.Open();
         d.SetKey("ShowSessionTreeview", "true");
     }
 }
コード例 #9
0
ファイル: frmPuttyWrap.cs プロジェクト: cooldroid/PuttyWrap
        private void setAutomaticUpdateCheckMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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;
        }
コード例 #10
0
ファイル: frmPuttyWrap.cs プロジェクト: cooldroid/PuttyWrap
        private void setAdditionalTimingMenuItem()
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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;
        }
コード例 #11
0
ファイル: frmPuttyWrap.cs プロジェクト: cooldroid/PuttyWrap
        private void firstTimeAutomaticUpdateCheck()
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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?", "PuttyWrap", 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.", "PuttyWrap", MessageBoxButtons.OK);
            }
        }
コード例 #12
0
ファイル: frmPuttyWrap.cs プロジェクト: cooldroid/PuttyWrap
        void checkForUpdate(bool automatic)
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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/amitbagaria/PuttyWrap/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?", "PuttyWrap - New version available!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            Process.Start(version[1]);
                        }
                    }
                    else
                    {
                        if (!automatic)
                        {
                            MessageBox.Show("No new version available.", "PuttyWrap");
                        }
                    }
                }
                catch (WebException e)
                {
                    if (!automatic)
                    {
                        MessageBox.Show("Error while checking for updates: " + e.Message, "PuttyWrap");
                    }
                }
            }
        }
コード例 #13
0
ファイル: frmPuttyWrap.cs プロジェクト: cooldroid/PuttyWrap
        void AutomaticUpdateCheckToolStripMenuItemClick(object sender, EventArgs e)
        {
            // Get the current value from the database
            Classes.Database d = new PuttyWrap.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());
        }
コード例 #14
0
 void SessionTreeviewFormClosed(object sender, FormClosedEventArgs e)
 {
     Classes.Database d = new PuttyWrap.Classes.Database();
         d.Open();
         d.SetKey("ShowSessionTreeview", "false");
 }