public void Add(string virtualpath, string virtualname,string[] args) { if (virtualpath.IndexOf(System.IO.Path.DirectorySeparatorChar) < 0) { virtualpath = AppDomain.CurrentDomain.BaseDirectory + virtualpath; } if (virtualpath.LastIndexOf(System.IO.Path.DirectorySeparatorChar) != virtualpath.Length - 1) { virtualpath += System.IO.Path.DirectorySeparatorChar; } if (System.IO.Directory.Exists(virtualpath)) { AdapterDomain pd = new AdapterDomain(virtualpath, virtualname, null); pd.Args = args; pd.LogEvent += OnLogEvent; mDomains.Add(pd); if (!System.IO.Directory.Exists(pd.CachePath)) { System.IO.Directory.CreateDirectory(pd.CachePath); } mFileWatches.Add(new FileWatcher(pd)); } else { OnLogEvent(this, new DomainExecutingArgs { Status = ExecutingStatus.Warning, Message = string.Format("{0} notfound.", virtualpath) }); } }
public void Add(string virtualpath, string virtualname, string[] args) { if (virtualpath.IndexOf(System.IO.Path.DirectorySeparatorChar) < 0) { virtualpath = AppDomain.CurrentDomain.BaseDirectory + virtualpath; } if (virtualpath.LastIndexOf(System.IO.Path.DirectorySeparatorChar) != virtualpath.Length - 1) { virtualpath += System.IO.Path.DirectorySeparatorChar; } if (System.IO.Directory.Exists(virtualpath)) { AdapterDomain pd = new AdapterDomain(virtualpath, virtualname, null); pd.Args = args; pd.LogEvent += OnLogEvent; mDomains.Add(pd); if (!System.IO.Directory.Exists(pd.CachePath)) { System.IO.Directory.CreateDirectory(pd.CachePath); } mFileWatches.Add(new FileWatcher(pd)); } else { OnLogEvent(this, new DomainExecutingArgs { Status = ExecutingStatus.Warning, Message = string.Format("{0} notfound.", virtualpath) }); } }
public FileWatcher(AdapterDomain domain) { mDomain = domain; mWather = new FileSystemWatcher(domain.FullPath); mWather.Changed += new FileSystemEventHandler(fileSystemWatcher_Changed); mWather.Deleted += new FileSystemEventHandler(fileSystemWatcher_Changed); mWather.Created += new FileSystemEventHandler(fileSystemWatcher_Changed); mWather.EnableRaisingEvents = true; mWather.IncludeSubdirectories = false; }