Esempio n. 1
0
 public VALSTRO(KEYSTRO k, string valname, uint type)
 {
     NewItem   = false;
     Key       = k;
     ValueName = valname;
     Type      = type;
 }
Esempio n. 2
0
 public VALSTRO(KEYSTRO k, string valname, uint type, bool newitem)
 {
     NewItem   = newitem;
     Key       = k;
     ValueName = valname;
     Type      = type;
 }
Esempio n. 3
0
 private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
 {
     if (e.Node != null && e.Node.Tag != null)
     {
         KEYSTRO eYSTRO = (KEYSTRO)e.Node.Tag;
         if (eYSTRO.NewItem)
         {
             eYSTRO.NewItem = false;
             string newText = e.Label == null ? e.Node.Name : e.Label;
             if (MREG_CreateSubKey(eYSTRO.RootKey, eYSTRO.KeyPath, newText))
             {
                 e.Node.Tag  = new KEYSTRO(eYSTRO.RootKey, eYSTRO.KeyPath + "\\" + newText);
                 e.Node.Name = newText;
             }
             else
             {
                 e.Node.Remove();
                 MessageBox.Show("无法创建新项\n" + MREG_GetLastErrString(), "创建新项", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             }
         }
         else if (e.Label != null)
         {
             if (!MREG_RenameKey(eYSTRO.RootKey, eYSTRO.KeyPath, e.Label))
             {
                 e.CancelEdit = true;
                 MessageBox.Show("无法重命名项\n" + MREG_GetLastErrString(), "重命名", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             }
         }
     }
 }
Esempio n. 4
0
        private bool LoadFolder(TreeNode t)
        {
            enumChildKeysHasDefault = false;
            KEYSTRO kEYSTRO = (KEYSTRO)t.Tag;
            bool    rs      = MREG_EnumKeys(kEYSTRO.RootKey, kEYSTRO.KeyPath, eNUMKEYSCALLBACK_Ptr);

            return(rs);
        }
Esempio n. 5
0
        private void 权限ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode t = treeView.SelectedNode;

            if (t != null && t.Tag != null)
            {
                KEYSTRO eYSTRO = (KEYSTRO)t.Tag;
            }
        }
Esempio n. 6
0
        private void  制项名称ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode t = treeView.SelectedNode;

            if (t != null && t.Tag != null)
            {
                KEYSTRO eYSTRO = (KEYSTRO)t.Tag;
                Clipboard.SetText(MREG_ROOTKEYToStr(eYSTRO.RootKey) + "\\" + eYSTRO.KeyPath);
            }
        }
Esempio n. 7
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode t = treeView.SelectedNode;

            if (t != null && t.Tag != null)
            {
                if (MessageBox.Show("真的要删除此项目和其所有子项吗?", "确认删除", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    KEYSTRO eYSTRO = (KEYSTRO)t.Tag;
                    if (!MREG_DeleteKey(eYSTRO.RootKey, eYSTRO.KeyPath))
                    {
                        MessageBox.Show("无法删除项\n" + MREG_GetLastErrString(), "删除项目", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    else
                    {
                        t.Remove();
                    }
                }
            }
        }
Esempio n. 8
0
        private void NewValue(KEYSTRO parent, TreeNode tparent, uint type)
        {
            int    newid = 1;
            string name  = "新值  #" + newid;

            while (ContainsValue(name))
            {
                newid++;
                name = "新项  #" + newid;
            }

            ListViewItem linew = new ListViewItem(name);

            linew.SubItems.Add(MREG_RegTypeToStr(type));
            linew.SubItems.Add("");
            linew.ImageKey = MREG_RegTypeToIcon(type);
            linew.Name     = name;
            linew.Tag      = new VALSTRO(parent, name, type, true);
            listView.Items.Add(linew);
            linew.BeginEdit();
        }
Esempio n. 9
0
        private void LoadAllItems(TreeNode t)
        {
            if (lastShowItem != t)
            {
                if (t.Tag == null)
                {
                    return;
                }

                listView.Items.Clear();
                lastShowItem    = t;
                currentEnumItem = t;
                KEYSTRO kEYSTRO = (KEYSTRO)currentEnumItem.Tag;
                textBoxAddress.Text = MREG_ROOTKEYToStr(kEYSTRO.RootKey) + "\\" + kEYSTRO.KeyPath;
                bool rs = MREG_EnumKeyVaules(kEYSTRO.RootKey, kEYSTRO.KeyPath, eNUMKEYVALECALLBACK_Ptr);

                if (!enumChildKeysHasDefault)
                {
                    AddDataItemToList(kEYSTRO, "", 1, "");
                }
            }
        }
Esempio n. 10
0
        private void NewSubKey(KEYSTRO parent, TreeNode tparent)
        {
            if (!tparent.IsExpanded)
            {
                tparent.Expand();
            }

            int    newid = 1;
            string name  = "新项 #" + newid;

            while (ContainsKey(tparent, name))
            {
                newid++;
                name = "新项 #" + newid;
            }

            parent.NewItem = true;
            TreeNode newT = tparent.Nodes.Add(name, name, "Folder", "Folder");

            newT.Name = name;
            newT.Tag  = parent;
            newT.BeginEdit();
        }
Esempio n. 11
0
        private void AddDataItemToList(KEYSTRO parent, string name, uint type, string data)
        {
            if (name == "")
            {
                name = "(默认)";
                enumChildKeysHasDefault = true;
            }

            ListViewItem li = new ListViewItem(name);

            li.SubItems.Add(MREG_RegTypeToStr(type));

            if (data == "" && MREG_RegTypeIsSz(type))
            {
                data = "(数值未设置)";
            }

            li.Tag = new VALSTRO(parent, name, type);
            li.SubItems.Add(data);
            li.ImageKey = MREG_RegTypeToIcon(type);

            listView.Items.Add(li);
        }