static void Main() { string MName = Process.GetCurrentProcess().MainModule.ModuleName; string PName = Path.GetFileNameWithoutExtension(MName); Process[] myProcess = Process.GetProcessesByName(PName); if (myProcess.Length > 1) { if (Thread.CurrentThread.CurrentUICulture.ToString() == "zh-CN") { MessageBox.Show("Aurora侦测到本程式已经在运行,请勿重复打开。", "Aurora智能提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (Thread.CurrentThread.CurrentUICulture.ToString() == "zh-Hant") { MessageBox.Show("Aurora偵測到本程式已經在運行,請勿重複打開。", "Aurora智慧提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else //if (Thread.CurrentThread.CurrentUICulture.ToString() == "en") { MessageBox.Show("Aurora has detected this program is already running, please do not open again.", "Aurora Intelligent Tips", MessageBoxButtons.OK, MessageBoxIcon.Information); } } //是否可以打开新进程 else { //显示桌面提示 RegistryKey MyReg, RegReminder; MyReg = Registry.CurrentUser; try { RegReminder = MyReg.CreateSubKey("Software\\Aurora\\Reminder"); if (RegReminder.GetValue("ShowDesktopReminder").ToString() == "YES") { Type type = Type.GetTypeFromProgID("Shell.Application"); object instance = Activator.CreateInstance(type); type.InvokeMember("ToggleDesktop", BindingFlags.InvokeMethod, null, instance, null); } } catch { } if (File.Exists(Application.StartupPath + "\\Aurora_Splash.exe")) { System.Diagnostics.Process.Start("Aurora_Splash.exe"); } Thread.Sleep(2500); System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcesses(); foreach (System.Diagnostics.Process p in ps) { if (p.ProcessName == "Aurora_Splash") { p.Kill(); break; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new AuroraMain()); Application.Run(PublicClass.AuroraMain); } }
private void Locker_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Hide(); //隐藏鼠标 if (PublicClass.AuroraMain.WindowState != FormWindowState.Minimized) { this.Location = new Point(PublicClass.AuroraMain.Location.X, PublicClass.AuroraMain.Location.Y); this.Height = PublicClass.AuroraMain.Height; this.Width = PublicClass.AuroraMain.Width; } else { this.WindowState = FormWindowState.Minimized; } //是否全屏运行Locker RegistryKey MyReg, RegFullScreen; MyReg = Registry.CurrentUser; try { RegFullScreen = MyReg.CreateSubKey("Software\\Aurora\\Locker"); if (RegFullScreen.GetValue("FullScreen").ToString() == "YES") { this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; this.TopMost = true; } } catch { } }
private void button4_Click(object sender, EventArgs e) //Set Default Color { AuroraMain frm1 = (AuroraMain)this.Owner; RegistryKey MyReg, RegColor; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 RegColor = MyReg.CreateSubKey("Software\\Aurora\\Color"); //在注册表项中创建子项 try { MyColor = Color.GreenYellow; frm1.MyCellColor = MyColor; pictureBox1.BackColor = MyColor; RegColor.SetValue("CellColor", MyColor.ToArgb()); //把信息放进注册表,供主窗体调用 } catch { } }
private void button3_Click(object sender, EventArgs e) //Choose Color { ColorDialog MyDlg = new ColorDialog(); if (MyDlg.ShowDialog() == DialogResult.OK) { RegistryKey MyReg, RegColor; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 RegColor = MyReg.CreateSubKey("Software\\Aurora\\Color"); //在注册表项中创建子项 try { MyColor = MyDlg.Color; pictureBox1.BackColor = MyColor; RegColor.SetValue("CellColor", MyColor.ToArgb()); //把信息放进注册表,供主窗体调用 } catch { } } }
private void button5_Click(object sender, EventArgs e) //Set Default { AuroraMain frm1 = (AuroraMain)this.Owner; frm1.BackgroundImage = null; frm1.menuStrip1.BackgroundImage = null; frm1.toolStrip1.BackgroundImage = null; frm1.groupBox1.BackgroundImage = null; frm1.statusStrip1.BackgroundImage = null; RegistryKey MyReg, RegBKLocation; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 RegBKLocation = MyReg.CreateSubKey("Software\\Aurora\\Color"); //在注册表项中创建子项 try { RegBKLocation.SetValue("BKEnabled", "false"); } catch { } }
private void button6_Click(object sender, EventArgs e) //Choose Picture { AuroraMain frm1 = (AuroraMain)this.Owner; string fName = ""; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "JPG 文件交换格式(*.jpg;*.jpeg;*.jfif;*.jpe)|*.jpg;*.jpeg;*.jfif;*.jpe|可移植网络图形(*.png)|*.png|Windows 位图(*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Tag 图像文件格式(*.tif;*.tiff)|*.tif;*.tiff|Windows 图元文件(*.wmf)|*.wmf|内嵌的 PostScript(*.eps)|*.eps|Macintosh PICT(*.pct;*.pict)|*.pct;*.pict|WordPerfect 图形(*.wpg)|*.wpg|所有文件|*.*"; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == DialogResult.OK) { RegistryKey MyReg, RegBKLocation; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 RegBKLocation = MyReg.CreateSubKey("Software\\Aurora\\Color"); //在注册表项中创建子项 try { fName = openFileDialog.FileName; //File.Delete(Application.StartupPath + "\\BK.jpg"); frm1.BackgroundImage = Image.FromFile(fName); frm1.BackgroundImageLayout = ImageLayout.Tile; frm1.menuStrip1.BackgroundImage = Image.FromFile(fName); frm1.menuStrip1.BackgroundImageLayout = ImageLayout.Tile; frm1.toolStrip1.BackgroundImage = Image.FromFile(fName); frm1.toolStrip1.BackgroundImageLayout = ImageLayout.Tile; frm1.groupBox1.BackgroundImage = Image.FromFile(fName); frm1.groupBox1.BackgroundImageLayout = ImageLayout.Tile; frm1.statusStrip1.BackgroundImage = Image.FromFile(fName); frm1.statusStrip1.BackgroundImageLayout = ImageLayout.Tile; RegBKLocation.SetValue("BKEnabled", "true"); File.Copy(fName, Application.StartupPath + "\\BK1.jpg", true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else { return; } }
private void OneKClean() { try { switch (str) { case "清空回收站": SHEmptyRecycleBin(this.Handle, 0, 7); break; case "清空IE缓存区": string dir = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); DirectoryInfo mDi = new DirectoryInfo(dir); mDi.Delete(true); mDi.Create(); break; case "清空IE Cookies": string strx = Environment.GetFolderPath(Environment.SpecialFolder.Cookies); DirectoryInfo dix = new DirectoryInfo(strx); if (dix.Exists) { dix.Delete(true); dix.Create(); } break; case "清空Windows临时文件": string BufferStr = Environment.GetEnvironmentVariable("WinDir") + "\\Temp"; string BufferStr1 = Environment.GetEnvironmentVariable("TEMP"); DirectoryInfo di = new DirectoryInfo(BufferStr); DirectoryInfo di2 = new DirectoryInfo(BufferStr1); if (di.Exists) { di.Delete(true); di.Create(); } if (di2.Exists) { di2.Delete(true); di2.Create(); } break; case "清空打开的文件记录": string str1 = Environment.GetFolderPath(Environment.SpecialFolder.Recent); DirectoryInfo dii = new DirectoryInfo(str1); if (dii.Exists) { dii.Delete(true); dii.Create(); } break; case "清除IE地址栏中的历史网址": RegistryKey hklm = Registry.CurrentUser; RegistryKey software = hklm.OpenSubKey(@"Software\Microsoft\Internet Explorer", true); software.DeleteSubKeyTree("TypedURLs"); break; case "清除运行对话框": RegistryKey MyReg; MyReg = Registry.CurrentUser; MyReg = MyReg.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU"); string MyMRU = (String)MyReg.GetValue("MRULIST"); for (int i = 0; i < MyMRU.Length; i++) { MyReg.DeleteValue(MyMRU[i].ToString()); } MyReg.SetValue("MRUList", ""); MyReg.Close(); break; } } catch { return; } }
private void Setting_Load(object sender, EventArgs e) { label8.Visible = false; label9.Visible = false; textBox5.Visible = false; //默认数据保护锁的时间文本框不可见。 checkBox4.Visible = false; RegistryKey MyReg, RegProjectInfo; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 try { RegProjectInfo = MyReg.CreateSubKey("Software\\Aurora\\ProjectInfo");//在注册表项中创建子项 this.textBox1.Text = (RegProjectInfo.GetValue("ProjectName")).ToString(); this.textBox2.Text = (RegProjectInfo.GetValue("Calculator")).ToString(); this.textBox3.Text = (RegProjectInfo.GetValue("Checker")).ToString(); this.textBox4.Text = (RegProjectInfo.GetValue("MyGrade")).ToString(); } catch { } RegistryKey MyReg1, RegLocker; //声明注册表对象 MyReg1 = Registry.CurrentUser; //获取当前用户注册表项 try { RegLocker = MyReg.CreateSubKey("Software\\Aurora\\Locker");//在注册表项中创建子项 if ((RegLocker.GetValue("Enabled")).ToString() == "1") { checkBox1.Checked = true; } this.textBox5.Text = (RegLocker.GetValue("Timer")).ToString(); } catch { } //全屏保护提示 RegistryKey RegFullScreen; try { RegFullScreen = MyReg.CreateSubKey("Software\\Aurora\\Locker"); if (RegFullScreen.GetValue("FullScreen").ToString() == "YES") { checkBox4.Checked = true; } else { checkBox4.Checked = false; } } catch { } //读取单元格颜色 RegistryKey RegColor; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 try { RegColor = MyReg.CreateSubKey("Software\\Aurora\\Color"); //在注册表项中创建子项 pictureBox1.BackColor = ColorTranslator.FromHtml(RegColor.GetValue("CellColor").ToString()); //显示注册表的位置 } catch { } //显示桌面提示 RegistryKey RegReminder; try { RegReminder = MyReg.CreateSubKey("Software\\Aurora\\Reminder"); if (RegReminder.GetValue("ShowDesktopReminder").ToString() == "YES") { checkBox3.Checked = true; } else { checkBox3.Checked = false; } } catch { } //退出提示 try { RegReminder = MyReg.CreateSubKey("Software\\Aurora\\Reminder"); if (RegReminder.GetValue("ExitReminder").ToString() == "YES") { checkBox2.Checked = true; } else { checkBox2.Checked = false; } } catch { } }
private void button1_Click(object sender, EventArgs e) //确定 { string strProjectName = textBox1.Text; string strCalculator = textBox2.Text; string strChecker = textBox3.Text; string strMyGrade = textBox4.Text; AuroraMain frm1 = (AuroraMain)this.Owner; //往主窗体传送参数. frm1.MyCellColor = MyColor; frm1.strProjectName = strProjectName; frm1.strCalculator = strCalculator; frm1.strChecker = strChecker; frm1.strMyGrade = strMyGrade; RegistryKey MyReg, RegProjectInfo; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 RegProjectInfo = MyReg.CreateSubKey("Software\\Aurora\\ProjectInfo"); //在注册表项中创建子项 try { RegProjectInfo.SetValue("ProjectName", strProjectName); //把信息放进注册表,供主窗体调用 RegProjectInfo.SetValue("Calculator", strCalculator); RegProjectInfo.SetValue("Checker", strChecker); RegProjectInfo.SetValue("MyGrade", strMyGrade); } catch { } if (checkBox1.Checked == true) { frm1.nSCS = 1; //勾选数据保护,将全局变量设置为1.主窗体直接判断nSCS的值即可。 if (textBox5.Text != "") { if (textBox5.Text != "0") { if (Math.Abs(Convert.ToDouble(textBox5.Text)) < 1) { MessageBox.Show("请输入大于1的整数时间。", "Aurora智能提示"); return; } frm1.nTimer = Convert.ToInt16(Math.Round(Math.Abs(Convert.ToDouble(textBox5.Text)))); //防止哪个~~~2B~~~输入负数,所以取绝对值。 RegistryKey MyReg1, RegLocker; //声明注册表对象 MyReg1 = Registry.CurrentUser; //获取当前用户注册表项 RegLocker = MyReg1.CreateSubKey("Software\\Aurora\\Locker"); //在注册表项中创建子项 try { RegLocker.SetValue("Enabled", frm1.nSCS.ToString()); //把信息放进注册表,供主窗体调用 RegLocker.SetValue("Timer", frm1.nTimer.ToString()); } catch { } } else { MessageBox.Show("时间输入0无效。", "Aurora智能提示"); return; } } else { MessageBox.Show("您已开启智能保护锁,但是忘记了输入启动时间。", "Aurora智能提示"); return; } } else { frm1.nSCS = 0; RegistryKey MyReg1, RegLocker; //声明注册表对象 MyReg1 = Registry.CurrentUser; //获取当前用户注册表项 RegLocker = MyReg1.CreateSubKey("Software\\Aurora\\Locker"); //在注册表项中创建子项 try { RegLocker.SetValue("Enabled", frm1.nSCS.ToString()); //把信息放进注册表,供主窗体调用 RegLocker.SetValue("Timer", frm1.nTimer.ToString()); } catch { } } if (checkBox3.Checked == true) //显示桌面提示 { RegistryKey MyReg1, RegReminder; MyReg1 = Registry.CurrentUser; RegReminder = MyReg1.CreateSubKey("Software\\Aurora\\Reminder"); try { RegReminder.SetValue("ShowDesktopReminder", "YES"); } catch { } } else { RegistryKey MyReg1, RegReminder; MyReg1 = Registry.CurrentUser; RegReminder = MyReg1.CreateSubKey("Software\\Aurora\\Reminder"); try { RegReminder.SetValue("ShowDesktopReminder", "NO"); } catch { } } if (checkBox2.Checked == true) //退出提示 { RegistryKey MyReg1, RegReminder; MyReg1 = Registry.CurrentUser; RegReminder = MyReg1.CreateSubKey("Software\\Aurora\\Reminder"); try { RegReminder.SetValue("ExitReminder", "YES"); } catch { } } else { RegistryKey MyReg1, RegReminder; MyReg1 = Registry.CurrentUser; RegReminder = MyReg1.CreateSubKey("Software\\Aurora\\Reminder"); try { RegReminder.SetValue("ExitReminder", "NO"); } catch { } } if (checkBox4.Checked == true) //全屏运行提示 { RegistryKey MyReg1, RegFullScreen; MyReg1 = Registry.CurrentUser; RegFullScreen = MyReg1.CreateSubKey("Software\\Aurora\\Locker"); try { RegFullScreen.SetValue("FullScreen", "YES"); } catch { } } else { RegistryKey MyReg1, RegFullScreen; MyReg1 = Registry.CurrentUser; RegFullScreen = MyReg1.CreateSubKey("Software\\Aurora\\Locker"); try { RegFullScreen.SetValue("FullScreen", "NO"); } catch { } } this.Close(); }
private void button1_Click(object sender, EventArgs e) { DialogResult dr = DialogResult.Yes; dr = MessageBox.Show("确定要重置注册表?", "Aurora智能提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) { return; } strRC = CreateSNCode(); strInputKC = textBox1.Text; if (checkBox1.Checked == true) { strEnctr = EnText(strRC, DateTime.Now.Date.ToString("yyyy-MM-dd") + "hupo"); //学生版 if (transform(strEnctr, DateTime.Now.Date.ToString("yyyy-MM-dd") + "hupo") == strInputKC) { //调用外部程序导cmd命令行,实际上没Diao用 Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.CreateNoWindow = false; p.Start(); //向cmd.exe输入command p.StandardInput.WriteLine("ipconfig"); p.StandardInput.WriteLine("exit"); //需要有这句,不然程序会挂机 RegistryKey MyReg, RegGUIDType, RegType, RegValidGUIDDays, RegValidDays, RegSuccess, RegCodeAllow, RegStartGUIDDate, RegStartDate; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 try { RegGUIDType = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");//在注册表项中创建子项 RegType = MyReg.CreateSubKey("Software\\Aurora"); RegValidGUIDDays = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegValidDays = MyReg.CreateSubKey("Software\\Aurora"); RegCodeAllow = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegSuccess = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegStartGUIDDate = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegStartDate = MyReg.CreateSubKey("Software\\Aurora"); RegType.SetValue("nRegFlag", "0"); RegValidDays.SetValue("nValidDays", "10"); //重置为初始 RegGUIDType.SetValue("nRegGUIDFlag", "0"); RegValidGUIDDays.SetValue("nValidGUIDDays", "10"); RegCodeAllow.SetValue("RegCodeAllow", "1"); RegSuccess.SetValue("RegSuccess", "false"); RegStartGUIDDate.SetValue("StartGUIDDate", DateTime.Now.ToString("yyyy-MM-dd")); RegStartDate.SetValue("StartDate", DateTime.Now.ToString("yyyy-MM-dd")); label1.Visible = true; label1.Text = "注册表信息已成功恢复初始设置,重启Aurora生效。"; label1.TextAlign = ContentAlignment.MiddleCenter; label1.ForeColor = Color.LawnGreen; } catch { } } else { label1.Visible = true; label1.Text = " 注册码输入错误。"; label1.TextAlign = ContentAlignment.MiddleCenter; label1.ForeColor = Color.Red; } } else { strEnctr = EnText(strRC, "ilovetangwei"); //商业版 if (transform(strEnctr, "ilovetangwei") == strInputKC) { //调用外部程序导cmd命令行,实际上没Diao用 Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.CreateNoWindow = false; p.Start(); //向cmd.exe输入command p.StandardInput.WriteLine("ipconfig"); p.StandardInput.WriteLine("exit"); //需要有这句,不然程序会挂机 RegistryKey MyReg, RegGUIDType, RegType, RegValidGUIDDays, RegValidDays, RegSuccess, RegCodeAllow, RegStartGUIDDate, RegStartDate; //声明注册表对象 MyReg = Registry.CurrentUser; //获取当前用户注册表项 try { RegGUIDType = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");//在注册表项中创建子项 RegType = MyReg.CreateSubKey("Software\\Aurora"); RegValidGUIDDays = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegValidDays = MyReg.CreateSubKey("Software\\Aurora"); RegCodeAllow = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegSuccess = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegStartGUIDDate = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}"); RegStartDate = MyReg.CreateSubKey("Software\\Aurora"); RegType.SetValue("nRegFlag", "0"); RegValidDays.SetValue("nValidDays", "10"); //重置为初始 RegGUIDType.SetValue("nRegGUIDFlag", "0"); RegValidGUIDDays.SetValue("nValidGUIDDays", "10"); RegCodeAllow.SetValue("RegCodeAllow", "1"); RegSuccess.SetValue("RegSuccess", "false"); RegStartGUIDDate.SetValue("StartGUIDDate", DateTime.Now.ToString("yyyy-MM-dd")); RegStartDate.SetValue("StartDate", DateTime.Now.ToString("yyyy-MM-dd")); label1.Visible = true; label1.Text = "注册表信息已成功恢复初始设置,重启Aurora生效。"; label1.ForeColor = Color.LawnGreen; } catch { } } else { label1.Visible = true; label1.Text = " 注册码输入错误。"; label1.ForeColor = Color.Red; } } }