예제 #1
0
        public ObservableCollection <BrienzHierarchicalData> RefreshDomainData(string PlateNode)
        {
            try
            {
                ObservableCollection <BrienzHierarchicalData> _brienzHierarchicalData = new ObservableCollection <BrienzHierarchicalData>();
                xd      = new XmlDocument();
                xmlData = new BrienzHierarchicalData();
                StreamReader sr = new StreamReader(System.Environment.CurrentDirectory + ConstValue.XMLFileName, System.Text.Encoding.GetEncoding("utf-8"));
                xd.Load(sr);
                XmlNode xnList = xd.SelectSingleNode("/Brienz" + ConstValue.XMLFolderNS + ConstValue.XMLFolderNS + "[@" + ConstValue.XMLFileAttribute_FolderName + "='" + PlateNode + "']");
                if (xnList != null)
                {
                    XmlDocument temp = new XmlDocument();
                    temp.LoadXml(xnList.OuterXml);
                    _brienzHierarchicalData.Clear();
                    _brienzHierarchicalData = ReadXML(xnList.ChildNodes);
                    //BrienzHieData.RemoveAt(0);
                    //if (BrienzHieData.Count >= 1) BrienzHieData.RemoveAt(0);
                    //BrienzHieData.Add(m);

                    //XmlDataProvider dataProvider = this.FindResource("xmlDataProvider") as XmlDataProvider;
                    //dataProvider.Document = xd;
                }
                sr.Close();
                return(_brienzHierarchicalData);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public int GetDomainDataNumber(string PlateNode)
        {
            xd      = new XmlDocument();
            xmlData = new BrienzHierarchicalData();
            StreamReader sr = new StreamReader(System.Environment.CurrentDirectory + ConstValue.XMLFileName, System.Text.Encoding.GetEncoding("utf-8"));

            xd.Load(sr);
            XmlNode xnList      = xd.SelectSingleNode("/Brienz" + ConstValue.XMLFolderNS + ConstValue.XMLFolderNS + "[@" + ConstValue.XMLFileAttribute_FolderName + "='" + PlateNode + "']");
            int     totalNumber = 0;

            ReadXMLForDomainCount(xnList.ChildNodes, ref totalNumber);
            return(totalNumber);
        }
예제 #3
0
 //private BrienzHierarchicalData ReadXML(BrienzHierarchicalData rootData, XmlNodeList NodeList)
 //{
 //    rootData.Children = new List<BrienzHierarchicalData>();
 //    foreach (XmlNode nodeIndex in NodeList)
 //    {
 //        BrienzHierarchicalData temp = new BrienzHierarchicalData();
 //        if (!nodeIndex.HasChildNodes)
 //        {
 //            temp.Data = nodeIndex.InnerText;
 //            temp.Attributes = nodeIndex.Attributes;
 //        }
 //        else
 //        {
 //            temp.Attributes = nodeIndex.Attributes;
 //            temp.Name = nodeIndex.Name;
 //            ReadXML(temp, nodeIndex.ChildNodes);
 //        }
 //        rootData.Children.Add(temp);
 //    }
 //    return rootData;
 //}
 private ObservableCollection <BrienzHierarchicalData> ReadXML(XmlNodeList NodeList)
 {
     try
     {
         foreach (XmlNode nodeIndex in NodeList)
         {
             BrienzHierarchicalData BrienzData = new BrienzHierarchicalData();
             XmlNode CurrentNode = nodeIndex;
             if (CurrentNode.Name == ConstValue.FileNS)
             {
                 while (true)
                 {
                     if (CurrentNode != null)
                     {
                         XmlNode getParent = CurrentNode.ParentNode;
                         if (getParent == null)
                         {
                             BrienzData.FolderName = BrienzData.FolderName.Remove(BrienzData.FolderName.LastIndexOf('|'));
                             break;
                         }
                         if (getParent.Name == ConstValue.FolderNS)
                         {
                             if (getParent.Attributes[ConstValue.XMLFileAttribute_FolderName].Value != "Root")
                             {
                                 BrienzData.FolderName = CurrentNode.ParentNode.Attributes[ConstValue.XMLFileAttribute_FolderName].Value + "|" + BrienzData.FolderName;
                             }
                         }
                         CurrentNode = getParent;
                     }
                     else
                     {
                         BrienzData.FolderName = BrienzData.FolderName.Remove(BrienzData.FolderName.LastIndexOf('|'));
                         break;
                     }
                 }
                 if (nodeIndex.Name == ConstValue.FileNS)
                 {
                     BrienzData.FileName   = nodeIndex.Attributes[ConstValue.XMLFileAttribute_FileName].Value;
                     BrienzData.FileStatus = nodeIndex.Attributes[ConstValue.XMLFileAttribute_FileStatus].Value;
                 }
                 _brienzHierarchicalData.Add(BrienzData);
             }
             else if (CurrentNode.Name == ConstValue.FolderNS)
             {
                 if (CurrentNode.HasChildNodes)
                 {
                     ReadXML(nodeIndex.ChildNodes);
                 }
                 else
                 {
                     string CurrentFolderName = CurrentNode.Attributes[ConstValue.XMLFileAttribute_FolderName].Value;
                     while (true)
                     {
                         if (CurrentNode != null)
                         {
                             XmlNode getParent = CurrentNode.ParentNode;
                             if (getParent == null)
                             {
                                 BrienzData.FolderName = BrienzData.FolderName + CurrentFolderName;
                                 break;
                             }
                             if (getParent.Name == ConstValue.FolderNS)
                             {
                                 if (getParent.Attributes[ConstValue.XMLFileAttribute_FolderName].Value != "Root")
                                 {
                                     BrienzData.FolderName = getParent.Attributes[ConstValue.XMLFileAttribute_FolderName].Value + "|" + BrienzData.FolderName;
                                 }
                             }
                             CurrentNode = getParent;
                         }
                         else
                         {
                             BrienzData.FolderName = BrienzData.FolderName + CurrentFolderName;
                             break;
                         }
                     }
                     _brienzHierarchicalData.Add(BrienzData);
                 }
             }
         }
         return(_brienzHierarchicalData);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }