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 { }
        }
Esempio n. 2
0
        private void btnListAll_Click(object sender, EventArgs e)
        {
            if (!ValidarCampos())
            {
                return;
            }

            BeginProcess(sender);

            tsLabel.Text = "Starting processing...";
            this.Refresh();

            RepoBusiness gb = new RepoBusiness(txtPasta.Text, 0);

            gb.ListAll();

            MyReg.Write("PastaVerifica", txtPasta.Text);

            if (chkSendByEmail.Checked)
            {
                SendToEmail("All Repositories List");
            }

            EndProcess(sender);
        }
Esempio n. 3
0
        private void SendToEmail(string subject)
        {
            var emailFrom = string.IsNullOrEmpty(MyReg.Read("EmailFrom")) ? string.Empty : MyReg.Read("EmailFrom");

            using (SimpleLogin frm = new SimpleLogin(Application.ProductName, emailFrom))
            {
                var result = frm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    BaseEmail email = new BaseEmail(frm.Login, "smtp.gmail.com", "587", frm.Pwd);

                    try
                    {
                        List <string> values = new List <string>();

                        foreach (object o in lbLog.Items)
                        {
                            values.Add(o.ToString());
                        }

                        string selectedItems = String.Join("\n", values);

                        email.SendMessage(subject, selectedItems, "*****@*****.**");

                        MyReg.Write("EmailFrom", frm.Login);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Sending email error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
        //Нажатие на кнопку "Открыть ранее закрытый файл"
        private void button4_Click(object sender, EventArgs e)
        {
            Form1.filename = Environment.CurrentDirectory + "\\" + "Cars\\" + MyReg.ValueGet();
            Form1.list     = MySerial <List <CarClass> > .Deserialize(Form1.filename);

            Close();
        }
Esempio n. 5
0
        private void btn_saveVal_Click(object sender, EventArgs e)
        {//Aplica el nuevo valor a la configuración
            if (dgv_values.SelectedRows.Count < 1)
            {
                return;
            }
            DataGridViewRow dRowLoc = dgv_values.SelectedRows[0];

            string     RootKey    = dRowLoc.Cells["txt_KeyRoot"].Value.ToString();
            ROOT_KEY   RootKeyR   = MyReg.cad(RootKey);
            string     SubKey     = dRowLoc.Cells["txt_SubKey"].Value.ToString();
            string     KeyName    = dRowLoc.Cells["txt_Name"].Value.ToString();
            string     Type       = dRowLoc.Cells["txt_Type"].Value.ToString();
            VALUE_TYPE TypeR      = MyReg.tip(Type);
            string     currentVal = txt_valueVal.Text.Trim();

            bool ModuleReg = MyReg.exist(RootKeyR, SubKey, "");

            if (ModuleReg == false)
            {
                ModuleReg = MyReg.newKey(RootKeyR, SubKey);
            }

            object objIn = new object();

            objIn     = currentVal;
            ModuleReg = MyReg.setValue(RootKeyR, SubKey, KeyName, ref objIn, TypeR);
            if (ModuleReg)
            {
                dRowLoc.Cells["txt_Data"].Value = currentVal;
            }
        }
Esempio n. 6
0
        private void btn_go_Click(object sender, EventArgs e)
        {//Busca una ruta
            string[] SubKeys = txt_addr.Text.Split('\\');
            if (SubKeys.Length < 2)
            {
                return;
            }

            bool found = true, createKeys = false;

            //Expande la ruta buscada ---------------------------------------
            tView_reg.SelectedNode = tView_reg.Nodes[0];
            tView_reg.SelectedNode.Expand();

            foreach (string SubKey1 in SubKeys)
            {
                if (list.expandT(tView_reg, SubKey1) == false)
                {
                    found = false;
                    break;
                } //break end(0)
            }
            //---------------------------------------------------------------
            if (found == false)
            {
                DialogResult result = MessageBox.Show(
                    "¿Desea crearlas?", "Sub llaves no encontradas",
                    MessageBoxButtons.YesNo);

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    string SubKeyL = "";
                    for (int i = 1; i < SubKeys.Length; i++)
                    {
                        SubKeyL += SubKeys[i] + "\\";
                    }

                    SubKeyL = SubKeyL.Substring(0, SubKeyL.Length - 1);

                    createKeys = MyReg.newKey(
                        MyReg.cad(SubKeys[0]), SubKeyL);
                }
            }
            //Expande la ruta buscada ---------------------------------------
            if (createKeys)
            {
                tView_reg.CollapseAll();
                tView_reg.SelectedNode = tView_reg.Nodes[0];
                tView_reg.SelectedNode.Expand();

                foreach (string SubKey1 in SubKeys)
                {
                    if (list.expandT(tView_reg, SubKey1) == false)
                    {
                        break;
                    } //break end(0)
                }
            }
            //---------------------------------------------------------------
        }
        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);
            }
        }
