示例#1
0
文件: Main.cs 项目: grvpanchal/pcsm
 private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     PCS.process("blb\\bleachbit_console.exe", " --update-winapp2", true);
     PCS.process(Global.system + "blb\\bleachbit_console.exe", " --update-winapp2", true);
     if (PCS.CheckForInternetConnection() == true)
     {
         using (System.Net.WebClient myWebClient = new System.Net.WebClient())
         {
             myWebClient.DownloadFile("http://www.pcstarters.net/pcsm/update/downloadsettings.ini", "settings\\downloadsettingsnew.ini");
         }
     }
 }
示例#2
0
文件: Main.cs 项目: grvpanchal/pcsm
        public void check_update()
        {
            string checkforupdates = PCS.IniReadValue("main", "checkforupdates");
            string lastupdatecheck = PCS.IniReadValue("main", "lastupdatecheck");

            DateTime now = DateTime.Now;
            DateTime dt;

            if (DateTime.TryParseExact(lastupdatecheck, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
            {
            }
            else
            {
                dt = DateTime.Now;
                PCS.IniWriteValue("main", "lastupdatecheck", now.ToString("dd/MM/yyyy"));
            }
            //DateTime dt = DateTime.ParseExact(lastupdatecheck, "dd/MM/yyyy", CultureInfo.InvariantCulture);


            if (checkforupdates == "true" && (now - dt).TotalDays > 30)
            {
                if (PCS.CheckForInternetConnection() == true)
                {
                    using (System.Net.WebClient myWebClient = new System.Net.WebClient())
                    {
                        myWebClient.DownloadFile("http://www.pcstarters.net/pcsm/update/downloadsettings.ini", "settings\\downloadsettingsnew.ini");
                    }
                }

                string latestversion = PCS.IniReadValue("main", "version");


                if (Version != latestversion && PCS.CheckForInternetConnection() == true)
                {
                    PCS.IniWriteValue("main", "lastupdatecheck", now.ToString("dd/MM/yyyy"));

                    DialogResult dialogupdate = MessageBox.Show("Update Available! \n\nDo you want to download Performance Maintainer " + latestversion + " ?", "Performance Maintainer Update", MessageBoxButtons.YesNo);

                    if (dialogupdate == DialogResult.Yes)
                    {
                        string updatefile = PCS.IniReadValue("Main", "filename");
                        string updatelink = PCS.IniReadValue("Main", "link");

                        PCS.IniWriteValue("main", "filename", updatefile);
                        PCS.IniWriteValue("main", "link", updatelink);

                        Download     newupdate = new Download("main");
                        DialogResult dlg       = newupdate.ShowDialog(this);

                        if (dlg == DialogResult.OK && File.Exists(updatefile))
                        {
                            Process pcsmnew = new Process();
                            pcsmnew.StartInfo.FileName  = "pcsmnew.exe";
                            pcsmnew.StartInfo.Arguments = "";
                            pcsmnew.Start();
                            this.Close();
                        }
                    }
                }
            }
        }