public static void BeginWatch() { if (m_Watcher != null) { EndWatch(); } string folder = XmlFileDataManager.GetBaseFolderPath(); if (!Directory.Exists(folder)) { return; } m_Watcher = new FileSystemWatcher(folder, "*.xml"); m_Watcher.IncludeSubdirectories = true; m_Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime | NotifyFilters.Size | NotifyFilters.FileName; m_Watcher.Changed += new FileSystemEventHandler(m_Watcher_Changed); m_Watcher.Deleted += new FileSystemEventHandler(m_Watcher_Deleted); m_Watcher.Renamed += new RenamedEventHandler(m_Watcher_Renamed); m_Watcher.EnableRaisingEvents = true; }
static void m_Watcher_Changed(object sender, FileSystemEventArgs e) { string name = Path.GetFileNameWithoutExtension(e.FullPath); XmlFileDataManager.ClearCacheData(name); }
static void m_Watcher_Renamed(object sender, RenamedEventArgs e) { string name = Path.GetFileNameWithoutExtension(e.OldFullPath); XmlFileDataManager.ClearCacheData(name); }
public List <T> GetKeyValueData <T>(string dataCategory) where T : class, new() { return(XmlFileDataManager.GetKeyValueData <T>(dataCategory)); }