Esempio n. 8
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form1.filename = Environment.CurrentDirectory + "\\" + "Team\\" + MyReg.ValueGet();
            Form1.List     = MySerial <List <WorldCup2018> > .Deserialize(Form1.filename);

            Form1.FlagCheck = false;
            Close();
        }
Esempio n. 9
0
 //Обработка события закрытия формы
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     SaveFile();
     if (filename != "")
     {
         MyReg.ValueSet(filename.Substring(filename.LastIndexOf("\\") + 1));
     }
 }
Esempio n. 10
0
        private void cargarSubNivel(ref TreeNode RootKeyNode, ROOT_KEY RootKey, string SubKey)
        {
            System.Collections.ArrayList arrayL = new System.Collections.ArrayList();
            bool ModuleReg = MyReg.EnumKeys(RootKey, SubKey, ref arrayL);

            foreach (string item in arrayL)
            {
                RootKeyNode.Nodes.Add(item, item);
            }
        }
Esempio n. 11
0
        private void FrmSourceManager_Load(object sender, EventArgs e)
        {
            txtPasta.Text = MyReg.Read("PastaVerifica");
            this.Text     = Application.ProductName + " - "
                            + Application.CompanyName
                            + "          Version: " + Application.ProductVersion;

            MyForm.FormName    = "FrmMain";
            MyForm.ListBoxName = "lbLog";
            BeginProcess();
            EndProcess();
        }
Esempio n. 12
0
        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 { }
        }
