Example #1
0
        private TreeNode buildtree(DisableGetObjects.IConfigSwitchOrGroup datainput)
        {
            TreeNode result = new TreeNode(datainput.GetNowItemName());

            result.Tag = datainput;
            if (datainput.IfHaveNextItems())
            {
                var datanext = datainput.NextItems();
                foreach (var p in datanext)
                {
                    result.Nodes.Add(buildtree(p));
                }
            }
            return(result);
        }
Example #2
0
 private void findAndReplaceInData(DisableGetObjects.IConfigSwitchOrGroup src, DisableGetObjects.IConfigSwitchOrGroup dstValue)
 {
     for (int i = 0; i < data.Count; ++i)
     {
         if (data[i] == src)
         {
             data[i] = dstValue;
         }
         else
         {
             var t = data[i];
             findandReplaceInSub(data[i].NextItems(), ref t, src, dstValue);
             data[i] = t;
         }
     }
 }
Example #3
0
 private void findandReplaceInSub(DisableGetObjects.IConfigSwitchOrGroup[] iConfigSwitchOrGroup, ref DisableGetObjects.IConfigSwitchOrGroup father, DisableGetObjects.IConfigSwitchOrGroup src, DisableGetObjects.IConfigSwitchOrGroup dstValue)
 {
     if (iConfigSwitchOrGroup == null)
     {
         return;
     }
     for (int i = 0; i < iConfigSwitchOrGroup.Length; ++i)
     {
         if (iConfigSwitchOrGroup[i] == src)
         {
             iConfigSwitchOrGroup[i] = dstValue;
             father.SetItemList(iConfigSwitchOrGroup);
             return;
         }
         else
         {
             findandReplaceInSub(iConfigSwitchOrGroup[i].NextItems(), ref iConfigSwitchOrGroup[i], src, dstValue);
         }
     }
 }
Example #4
0
 private void deleteItemInSub(DisableGetObjects.IConfigSwitchOrGroup father, DisableGetObjects.IConfigSwitchOrGroup whattodel)
 {
     if (!father.IfHaveNextItems())
     {
         return;
     }
     foreach (var m in father.NextItems())
     {
         if (m == whattodel)
         {
             List <DisableGetObjects.IConfigSwitchOrGroup> w = new List <DisableGetObjects.IConfigSwitchOrGroup>(father.NextItems());
             w.Remove(whattodel);
             father.SetItemList(w.ToArray());
             return;
         }
         else
         {
             deleteItemInSub(m, whattodel);
         }
     }
 }