• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FileSystemEventHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: WatchedFile

        public WatchedFile(string filePath, FileSystemEventHandler eventHandler)
            : base(filePath)
        {
            string fileName = Path.GetFileName(ResourcePath);
            string directoryPath = Path.GetDirectoryName(ResourcePath);

            _watcher = new FileSystemWatcher(directoryPath, fileName);
            _watcher.Changed += OnWatcherEvent;
            _watcher.NotifyFilter = NotifyFilters.LastWrite;
            _watcher.EnableRaisingEvents = true;

            AddHandler(eventHandler);
        }
开发者ID:nilllzz,项目名称:Pokemon3D,代码行数:13,代码来源:WatchedFile.cs


示例17: FileSystemWatcher_Deleted

    public static void FileSystemWatcher_Deleted()
    {
        using (FileSystemWatcher watcher = new FileSystemWatcher())
        {
            var handler = new FileSystemEventHandler((o, e) => { });

            // add / remove
            watcher.Deleted += handler;
            watcher.Deleted -= handler;

            // shouldn't throw
            watcher.Deleted -= handler;
        }
    }
开发者ID:johnhhm,项目名称:corefx,代码行数:14,代码来源:FileSystemWatcher.unit.cs


示例18: FileChangeWatcher

        /// <summary>
        /// Watches a folder for file changes matching filter
        /// </summary>
        /// <param name="path">Which folder or fileshare to watch</param>
        /// <param name="fileFilter">Which files to wathc for, ex *.txt</param>
        /// <param name="actionOnFileChanged">Action to perform when a change is detected. The action is invoked asynchronosly</param>
        /// <param name="filter">Which changes to act upon</param>
        public FileChangeWatcher(string path, string fileFilter, FileSystemEventHandler actionOnFileChanged, NotifyFilters filter)
        {
            if (actionOnFileChanged == null)
                throw new ArgumentNullException("actionOnFileChanged");

            _actionOnFileChanged = actionOnFileChanged;
            _watcher = new FileSystemWatcher(path, fileFilter);
            _watcher.Changed += OnFileChanged;

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


示例19: Watch

 public static FileSystemWatcher Watch(string path, FileSystemEventHandler handler)
 {
     var directory = Path.GetDirectoryName(path);
     var filename = Path.GetFileName(path);
     var fileSystemWatcher = new FileSystemWatcher
                                 {
                                     Path = directory,
                                     NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
                                                    | NotifyFilters.FileName | NotifyFilters.DirectoryName,
                                     Filter = filename
                                 };
     fileSystemWatcher.Created += handler;
     fileSystemWatcher.Changed += handler;
     fileSystemWatcher.EnableRaisingEvents = true;
     return fileSystemWatcher;
 }
开发者ID:stangelandcl,项目名称:seatest,代码行数:16,代码来源:FileSystem.cs


示例20: 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) {
         Handler(FilePath);
     });
     EnableRaisingEvents = true;
 }
开发者ID:managedfusion,项目名称:managedfusion-rewriter-proxy,代码行数:17,代码来源:FileWatcher.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FileSystemHelper类代码示例发布时间:2022-05-24
下一篇:
C# FileSystem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap