public bool Read(string path, ILogger _logger) { logger = _logger; mainpath = path; string pathname = System.IO.Path.GetFileName(mainpath); //string pathname= System.IO.Path.GetDirectoryName(mainpath); string xflfile = System.IO.Path.Combine(path, pathname + ".xfl"); xflver = System.IO.File.ReadAllText(xflfile); if (xflver == "PROXY-CS5" || xflver == "PROXY-CS5.5") { logger.Log(LogLevel.Normal, "xfl项目"); } else { logger.Log(LogLevel.Error, "不是xfl项目"); return(false); } try { string dom = System.IO.Path.Combine(path, "DOMDocument.xml"); using (System.IO.Stream s = System.IO.File.OpenRead(dom)) { XmlSerializer xmls = new XmlSerializer(typeof(data_domdoc)); datadom = xmls.Deserialize(s) as data_domdoc; } } catch (Exception err) { logger.Log(LogLevel.Waring, err.ToString()); } //string texpath = string[] files = System.IO.Directory.GetFiles(System.IO.Path.Combine(path, "LIBRARY"), "*.xml"); foreach (var f in files) { using (System.IO.Stream fs = System.IO.File.OpenRead(f)) { try { XmlSerializer xmls = new XmlSerializer(typeof(DOMSymbolItem)); var item = xmls.Deserialize(fs) as DOMSymbolItem; GenSeed(item, path); } catch (Exception err) { logger.Log(LogLevel.Waring, err.ToString()); } } } logger.Log(LogLevel.Normal, "加载成功"); return(true); }
public bool Read(string path, ILogger _logger) { logger = _logger; mainpath = path; string pathname = System.IO.Path.GetFileName(mainpath); //string pathname= System.IO.Path.GetDirectoryName(mainpath); string xflfile = System.IO.Path.Combine(path, pathname + ".xfl"); xflver = System.IO.File.ReadAllText(xflfile); if (xflver == "PROXY-CS5" || xflver == "PROXY-CS5.5") { logger.Log(LogLevel.Normal, "xfl项目"); } else { logger.Log(LogLevel.Error, "不是xfl项目"); return false; } try { string dom = System.IO.Path.Combine(path, "DOMDocument.xml"); using (System.IO.Stream s = System.IO.File.OpenRead(dom)) { XmlSerializer xmls = new XmlSerializer(typeof(data_domdoc)); datadom = xmls.Deserialize(s) as data_domdoc; } } catch (Exception err) { logger.Log(LogLevel.Waring, err.ToString()); } //string texpath = string[] files = System.IO.Directory.GetFiles(System.IO.Path.Combine(path, "LIBRARY"), "*.xml"); foreach (var f in files) { using (System.IO.Stream fs = System.IO.File.OpenRead(f)) { try { XmlSerializer xmls = new XmlSerializer(typeof(DOMSymbolItem)); var item = xmls.Deserialize(fs) as DOMSymbolItem; GenSeed(item, path); } catch (Exception err) { logger.Log(LogLevel.Waring, err.ToString()); } } } logger.Log(LogLevel.Normal, "加载成功"); return true; }