コード例 #1
0
 public static void Export(RegistryExplorer.Registry.RegKey key
                           , ExportProvider provider)
 {
     provider.BeginExport();
     ExportKey(key, provider);
     provider.EndExport();
 }
コード例 #2
0
        private void LoadFavorites()
        {
            RegistryExplorer.Registry.RegKey favoritesKey = RegistryExplorer.Registry.RegKey.Parse(
                RegistryExplorer.Registry.RegistryExplorerr.RegistryFavoritePath
                );

            if (favoritesKey == null)
            {
                return;
            }

            System.Collections.Generic.List <RegistryExplorer.Registry.RegValue> values =
                RegistryExplorer.Registry.RegistryExplorerr.GetValues(favoritesKey.Key);

            if (values.Count > 0)
            {
                values.ForEach(val =>
                {
                    string key = val.Data.ToString();
                    //removing "My Computer\" set by RegEdit
                    key = key.Substring(key.IndexOf('\\') + 1);
                    favorites[val.Name] = key;
                });
            }
        }
コード例 #3
0
 static void ExportValues(RegistryExplorer.Registry.RegKey key, ExportProvider provider)
 {
     foreach (RegistryExplorer.Registry.RegValue value in RegistryExplorer.Registry.RegistryExplorerr.GetValues(key.Key))
     {
         provider.WriteValue(value.Name, value.Kind, value.Data);
     }
 }
コード例 #4
0
        private bool ExportToFile(
            RegistryExplorer.Registry.RegKey key,
            RegistryExplorer.Export.RegExportFormat format,
            System.IO.Stream output
            )
        {
            bool success = true;

            using (output)
            {
                DisableControls();
                try
                {
                    using (new BusyCursor(this))
                    {
                        using (System.IO.StreamWriter writer = new System.IO.StreamWriter(output))
                        {
                            RegistryExplorer.Export.RegExporter.Export(
                                key
                                , RegistryExplorer.Export.ExportProvider.Create(format, writer)
                                );
                        }
                    }
                }
                catch
                {
                    success = false;
                }
                EnableControls();
            }

            return(success);
        }
コード例 #5
0
 static void ExportKey(RegistryExplorer.Registry.RegKey key
                       , ExportProvider provider)
 {
     provider.WriteKeyStart(key.Key.Name);
     ExportValues(key, provider);
     foreach (RegistryExplorer.Registry.RegKey subKey in RegistryExplorer.Registry.RegistryExplorerr.GetSubKeys(key.Key))
     {
         ExportKey(subKey, provider);
     }
     provider.WriteKeyEnd();
 }
コード例 #6
0
        void AddKeyToTree(TreeNode parent, RegistryExplorer.Registry.RegKey subKey)
        {
            Microsoft.Win32.RegistryKey key = subKey.Key;
            TreeNode newNode = CreateNode(key.Name, subKey.Name, key);

            parent.Nodes.Add(newNode);
            if (key.SubKeyCount > 0)
            {
                newNode.Nodes.Add(CreateNode());
            }
        }
コード例 #7
0
        private void btOK_Click(object sender, System.EventArgs e)
        {
            RegistryExplorer.Registry.RegKey regKey = RegistryExplorer.Registry.RegKey.Parse(
                RegistryExplorer.Registry.RegistryExplorerr.RegistryFavoritePath, true
                );

            foreach (object item in lstKeys.SelectedItems)
            {
                string key = item.ToString();
                regKey.Key.DeleteValue(key);
                favorites.Remove(key);
            }
        }
コード例 #8
0
        private void tvwKeys_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            tvwKeys.LabelEdit = false;
            string keyName = e.Label == null ? e.Node.Text : e.Label;

            try
            {
                Microsoft.Win32.RegistryKey      readOnlyParent = (Microsoft.Win32.RegistryKey)e.Node.Parent.Tag;
                RegistryExplorer.Registry.RegKey parent         = RegistryExplorer.Registry.RegKey.Parse(readOnlyParent.Name, true);
                parent.Key.CreateSubKey(keyName);
                e.Node.Name = parent.Key.Name + "\\" + keyName;
                e.Node.Tag  = RegistryExplorer.Registry.RegKey.Parse(e.Node.Name).Key;
            }
            catch
            {
                e.Node.Remove();
                UIUtility.DisplayError(this, RegistryExplorer.Properties.Resources.Error_CreateKeyFail);
            }
        }