Exemplo n.º 1
0
        /// <summary>
        /// Checks version on server
        /// </summary>
        /// <returns></returns>
        public static bool check()
        {
            string s            = "";
            string localVersion = "";

            try
            {
                while (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
                {
                    System.Threading.Thread.Sleep(60000);
                }
                localVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
                WebClient w = new WebClient();
                s = w.DownloadString("http://asphysof.isp12.admintest.ru/version.txt");
                w.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            string[] q = s.Split('|');
            if (VersionChecker.NewVersionExists(localVersion, q[0]))
            {
                if (MessageBox.Show("New version " + q[0] + " exists! Download now?", "Sound Binder Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                    == DialogResult.Yes)
                {
                    load_obnovlenie(q[1]);
                }
            }
            else
            {
                MessageBox.Show("No new version", "Sound Binder Update", MessageBoxButtons.OK, MessageBoxIcon.Question);
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     VersionChecker.check();
 }