Write() public method

To write into a registry key. input: KeyName (string) , Value (object) output: true or false
public Write ( string KeyName, object Value ) : bool
KeyName string
Value object
return bool
        public bool IsNewFile(Stream inputStream)
        {
            using (MD5 md5Hash = MD5.Create())
            {
                string newHash = GetMd5Hash(md5Hash, inputStream);
                ModifyRegistry registry = new ModifyRegistry();
                registry.ShowError = false;

                string oldHash = registry.Read("Hash");
                if (String.IsNullOrEmpty(oldHash))
                {
                    registry.Write("Hash", "0");
                }

                bool result = !IsSame(newHash, oldHash);
                if (result) // if new file need to parse
                {
                    registry.Write("Hash", newHash);
                }
                return result;
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            RegistryKey bk = Registry.ClassesRoot;
            RegistryKey sk = bk.CreateSubKey("*\\shell\\RightClickDeposit");
            ModifyRegistry reg = new ModifyRegistry();
            reg.BaseRegistryKey = bk;
            reg.SubKey = "*\\shell\\RightClickDeposit";
            reg.Write("MUIVerb", "Deposit to");
            string commandList = "";
            foreach(KeyValuePair<int,Profile> p in profiles)
            {
                if (p.Value.IsDefault())
                {
                    string commandName = "RightClickDeposit.deposit." + p.Value.GetId();
                    commandList += commandName + "; ";
                    RegistryKey cbk = Registry.LocalMachine;
                    RegistryKey ck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName);
                    ModifyRegistry regcmd = new ModifyRegistry();
                    regcmd.BaseRegistryKey = cbk;
                    regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName;
                    regcmd.Write("MUIVerb", p.Value.GetName());
                    MessageBox.Show(regcmd.Read("MUIVerb"));
                    RegistryKey cck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command");
                    regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command";
                    regcmd.Write("", "C:\\RightClickDeposit.exe " + p.Value.GetId() + " create \"%1\"");
                }
            }

            RegistryKey ubk = Registry.LocalMachine;
            RegistryKey uk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update");
            ModifyRegistry regu = new ModifyRegistry();
            regu.BaseRegistryKey = ubk;
            regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update";
            regu.Write("MUIVerb", "Update or delete previous deposit");

            RegistryKey cuk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command");
            regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command";
            regu.Write("", "C:\\RightClickDeposit.exe 0 update \"%1\"");

            commandList += "RightClickDeposit.update";

            reg.Write("SubCommands", commandList);
        }
Example #3
0
        private void SetupCommandBarButton()
        {
            if (runServerViolationsCommandBarButton != null)
                runServerViolationsCommandBarButton.Delete(true);

            if (runLocalViolationsCommandBarButton != null)
                runLocalViolationsCommandBarButton.Delete(true);

            if (runAllLocalViolationsCommandBarButton != null)
                runAllLocalViolationsCommandBarButton.Delete(true);

            if (runServerCoverageCommandBarButton != null)
                runServerCoverageCommandBarButton.Delete(true);

            if (runSourceDiffCommandBarButton != null)
                runSourceDiffCommandBarButton.Delete(true);

            if (runResetCommandBarButton != null)
                runResetCommandBarButton.Delete(true);

            if ((temporaryToolbar != null))
            {
                ModifyRegistry createRegistry = new ModifyRegistry(PLUGINKEY);

                createRegistry.Write(ROWINDEXKEY, temporaryToolbar.RowIndex);
                createRegistry.Write(POSITIONKEY, temporaryToolbar.Position);
                createRegistry.Write(WIDTHKEY, temporaryToolbar.Width);
                createRegistry.Write(HEIGHTKEY, temporaryToolbar.Height);
                createRegistry.Write(VISIBLEKEY, temporaryToolbar.Visible);
                temporaryToolbar.Delete();
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            RegistryKey bk = Registry.ClassesRoot;
            RegistryKey sk = bk.CreateSubKey("*\\shell\\RightClickDeposit");
            ModifyRegistry reg = new ModifyRegistry();
            reg.BaseRegistryKey = bk;
            reg.SubKey = "*\\shell\\RightClickDeposit";
            reg.Write("MUIVerb", "Deposit to");
            reg.Write("Icon", Application.StartupPath + "\\icons\\rcd.ico");
            string commandList = "";
            foreach(KeyValuePair<int,Profile> p in profiles)
            {
                if (p.Value.IsDefault())
                {
                    string commandName = "RightClickDeposit.deposit." + p.Value.GetId();
                    commandList += commandName + "; ";
                    RegistryKey cbk = Registry.LocalMachine;
                    RegistryKey ck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName);
                    ModifyRegistry regcmd = new ModifyRegistry();
                    regcmd.BaseRegistryKey = cbk;
                    regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName;
                    regcmd.Write("MUIVerb", p.Value.GetName());
                    regcmd.Write("Icon", Application.StartupPath + "\\icons\\add.ico");
                    //MessageBox.Show(regcmd.Read("MUIVerb"));
                    RegistryKey cck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command");
                    regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command";
                    regcmd.Write("", Application.StartupPath + "\\RightClickDeposit.exe " + p.Value.GetId() + " create \"%1\"");
                }
            }

            RegistryKey ubk = Registry.LocalMachine;
            RegistryKey uk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update");
            ModifyRegistry regu = new ModifyRegistry();
            regu.BaseRegistryKey = ubk;
            regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update";
            regu.Write("MUIVerb", "Update or delete previous deposits");
            regu.Write("Icon", Application.StartupPath + "\\icons\\update.ico");

            RegistryKey cuk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command");
            regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command";
            regu.Write("", Application.StartupPath + "\\RightClickDeposit.exe 0 update \"%1\"");

            RegistryKey pbk = Registry.LocalMachine;
            RegistryKey pk = pbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles");
            ModifyRegistry regp = new ModifyRegistry();
            regp.BaseRegistryKey = pbk;
            regp.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles";
            regp.Write("MUIVerb", "Manage profiles (admin-only)");
            regp.Write("Icon", Application.StartupPath + "\\icons\\manage.ico");

            RegistryKey puk = pbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles\\command");
            regp.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles\\command";
            regp.Write("", Application.StartupPath + "\\RightClickDeposit.exe profiles");

            commandList += "RightClickDeposit.update; RightClickDeposit.profiles";

            reg.Write("SubCommands", commandList);

            MessageBox.Show("Right-click explorer context menus updated successfully", "Menu update successful");
        }
Example #5
0
 //stroe the token in registry
 private void StroeToken(string keyName, string keyValue)
 {
     try
     {
         ModifyRegistry myRegistry = new ModifyRegistry();
         //myRegistry.SubKey = "SOFTWARE\\RTF_SHARP_EDIT\\RECENTFILES";
         myRegistry.ShowError = true;
         myRegistry.DeleteSubKeyTree();
         myRegistry.Write(keyName, keyValue);
         LogHelper.Debug(String.Format("Stroed token: {0} in registry with subkey: {1} and key name: {2}", keyValue, myRegistry.SubKey, keyName));
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
 }
Example #6
0
        private void customBuildToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Try to build
            if (this.CurrentProject != null)
            {
                Emulator.Instance.Dispose();

                this.IsCustomBuild = true;

                float XRatio = 0;
                float YRatio = 0;
                if (this.CurrentProject.Orientation == CoronaGameProject.OrientationScreen.Portrait)
                {
                    XRatio = (float)this.currentTargetResolution.Resolution.Width / (float)this.CurrentProject.width;
                    YRatio = (float)this.currentTargetResolution.Resolution.Height / (float)this.CurrentProject.height;
                }
                else
                {
                    YRatio = (float)this.currentTargetResolution.Resolution.Width / (float)this.CurrentProject.width;
                    XRatio = (float)this.currentTargetResolution.Resolution.Height / (float)this.CurrentProject.height;
                }

                //Refresh sceneLuaCodes
                string filePathSelectedInEditor = "";
                if (this.cgEeditor1.ActiveDocument != null)
                {
                    filePathSelectedInEditor = this.cgEeditor1.ActiveDocument.FilePath;
                }

                for (int i = 0; i < this.CurrentProject.Scenes.Count; i++)
                {
                    Scene scene = this.CurrentProject.Scenes[i];
                    this.cgEeditor1.RefreshSceneLuaCode(scene, true, XRatio, YRatio);
                }

                if(!filePathSelectedInEditor.Equals(""))
                    this.cgEeditor1.OpenFileInEditor(filePathSelectedInEditor);

                if (this.mainBackWorker.IsBusy == true)
                    this.mainBackWorker.CancelAsync();

                if (this.mainBackWorker.IsBusy == false)
                {
                    //this.Enabled = false;
                    this.isFormLocked = true;
                    string device = this.currentTargetResolution.TargetDevice.Replace(" ", "");
                    ModifyRegistry myRegistry = new ModifyRegistry();
                    myRegistry.SubKey = "Software\\Ansca Corona\\Corona Simulator\\Preferences";
                    myRegistry.ShowError = true;

                    myRegistry.Write("Device", device);

                    if(this.CurrentProject.Orientation == CoronaGameProject.OrientationScreen.Landscape)
                    {

                        //regKey.SetValue("Zoom", unchecked((int)0xf0000000u), Re.DWord);

                        //string hex = "fffffffe";
                        //var result = new byte[hex.Length/2];
                        //for (int i = 0; i < hex.Length; i += 2)
                        //{
                        //    result[i / 2] = byte.Parse(hex.Substring(i, 2), System.Globalization.NumberStyles.HexNumber);
                        //}

                        myRegistry.Write("Zoom", unchecked((int)0xfffffffdu));
                    }

                    this.currentWorkerAction = "ACTION_BUILD_PLAY";
                    this.mainBackWorker.RunWorkerAsync(this.currentWorkerAction);
                }

            }
        }