当前位置: 首页>>代码示例>>C#>>正文


C# FileSystemEventHandler类代码示例

本文整理汇总了C#中FileSystemEventHandler的典型用法代码示例。如果您正苦于以下问题:C# FileSystemEventHandler类的具体用法?C# FileSystemEventHandler怎么用?C# FileSystemEventHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileSystemEventHandler类属于命名空间,在下文中一共展示了FileSystemEventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FileWatcher

 public FileWatcher(string filepath, FileChangedHandler handler)
     : base(System.IO.Path.GetDirectoryName(filepath),
     System.IO.Path.GetFileName(filepath))
 {
     FilePath = filepath;
     Handler = handler;
     NotifyFilter =
         NotifyFilters.FileName |
         NotifyFilters.Attributes |
         NotifyFilters.LastAccess |
         NotifyFilters.LastWrite |
         NotifyFilters.Security |
         NotifyFilters.Size;
     Changed += new FileSystemEventHandler(delegate(object sender, FileSystemEventArgs e)
     {
         // TODO : Find alternative !!
         /*
         System.Windows.Application.Current.Dispatcher.BeginInvoke(
             new VoidDelegate(this.FileChanged));
          */
     });
     UpdateFileInfo();
     Timer = new Timer(100);
     Timer.AutoReset = false;
     Timer.Elapsed += new ElapsedEventHandler(delegate(object sender, ElapsedEventArgs e)
     {
         // TODO : Find alternative !!
         /*
         System.Windows.Application.Current.Dispatcher.BeginInvoke(
             new VoidDelegate(this.TimerElapsed));
          */
     });
     EnableRaisingEvents = true;
 }
开发者ID:Twinside,项目名称:CodeOverview,代码行数:34,代码来源:FileWatcher.cs

示例2: OnChangeOrCreation

        public static FileSystemWatcher OnChangeOrCreation(this FileSystemWatcher watcher, FileSystemEventHandler handler)
        {
            watcher.Changed += handler;
            watcher.Created += handler;

            return watcher;
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:7,代码来源:FileWatcherManifest.cs

示例3: InitFormOnce

        private void InitFormOnce()
        {
            cboProfile.SelectedIndexChanged += new EventHandler(cboProfile_SelectedIndexChanged);

            _textFileChangedHandler = new FileSystemEventHandler(_host_TextFileChanged);
            _host.TextFileChanged += _textFileChangedHandler;

            LoadProfiles();
            PluginUtils.InitPluginGrid(dgvPlugin);

            #region Init values
            nudLoopCount.Value = Config.DeobfFlowOptionBranchLoopCount;
            nudMaxRefCount.Value = Config.DeobfFlowOptionMaxRefCount;
            txtRegex.Text = Config.LastRegex;

            InitBranchDirection(cboDirection);

            if (Config.DeobfFlowOptionBranchDirection >= 0 && Config.DeobfFlowOptionBranchDirection < cboDirection.Items.Count)
            {
                cboDirection.SelectedIndex = Config.DeobfFlowOptionBranchDirection;
            }
            else
            {
                cboDirection.SelectedIndex = 0;
            }
            #endregion
        }
开发者ID:manojdjoshi,项目名称:simple-assembly-exploror,代码行数:27,代码来源:frmDeobf.cs

示例4: GetDocument

        internal static IDocument GetDocument(string fullPath, FileSystemEventHandler fileDeletedCallback = null)
        {
            if (string.IsNullOrWhiteSpace(fullPath))
            {
                return null;
            }

            var fileName = fullPath.ToLowerInvariant();

            IDocument currentDocument;
            if (DocumentLookup.TryGetValue(fileName, out currentDocument))
            {
                return currentDocument;
            }

            var factory = GetFactory(fileName);

            if (factory == null)
            {
                return null;
            }

            currentDocument = factory(fullPath, fileDeletedCallback);

            if (currentDocument == null)
            {
                return null;
            }

            return DocumentLookup.AddOrUpdate(fileName, x => currentDocument, (x, e) => currentDocument);
        }
开发者ID:robert-hoffmann,项目名称:WebEssentials2013,代码行数:31,代码来源:DocumentFactory.cs

示例5: FileWacher

 /// <summary>
 /// Will create a FileSystemWatcher on every directory, including and contained in the directory passed in
 /// </summary>
 /// <param name="basepath">directory path</param>
 /// <param name="handler">Method, signature must accept object, FileSystemEventArgs</param>
 public FileWacher(string basepath, FileSystemEventHandler handler)
 {
     _basepath = basepath;
     _watchers = new List<FileSystemWatcher>();
     _handler = handler;
     BuildWatchers(_basepath);
 }
开发者ID:Roballen,项目名称:Utilities,代码行数:12,代码来源:FileWatcher.cs

示例6: CreateWatch

        void CreateWatch(string dirPath, FileSystemEventHandler handler)
        {
            if (_watchers.ContainsKey(dirPath))
            {
                _watchers[dirPath].Dispose();
                _watchers[dirPath] = null;
            }

            if (!Directory.Exists(dirPath)) return;

            var watcher = new FileSystemWatcher();
            watcher.IncludeSubdirectories = false;//includeSubdirectories;
            watcher.Path = dirPath;
            watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size;
            watcher.Filter = "*";
            watcher.Changed += handler;
            watcher.EnableRaisingEvents = true;
            watcher.InternalBufferSize = 10240;
            //return watcher;
            _watchers[dirPath] = watcher;


            foreach (var childDirPath in Directory.GetDirectories(dirPath))
            {
                CreateWatch(childDirPath, handler);
            }
        }
开发者ID:s3chugo,项目名称:KEngine,代码行数:27,代码来源:KDirectoryWatcher.cs

示例7: FileChangeEventTarget

 internal FileChangeEventTarget(string fileName, OnChangedCallback onChangedCallback) {
     _fileName = fileName;
     _onChangedCallback = onChangedCallback;
     _changedHandler = new FileSystemEventHandler(this.OnChanged);
     _errorHandler = new ErrorEventHandler(this.OnError);
     _renamedHandler = new RenamedEventHandler(this.OnRenamed);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:FileChangeNotificationSystem.cs

示例8: SetChangedHandler

 public void SetChangedHandler(FileSystemEventHandler handler)
 {
     if (_fileWatcher != null)
     {
         _fileWatcher.Changed += handler;
     }
 }
开发者ID:japj,项目名称:vulcan,代码行数:7,代码来源:WatchableFile.cs

示例9: RemoveChangedHandler

 public void RemoveChangedHandler(FileSystemEventHandler handler)
 {
     if (_fileWatcher != null)
     {
         _fileWatcher.Changed -= handler;
     }
 }
开发者ID:japj,项目名称:vulcan,代码行数:7,代码来源:WatchableFile.cs

示例10: dynFileReader

        public dynFileReader()
        {
            handler = new FileSystemEventHandler(watcher_FileChanged);

            InPortData.Add(new PortData("path", "Path to the file", typeof(string)));
            OutPortData.Add(new PortData("contents", "File contents", typeof(string)));

            NodeUI.RegisterAllPorts();
        }
开发者ID:prathameshp,项目名称:Dynamo,代码行数:9,代码来源:dynFiles.cs

示例11: dynFileReader

        public dynFileReader()
        {
            this.handler = new FileSystemEventHandler(watcher_FileChanged);

            InPortData.Add(new PortData("path", "Path to the file", typeof(string)));
            OutPortData = new PortData("contents", "File contents", typeof(string));

            base.RegisterInputsAndOutputs();
        }
开发者ID:Dewb,项目名称:Dynamo,代码行数:9,代码来源:dynFiles.cs

示例12: FileSystemWatcherOptions

 public FileSystemWatcherOptions(string path, string filter, FileSystemEventHandler changedAction, FileSystemEventHandler createdAction, ErrorEventHandler errorAction, FileSystemEventHandler deletedAction, RenamedEventHandler renamedAction)
 {
     Path = path;
     Filter = filter;
     ChangedAction = changedAction;
     CreatedAction = createdAction;
     ErrorAction = errorAction;
     DeletedAction = deletedAction;
     RenamedAction = renamedAction;
 }
开发者ID:michaelsync,项目名称:Giles,代码行数:10,代码来源:FileSystemWatcherOptions.cs

示例13: WrapFileDescriptor

 public WrapFileDescriptor(string path, IWrapRepository wraps, FileSystemEventHandler handler)
 {
     Repository = wraps;
     Clients = new List<IWrapAssemblyClient>();
     FilePath = path;
     FileSystemWatcher = new FileSystemWatcher(Path.GetDirectoryName(path), Path.GetFileName(path))
     {
         NotifyFilter = NotifyFilters.LastWrite
     };
     FileSystemWatcher.Changed += handler;
     FileSystemWatcher.EnableRaisingEvents = true;
 }
开发者ID:holytshirt,项目名称:openwrap,代码行数:12,代码来源:WrapDescriptorMonitor.cs

示例14: FileWatcher

 /// <summary>
 /// Create watcher for the specified file and monitor changes
 /// </summary>
 /// <param name="file_changed_func"></param>
 public FileWatcher(FileSystemEventHandler file_changed_func)
 {
     watcher = new FileSystemWatcher();
     watcher.Path = Config.get_game_path();
     //Always check the last write to the file
     watcher.NotifyFilter = NotifyFilters.LastWrite;
     watcher.Filter = "Chat.log";
     //Callback
     watcher.Changed += new FileSystemEventHandler(file_changed_func);
     //Start watching
     watcher.EnableRaisingEvents = true;
 }
开发者ID:BryanHurst,项目名称:Aion-DamageTracker,代码行数:16,代码来源:FileWatcher.cs

示例15: FolderChangeWatcher

        /// <summary>
        /// Watches a folder for folder creation
        /// </summary>
        /// <param name="path">Which folder or fileshare to watch</param>
        /// <param name="actionOnFolderCreated">Action to perform when a change is detected. The action is invoked asynchronosly</param>
        public FolderChangeWatcher(string path, FileSystemEventHandler actionOnFolderCreated)
        {
            if (actionOnFolderCreated == null)
                throw new ArgumentNullException("actionOnFolderCreated");

            _actionOnFolderCreated = actionOnFolderCreated;
            _watcher = new FileSystemWatcher(path);
            _watcher.Created += OnFolderCreated;

            _watcher.InternalBufferSize = 16384; //16KB buffer instead of 4KB (default).
            _watcher.IncludeSubdirectories = false;
            _watcher.EnableRaisingEvents = true;
        }
开发者ID:consumentor,项目名称:Server,代码行数:18,代码来源:FolderChangeWatcher.cs


注:本文中的FileSystemEventHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。