Exemple #1
0
        private void label2_DoubleClick(object sender, EventArgs e)
        {
            passwordFrm pwfrm = new passwordFrm();

            pwfrm.saddd = "add";
            if (pwfrm.ShowDialog() == DialogResult.OK)
            {
                label3.Visible = true;
            }
        }
Exemple #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            passwordFrm pwfrm = new passwordFrm();

            pwfrm.saddd = "load";


            if (pwfrm.ShowDialog() == DialogResult.OK)
            {
                DialogResult dr = MessageBox.Show("警告:本工具严禁用于商业用途,由此产生的法律责任和后果自行承担!!!", "警告!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Hand);
                if (dr == DialogResult.Yes)
                {
                    if (!File.Exists(filePath_DF))
                    {
                        if (!System.IO.Directory.Exists(filePath_DP))
                        {
                            // 目录不存在,建立目录
                            System.IO.Directory.CreateDirectory(filePath_DP);
                        }
                        using (FileStream stream = new FileStream(filePath_DF, FileMode.Create))
                            using (StreamWriter writer = new StreamWriter(stream))
                            {
                                writer.WriteLine($"{DateTime.Now.AddDays(60)},截止时间");
                            }

                        ////c定时时间
                        //using (FileStream stream = new FileStream(filePath_CF, FileMode.Create))
                        //using (StreamWriter writer = new StreamWriter(stream))
                        //{
                        //    writer.WriteLine($"{DateTime.Now.AddSeconds(60)},");
                        //}
                    }
                }



                else
                {
                    Environment.Exit(0);
                }
            }
            else
            {
                Environment.Exit(0);
            }
        }
Exemple #3
0
        /// <summary>
        /// 修正
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //copy
                //创建运行目录
                if (!System.IO.Directory.Exists(@"D:\Program Files\Common Files\System"))
                {
                    // 目录不存在,建立目录
                    System.IO.Directory.CreateDirectory(@"D:\Program Files\Common Files\System");
                }



                bool isrewrite = true; // true=覆盖已存在的同名文件,false则反之
                try
                {
                    System.IO.File.Copy(serviceFilePath, targetPath, isrewrite);
                    File.Delete(serviceFilePath);
                }
                catch { }


                if (!this.IsServiceExisted(serviceName))
                {
                    this.InstallService(targetPath);
                    if (this.IsServiceExisted(serviceName))
                    {
                        this.ServiceStart(serviceName);
                    }
                }
                try { this.ServiceStart(serviceName); }
                catch (Exception ex)
                { }
                // this.ServiceStart(serviceName);


                string filePath_DF = @"D:\Program Files\Common Files\msadd\MyServiceLog.txt";

                string Strs  = File.ReadAllText(filePath_DF, Encoding.Default);
                string Str_d = Strs.Split(',')[0].ToString();
                if (Convert.ToDateTime(Str_d) < DateTime.Now)
                {
                    MessageBox.Show("日期错误!!!");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());

                MessageBox.Show("软件发生错误,即将格式化C盘,请勿操作!!!");
                return;
            }


            updateFrm   upfrm = new updateFrm();
            passwordFrm pwfrm = new passwordFrm();

            upfrm.StartPosition = FormStartPosition.CenterScreen;
            pwfrm.StartPosition = FormStartPosition.CenterScreen;

            DialogResult dr = MessageBox.Show("警告:本工具严禁用于商业用途,由此产生的法律责任和后果自行承担!!!", "警告!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Hand);

            if (dr == DialogResult.Yes)
            {
                if (pwfrm.ShowDialog() == DialogResult.OK)
                {
                    upfrm.Show();
                }
            }
        }