Esempio n. 13
0
        /*private void test()
         * {//Realiza pruebas de desempeño y generales
         *  bool ModuleReg = MyReg.exist(ROOT_KEY.HKEY_LOCAL_MACHINE, "SOFTWARE\\ModuleReg", "");
         *  if (ModuleReg == false) ModuleReg = MyReg.newKey(ROOT_KEY.HKEY_LOCAL_MACHINE, "SOFTWARE\\ModuleReg");
         *
         *  object objIn = int.MaxValue; //int.MaxValue = 2147483647
         *  ModuleReg = MyReg.setValue(ROOT_KEY.HKEY_LOCAL_MACHINE, "SOFTWARE\\ModuleReg", "Test", ref objIn, VALUE_TYPE.REG_DWORD);
         *  Console.WriteLine("Prueba de velocidad en lectura de valores REG_DWORD 50k");
         *  myTestGetValue("SOFTWARE\\ModuleReg", "Test");
         *
         *  objIn = "Cadena de texto";
         *  ModuleReg = MyReg.setValue(ROOT_KEY.HKEY_LOCAL_MACHINE, "SOFTWARE\\ModuleReg", "Test", ref objIn, VALUE_TYPE.REG_SZ);
         *  Console.WriteLine("Prueba de velocidad en lectura de valores REG_SZ 50k");
         *  myTestGetValue("SOFTWARE\\ModuleReg", "Test");
         *
         *  Console.WriteLine("Prueba de velocidad en enumeracion de keys 10k");
         *  testEnumKeys();
         *
         *  Console.WriteLine("Prueba de velocidad en enumeracion de valores 10k");
         *  testEnumValues();
         *
         *  MyReg.allTest(false);
         * }
         * private void myTestGetValue(string SubKey, string Name)
         * {
         *  double mT = 0;
         *  int i = 0, limit = 50000;
         *  object objOut = new object();
         *  bool ModuleReg = false;
         *
         *  cClock.Start();
         *  do
         *  {
         *      ModuleReg = MyReg.getValue(ROOT_KEY.HKEY_LOCAL_MACHINE,
         *      SubKey, Name, ref objOut);
         *      if (ModuleReg == false) Console.WriteLine("1 Error de lectura");
         *      i++;
         *  } while (i < limit);
         *  mT = cClock.Elapsed() / 1000;
         *  Console.WriteLine("API: " + mT.ToString("#.######"));
         *
         *  i = 0;
         *  cClock.Start();
         *  do
         *  {
         *      Registry.GetValue("HKEY_LOCAL_MACHINE\\" + SubKey, Name, objOut);
         *      i++;
         *  } while (i < limit);
         *  mT = cClock.Elapsed() / 1000;
         *  Console.WriteLine(".Net: " + mT.ToString("#.######"));
         * }
         * private void testEnumKeys()
         * {
         *  double mT = 0;
         *  bool ModuleReg = false;
         *  int i = 0, limit = 10000;
         *  System.Collections.ArrayList arrayL = new System.Collections.ArrayList();
         *
         *  cClock.Start();
         *  do
         *  {
         *      ModuleReg = MyReg.EnumKeys(ROOT_KEY.HKEY_LOCAL_MACHINE, "SOFTWARE", ref arrayL);
         *      if (arrayL.Count == 0) Console.WriteLine("1 Error de lectura");
         *      i++;
         *  } while (i < limit);
         *  mT = cClock.Elapsed() / 1000;
         *  Console.WriteLine("API: " + mT.ToString("#.######"));
         *
         *  i = 0;
         *  cClock.Start();
         *  RegistryKey rkey = Registry.LocalMachine;
         *  do
         *  {
         *      RegistryKey rkey2 = rkey.OpenSubKey("SOFTWARE");
         *      rkey2.GetSubKeyNames();
         *      rkey2.Close();
         *      i++;
         *  } while (i < limit);
         *  rkey.Close();
         *  mT = cClock.Elapsed() / 1000;
         *  Console.WriteLine(".Net: " + mT.ToString("#.######"));
         * }
         * private void testEnumValues()
         * {
         *  double mT = 0;
         *  bool ModuleReg = false;
         *  int i = 0, limit = 10000;
         *  System.Collections.ArrayList arrayL = new System.Collections.ArrayList();
         *
         *  cClock.Start();
         *  do
         *  {
         *      ModuleReg = MyReg.EnumRegs(ROOT_KEY.HKEY_LOCAL_MACHINE, "SOFTWARE", ref arrayL);
         *      if (ModuleReg == false) Console.WriteLine("1 Error de lectura");
         *      i++;
         *  } while (i < limit);
         *  mT = cClock.Elapsed() / 1000;
         *  Console.WriteLine("API: " + mT.ToString("#.######"));
         *
         *  mT = 0;
         *  i = 0;
         *  // start timer
         *  cClock.Start();
         *  RegistryKey rkey = Registry.LocalMachine;
         *  do
         *  {
         *      RegistryKey rkey2 = rkey.OpenSubKey("SOFTWARE");
         *      rkey2.GetValueNames();
         *      rkey2.Close();
         *      i++;
         *  } while (i < limit);
         *  rkey.Close();
         *  mT = cClock.Elapsed() / 1000;
         *  Console.WriteLine(".Net: " + mT.ToString("#.######"));
         * }*/
        #endregion


        #region Exploracion (tView_reg y dgv_values)
        private void tView_reg_AfterExpand(object sender, TreeViewEventArgs e)
        {//Enumero las sub sub llaves, antes de expandir.
            string[] fullPath = e.Node.FullPath.Split('\\');
            if (fullPath.Length < 2)
            {
                return;
            }
            int removeLen = fullPath[0].Length + fullPath[1].Length + 2;

            foreach (TreeNode thisNode in e.Node.Nodes)
            {
                TreeNode iNode = thisNode;
                string   iPath = thisNode.FullPath.Substring(removeLen);
                System.Collections.ArrayList arrayL = new System.Collections.ArrayList();
                cargarSubNivel(ref iNode, MyReg.cad(fullPath[1]), iPath);
            }
        }
