/// <summary> /// 初始化 <see cref="XmlCacheAccesor" /> 类. /// </summary> static XmlCacheAccesor() { _path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data"); if (!Directory.Exists(_path)) { Directory.CreateDirectory(_path); } _path = Path.Combine(_path, "DefaultXmlCache.xml"); if (File.Exists(_path)) { LoadData(); } else { File.AppendAllText(_path, string.Empty); } _watcher = new FileWatcher(_path); _watcher.OnXmlFileChanged += () => FileWatcher_OnXmlFileChanged(); }
private XmlParser(XElement element) { InitInstance(element); fileWatcher = new FileWatcher(); fileWatcher.OnXmlFileChanged += () => OnXmlFileChanged(); }