Example #1
0
 public void AddToExistingCopyInfo(TreeNode copyInfo, string key, string value)
 {
     TreeNode deviceList = copyInfo.FindKeyChild(Tree.Failover_GoldCopy.DeviceList.NAME);
     TreeNode devicePair = new DevicePair();
     deviceList.AddChild(devicePair);
     TreeNode source = new Source(key);
     TreeNode target = new Target(value);
     devicePair.AddChild(source);
     devicePair.AddChild(target);
 }
Example #2
0
 private TreeNode ConstructFailoverTree(XmlDocument document)
 {
     if (!document.DocumentElement.Name.Equals(TestFailoverInfo.NAME))
         throw new EditorException("The XML is not of type Failover or GoldCopy.");
     TreeNode root = new TestFailoverInfo();
     XmlNode versionElem = document.DocumentElement.SelectSingleNode(XMLEditor.Tree.Version.NAME);
     TreeNode version = new XMLEditor.Tree.Version(versionElem.InnerText);
     root.AddChild(version);
     foreach (XmlNode element in document.DocumentElement.SelectNodes(CopyInfo.NAME))
     {
         TreeNode copyInfo = new CopyInfo();
         root.AddChild(copyInfo);
         XmlNode arrayIdElem = element.SelectSingleNode(ArrayId.NAME);
         XmlNode copyTypeElem = element.SelectSingleNode(CopyType.NAME);
         XmlNode copyModeElem = element.SelectSingleNode(CopyMode.NAME);
         XmlNode snapPoolElem = element.SelectSingleNode(SnapPool.NAME);
         TreeNode arrayId = new ArrayId(arrayIdElem.InnerText);
         TreeNode copyType = new CopyType(copyTypeElem.InnerText);
         copyInfo.AddChild(arrayId);
         copyInfo.AddChild(copyType);
         if (copyModeElem != null)
         {
             TreeNode copyMode = new CopyMode(copyModeElem.InnerText);
             copyInfo.AddChild(copyMode);
         }
         if (snapPoolElem != null)
         {
             TreeNode snapPool = new SnapPool(snapPoolElem.InnerText);
             copyInfo.AddChild(snapPool);
         }
         TreeNode deviceList = new XMLEditor.Tree.Failover_GoldCopy.DeviceList();
         copyInfo.AddChild(deviceList);
         foreach (XmlNode node in element.SelectNodes(@"//" + DevicePair.NAME))
         {
             TreeNode devicePair = new DevicePair();
             deviceList.AddChild(devicePair);
             XmlNode sourceElem = node.SelectSingleNode(Source.NAME);
             XmlNode targetElem = node.SelectSingleNode(Target.NAME);
             TreeNode source = new Source(sourceElem.InnerText);
             TreeNode target = new Target(targetElem.InnerText);
             devicePair.AddChild(source);
             devicePair.AddChild(target);
         }
     }
     return root;
 }