예제 #1
0
 internal void StopMonitoringCobolFile(LocalCobolFile localCobolFile)
 {
     // Unregister a file to monitor
     if (filesToMonitor != null && filesToMonitor.ContainsKey(localCobolFile.FullPath))
     {
         filesToMonitor.Remove(localCobolFile.FullPath);
     }
 }
예제 #2
0
        /// <summary>
        /// Returns an object representing a local or remote Cobol file
        /// </summary>
        public bool TryGetFile(string textName, out CobolFile cobolFile)
        {
            string absoluteFilePath = FindFirstMatchingFilePath(textName);

            if (absoluteFilePath != null)
            {
                cobolFile = new LocalCobolFile(textName, absoluteFilePath, encoding, endOfLineDelimiter, fixedLineLength);
                return(true);
            }
            else
            {
                cobolFile = null;
                return(false);
            }
        }
예제 #3
0
        internal void StartMonitoringCobolFile(LocalCobolFile localCobolFile)
        {
            // Register the full path of a file to monitor
            if (filesToMonitor == null)
            {
                filesToMonitor = new Dictionary <string, LocalCobolFile>();
            }
            filesToMonitor.Add(localCobolFile.FullPath, localCobolFile);

            // Lazy initialization of FileSystemWatcher
            if (fileSystemWatcher == null)
            {
                fileSystemWatcher = new FileSystemWatcher(rootDirectory.FullName);
                fileSystemWatcher.IncludeSubdirectories = includeSubdirectories;
                fileSystemWatcher.Changed            += fileSystemWatcher_Changed;
                fileSystemWatcher.Renamed            += fileSystemWatcher_Renamed;
                fileSystemWatcher.Deleted            += fileSystemWatcher_Deleted;
                fileSystemWatcher.EnableRaisingEvents = true;
            }
        }
 internal void StopMonitoringCobolFile(LocalCobolFile localCobolFile)
 {
     // Unregister a file to monitor
     if(filesToMonitor != null && filesToMonitor.ContainsKey(localCobolFile.FullPath))
     {
         filesToMonitor.Remove(localCobolFile.FullPath);
     }
 }
        internal void StartMonitoringCobolFile(LocalCobolFile localCobolFile)
        {
            // Register the full path of a file to monitor
            if (filesToMonitor == null)
            {
                filesToMonitor = new Dictionary<string, LocalCobolFile>();
            }
            filesToMonitor.Add(localCobolFile.FullPath, localCobolFile);

            // Lazy initialization of FileSystemWatcher
            if (fileSystemWatcher == null)
            {
                fileSystemWatcher = new FileSystemWatcher(rootDirectory.FullName);
                fileSystemWatcher.IncludeSubdirectories = includeSubdirectories;
                fileSystemWatcher.Changed += fileSystemWatcher_Changed;
                fileSystemWatcher.Renamed += fileSystemWatcher_Renamed;
                fileSystemWatcher.Deleted += fileSystemWatcher_Deleted;
                fileSystemWatcher.EnableRaisingEvents = true;
            }
        }
 /// <summary>
 /// Returns an object representing a local or remote Cobol file
 /// </summary>
 public bool TryGetFile(string textName, out CobolFile cobolFile)
 {
     string absoluteFilePath = FindFirstMatchingFilePath(textName);
     if(absoluteFilePath != null)
     {
         cobolFile = new LocalCobolFile(textName, absoluteFilePath, encoding, endOfLineDelimiter, fixedLineLength);
         return true;
     }
     else
     {
         cobolFile = null;
         return false;
     }
 }