Esempio n. 14
0
        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 { }
            }
        }
Esempio n. 15
0
        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 { }
        }
Esempio n. 16
0
        private void btnListBlocked_Click(object sender, EventArgs e)
        {
            if (!ValidarCampos())
            {
                return;
            }

            BeginProcess(sender);

            tsLabel.Text = "Starting processing...";
            this.Refresh();

            RepoBusiness gb = new RepoBusiness(txtPasta.Text, 0);

            gb.ListBlocked();

            MyReg.Write("PastaVerifica", txtPasta.Text);

            EndProcess(sender);
        }
Esempio n. 17
0
        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;
            }
        }
Esempio n. 18
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (FlagCheck == true)
            {
                DialogResult result = MessageBox.Show(
                    "Вы хотите сохранить изменения?",
                    "Подтвердить действие",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    SaveMetodFile();
                }
            }
            if (filename == null)
            {
                return;
            }
            if (filename != "")
            {
                MyReg.ValueSet(filename.Substring(filename.LastIndexOf("\\") + 1));
            }
        }
Esempio n. 19
0
        private void tView_reg_AfterSelect(object sender, TreeViewEventArgs e)
        {//Al seleccionar un nodo/key
            string[] fullPath = e.Node.FullPath.Split('\\');
            if (fullPath.Length <= 1)
            {
                return;
            }

            //Escribo la ruta del nodo
            int removeLen = fullPath[0].Length + 1;

            txt_addr.Text = e.Node.FullPath.Substring(removeLen);

            if (fullPath.Length <= 2)
            {
                return;
            }
            //Enumero los valores
            removeLen += fullPath[1].Length + 1;
            ROOT_KEY root  = MyReg.cad(fullPath[1]);
            string   iPath = e.Node.FullPath.Substring(removeLen);

            System.Collections.ArrayList arrayL = new System.Collections.ArrayList();
            bool ModuleReg = MyReg.EnumRegs(root, iPath, ref arrayL);

            dtNavVal.Rows.Clear();
            object obj = new object();

            foreach (string item in arrayL)
            {
                if (item == "")
                {
                    continue;
                }

                VALUE_TYPE type = VALUE_TYPE.REG_DWORD;
                MyReg.getValue(root, iPath, item, ref obj, ref type);


                DataTable dtDesc      = new DataTable();
                String    querySelect = "SELECT * FROM Valores " +
                                        " WHERE RootKey='" + fullPath[1] +
                                        "' AND SubKey='" + iPath +
                                        "' AND Name='" + item + "'";

                dbConexionAccess.Open();
                OleDbCommand     sCommand = new OleDbCommand(querySelect, dbConexionAccess);
                OleDbDataAdapter sAdapter = new OleDbDataAdapter(sCommand);
                sAdapter.Fill(dtDesc);
                dbConexionAccess.Close();


                DataRow dRow = dtNavVal.NewRow();

                dRow["RootKey"] = fullPath[1];
                dRow["SubKey"]  = iPath;
                dRow["Name"]    = item;
                dRow["Type"]    = type.ToString();
                dRow["Value"]   = (obj == null) ? "" : obj.ToString();

                if (dtDesc.Rows.Count > 0)
                {
                    dRow["Value Optimal"] = dtDesc.Rows[0]["Value Optimal"].ToString();
                    dRow["Kind"]          = dtDesc.Rows[0]["Kind"].ToString();
                    dRow["Description"]   = dtDesc.Rows[0]["Description"].ToString();
                    dRow["Version"]       = dtDesc.Rows[0]["Version"].ToString();
                    dRow["dangerous"]     = dtDesc.Rows[0]["dangerous"].ToString();
                    dRow["registry"]      = dtDesc.Rows[0]["registry"].ToString();
                }

                dtNavVal.Rows.Add(dRow);


                DataGridViewRow sRow = dgv_values.Rows[dgv_values.Rows.Count - 1];
                sRow.Cells[0].Value = (type == VALUE_TYPE.REG_SZ ||
                                       type == VALUE_TYPE.REG_MULTI_SZ ||
                                       type == VALUE_TYPE.REG_EXPAND_SZ) ? imgL.Images[2]:imgL.Images[3];

                if (dtDesc.Rows.Count > 0)
                {
                    sRow.DefaultCellStyle.ForeColor = System.Drawing.Color.FromArgb(0, 5, 5, 210);
                }
            }
        }
        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;
                }
            }
        }
Esempio n. 21
0
        private void Pre_load_Load(object sender, EventArgs e)
        {
            if (Directory.GetFiles(Environment.CurrentDirectory + "\\" + "Cars\\").Length == 0)
            {
                button1.Enabled = false;
            }

            if (Directory.GetFiles(Environment.CurrentDirectory + "\\" + "Cars\\").Contains(Environment.CurrentDirectory + "\\" + "Cars\\" + MyReg.ValueGet()))
            {
                button4.Enabled = true;
            }
            else
            {
                button4.Enabled = false;
            }
        }
        /// <summary> Determines if this user can edit this item, based on several different criteria </summary>
        /// <param name="Item">SobekCM Item to check</param>
        /// <returns>TRUE if the user can edit this item, otherwise FALSE</returns>
        public bool Can_Edit_This_Item(SobekCM_Item Item)
        {
            if (!SobekCM_Library_Settings.Online_Edit_Submit_Enabled)
            {
                return(false);
            }

            if (Item.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Project)
            {
                return(Is_Portal_Admin);
            }

            if ((Is_Portal_Admin) || (Is_System_Admin))
            {
                return(true);
            }

            if (bibids.Contains(Item.BibID.ToUpper()))
            {
                return(true);
            }

            if (aggregations.Can_Edit("i" + Item.Bib_Info.Source.Code.ToUpper()))
            {
                return(true);
            }

            if (Item.Bib_Info.hasLocationInformation)
            {
                if (aggregations.Can_Edit("i" + Item.Bib_Info.Location.Holding_Code.ToUpper()))
                {
                    return(true);
                }
            }

            if (Item.Behaviors.Aggregation_Count > 0)
            {
                ReadOnlyCollection <Aggregation_Info> colls = Item.Behaviors.Aggregations;
                if (colls.Any(ThisCollection => aggregations.Can_Edit(ThisCollection.Code.ToUpper())))
                {
                    return(true);
                }
            }

            return(editableRegexes.Select(RegexString => new Regex(RegexString)).Any(MyReg => MyReg.IsMatch(Item.BibID.ToUpper())));
        }
Esempio n. 23
0
        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;
            }
        }
Esempio n. 24
0
 private void QueType_Load(object sender, EventArgs e)
 {
     if (Registration.CheckReg == true)
     {
         button1.Enabled = false;
     }
     if (Directory.GetFiles(Environment.CurrentDirectory + "\\" + "Team\\").Contains(Environment.CurrentDirectory + "\\" + "Team\\" + MyReg.ValueGet()))
     {
         button4.Enabled = true;
     }
     else
     {
         button4.Enabled = false;
     }
 }
Esempio n. 25
0
        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();
        }
Esempio n. 26
0
        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 { }
        }