示例#1
0
        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;
        }
示例#2
0
        static void m_Watcher_Changed(object sender, FileSystemEventArgs e)
        {
            string name = Path.GetFileNameWithoutExtension(e.FullPath);

            XmlFileDataManager.ClearCacheData(name);
        }
示例#3
0
        static void m_Watcher_Renamed(object sender, RenamedEventArgs e)
        {
            string name = Path.GetFileNameWithoutExtension(e.OldFullPath);

            XmlFileDataManager.ClearCacheData(name);
        }
示例#4
0
 public List <T> GetKeyValueData <T>(string dataCategory) where T : class, new()
 {
     return(XmlFileDataManager.GetKeyValueData <T>(dataCategory));
 }