public FlashErrorsWatcher()
        {
            try
            {
                string appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                string logLocation;
                if (BridgeManager.Active && BridgeManager.Settings.TargetRemoteIDE)
                {
                    logLocation = Path.Combine(BridgeManager.Settings.SharedDrive, ".FlashDevelop\\flashide");
                    Directory.CreateDirectory(logLocation);
                }
                else logLocation = Path.Combine(appData, Path.Combine("Adobe", "FlashDevelop"));
                Directory.CreateDirectory(logLocation);

                logFile = Path.Combine(logLocation, "FlashErrors.log");
                docInfo = Path.Combine(logLocation, "FlashDocument.log");
                publishInfo = Path.Combine(logLocation, "FlashPublish.log");

                fsWatcher = new WatcherEx(logLocation);
                fsWatcher.EnableRaisingEvents = true;
                fsWatcher.Changed += new FileSystemEventHandler(fsWatcher_Changed);

                updater = new System.Timers.Timer();
                updater.Interval = 200;
                updater.Elapsed += updater_Tick;
            }
            catch { }
        }
Exemple #2
0
 private void setWatcher()
 {
     try
     {
         if (Directory.Exists(BackingPath))
         {
             watcher = new WatcherEx(BackingPath);
             if (watcher.IsRemote)
                 watcher.Changed += watcher_Changed;
             else
             {
                 watcher.Created += watcher_Created;
                 watcher.Deleted += watcher_Deleted;
                 watcher.Renamed += watcher_Renamed;
             }
             watcher.EnableRaisingEvents = true;
         }
     }
     catch {}
 }
 static void proj_ProjectUpdating(Project project)
 {
     string newConfig = Path.Combine(proj.Directory, "loom.config");
     if (configPath != newConfig)
     {
         configPath = newConfig;
         StopWatcher();
         if (File.Exists(configPath))
         {
             watcher = new WatcherEx(Path.GetDirectoryName(configPath), Path.GetFileName(configPath));
             watcher.Changed += watcher_Changed;
             watcher.EnableRaisingEvents = true;
             UpdateProject();
         }
     }
     else UpdateProject();
 }
 internal static void StopWatcher()
 {
     if (watcher != null)
     {
         watcher.Dispose();
         watcher = null;
         configPath = null;
     }
 }
Exemple #5
0
 public void ReleaseWatcher()
 {
     if (watcher != null)
     {
         watcher.EnableRaisingEvents = false;
         watcher.Dispose();
         watcher = null;
         //TraceManager.Add("Release: " + Path);
     }
 }
Exemple #6
0
 private void Init()
 {
     if (inited && IsValid) return;
     inited = true;
     updater = new System.Timers.Timer();
     updater.Interval = 500;
     updater.SynchronizingObject = PluginCore.PluginBase.MainForm as Form;
     updater.Elapsed += updater_Tick;
     toExplore = new List<string>();
     toRemove = new List<string>();
     
     // generic models container
     if (IsVirtual)
     {
         try
         {
             basePath = System.IO.Path.GetDirectoryName(Path);
             masks = new string[] { System.IO.Path.GetFileName(Path) };
             watcher = new WatcherEx(System.IO.Path.GetDirectoryName(Path), System.IO.Path.GetFileName(Path));
             watcher.Deleted += new FileSystemEventHandler(watcher_Deleted);
             watcher.Changed += new FileSystemEventHandler(watcher_Changed);
             watcher.Renamed += new RenamedEventHandler(watcher_Renamed);
             watcher.EnableRaisingEvents = true;
         }
         catch
         {
             watcher = null;
             IsValid = false;
         }
     }
     // watched path
     else if (IsValid)
     {
         if (Owner != null)
         {
             try
             {
                 basePath = Path;
                 masks = Owner.GetExplorerMask();
                 watcher = new WatcherEx(Path); //System.IO.Path.GetDirectoryName(Path));
                 if (!IsTemporaryPath || !watcher.IsRemote)
                 {
                     watcher.Deleted += new FileSystemEventHandler(watcher_Deleted);
                     watcher.Changed += new FileSystemEventHandler(watcher_Changed);
                     watcher.Renamed += new RenamedEventHandler(watcher_Renamed);
                     watcher.EnableRaisingEvents = true;
                 }
                 
             }
             catch
             {
                 watcher = null;
                 IsValid = false;
             }
         }
     }
 }
Exemple #7
0
 static void hxproj_ProjectUpdating(Project project)
 {
     if (hxproj.MovieOptions.Platform == HaxeMovieOptions.NME_PLATFORM)
     {
         string nmmlProj = hxproj.OutputPathAbsolute;
         if (nmmlPath != nmmlProj)
         {
             nmmlPath = nmmlProj;
             StopWatcher();
             if (File.Exists(nmmlPath))
             {
                 watcher = new WatcherEx(Path.GetDirectoryName(nmmlPath), Path.GetFileName(nmmlPath));
                 watcher.Changed += watcher_Changed;
                 watcher.EnableRaisingEvents = true;
                 UpdateProject();
             }
         }
         else UpdateProject();
     }
     else StopWatcher();
 }
        static void hxproj_ProjectUpdating(Project project)
        {
            if (!HandleProject(project))
            {
                StopWatcher();
                return;
            }

            string projectFile = hxproj.OutputPathAbsolute;
            if (projectPath != projectFile)
            {
                projectPath = projectFile;
                StopWatcher();
                if (File.Exists(projectPath))
                {
                    watcher = new WatcherEx(Path.GetDirectoryName(projectPath), Path.GetFileName(projectPath));
                    watcher.Changed += watcher_Changed;
                    watcher.EnableRaisingEvents = true;
                    UpdateProject();
                }
            }
            else UpdateProject();
        }