예제 #1
0
파일: Center.cs 프로젝트: hdxhan/IKendeLib
 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) });
     }
 }
예제 #2
0
 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)
         });
     }
 }
예제 #3
0
        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;
        }
예제 #4
0
        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;

        }