public static XdbPropertyToBimsSettring GetInstance() { if (instance == null) { instance = new XdbPropertyToBimsSettring(); instance.xdbToBimsPropertyNodes = new List <XdbToBimsPropertyNode>(); var folder = Path.Combine(Environment.CurrentDirectory, fatherPath); var files = Directory.EnumerateFiles(folder, xdbConFigfileName, SearchOption.TopDirectoryOnly); var fullfile = files.SingleOrDefault(); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(fullfile); XmlNodeList topM = xmldoc.SelectNodes("//InfoNode"); foreach (XmlElement element in topM) { XdbToBimsPropertyNode xdbConfig = new XdbToBimsPropertyNode(); xdbConfig.xdbType = Convert.ToInt32(element.GetAttribute("xdbType")); xdbConfig.xdbVersion = element.GetAttribute("xdbVersion"); xdbConfig.MethodClass = element.GetElementsByTagName("methodeClass")[0].InnerText; xdbConfig.namespaceName = element.GetElementsByTagName("namespace")[0].InnerText; var childs = element.SelectNodes("//methodNode"); foreach (XmlElement node in childs) { string table = node.GetAttribute("table"); clasMapmethod clasMapmethod = new clasMapmethod(); clasMapmethod.className = node.GetElementsByTagName("className")[0].InnerText; clasMapmethod.method = node.GetElementsByTagName("method")[0].InnerText; xdbConfig.clasMapmethods.Add(table, clasMapmethod); } instance.xdbToBimsPropertyNodes.Add(xdbConfig); } } return(instance); }
static void Main(string[] args) { var xx = XdbPropertyToBimsSettring.GetInstance().xdbToBimsPropertyNodes; Console.WriteLine("Hello World!"); }