/// <summary> /// Create a new directory scanning monitor /// </summary> /// <param name="monitorFileName">The file name to save the list of monitored directories /// to</param> /// <param name="scanInterval">The <see cref="ScanInterval"/> in seconds</param> /// <param name="baseDirectory">The base directory to use for the archives of this /// monitor</param> /// <param name="defaultArchive">The default archive to use</param> /// <param name="otherArchives">Other archives for specific extensions</param> public DirectoryScanningMonitor(string monitorFileName, double scanInterval, string baseDirectory, AbstractArchive defaultArchive, params AbstractArchive[] otherArchives) : base(baseDirectory, defaultArchive, otherArchives) { MonitoredDirectoriesFilePath = Path.Combine(baseDirectory, monitorFileName); folders = new List<string>(); ScanTimer = new ReentrantTimer(() => UpdateArchives()); ScanTimer.AutoReset = true; ScanInterval = scanInterval; }
/// <summary> /// Constructor. /// </summary> /// <param name="sp"></param> /// <param name="extensionDirectory"></param> public SrcMLGlobalService(IServiceProvider sp, string extensionDirectory) { SrcMLFileLogger.DefaultLogger.InfoFormat("Constructing a new instance of SrcMLGlobalService in {0}", extensionDirectory); serviceProvider = sp; SrcMLServiceDirectory = extensionDirectory; statusBar = (IVsStatusbar)Package.GetGlobalService(typeof(SVsStatusbar)); _taskManager = (ITaskManagerService)Package.GetGlobalService(typeof(STaskManagerService)); SaveTimer = new ReentrantTimer(() => CurrentMonitor.Save(), _taskManager.GlobalScheduler); SaveInterval = DEFAULT_SAVE_INTERVAL; }
/// <summary> /// Create a new directory scanning monitor /// </summary> /// <param name="monitorFileName">The file name to save the list of monitored directories /// to</param> /// <param name="scanInterval">The <see cref="ScanInterval"/> in seconds</param> /// <param name="baseDirectory">The base directory to use for the archives of this /// monitor</param> /// <param name="defaultArchive">The default archive to use</param> /// <param name="otherArchives">Other archives for specific extensions</param> public DirectoryScanningMonitor(string monitorFileName, double scanInterval, TaskScheduler scheduler, string baseDirectory, IArchive defaultArchive, params IArchive[] otherArchives) : base(scheduler, baseDirectory, defaultArchive, otherArchives) { MonitoredDirectoriesFilePath = Path.Combine(baseDirectory, monitorFileName); folders = new List <string>(); ScanTimer = new ReentrantTimer(() => UpdateArchivesAsync(), scheduler); ScanTimer.AutoReset = true; ScanInterval = scanInterval; }
/// <summary> /// Create a new abstract monitoring service /// </summary> /// <param name="serviceProvider">The container where this service will be sited</param> /// <param name="taskManagerService">The task manager service for executing tasks</param> protected AbstractMonitoringService(SrcMLServicePackage serviceProvider, ITaskManagerService taskManagerService) { ServiceProvider = serviceProvider; SaveTimer = new ReentrantTimer(Save, GlobalScheduler); SaveInterval = DEFAULT_SAVE_INTERVAL; _isMonitoring = false; _isUpdating = false; if (taskManagerService != null) { this.TaskManager = taskManagerService; } }
/// <summary> /// Constructor. /// </summary> /// <param name="sp"></param> /// <param name="extensionDirectory"></param> public SrcMLGlobalService(IServiceProvider sp, string extensionDirectory) { SrcMLFileLogger.DefaultLogger.InfoFormat("Constructing a new instance of SrcMLGlobalService in {0}", extensionDirectory); serviceProvider = sp; SrcMLServiceDirectory = extensionDirectory; statusBar = (IVsStatusbar) Package.GetGlobalService(typeof(SVsStatusbar)); _taskManager = (ITaskManagerService) Package.GetGlobalService(typeof(STaskManagerService)); SaveTimer = new ReentrantTimer(() => CurrentMonitor.Save(), _taskManager.GlobalScheduler); SaveInterval = DEFAULT_SAVE_INTERVAL; }