System.IO.FileSystemWatcher.WaitForChanged C# (CSharp) Méthode

WaitForChanged() public méthode

public WaitForChanged ( System changeType ) : System.IO.WaitForChangedResult
changeType System
Résultat System.IO.WaitForChangedResult
        public System.IO.WaitForChangedResult WaitForChanged(System.IO.WatcherChangeTypes changeType) { throw null; }
        public System.IO.WaitForChangedResult WaitForChanged(System.IO.WatcherChangeTypes changeType, int timeout) { throw null; }

Same methods

FileSystemWatcher::WaitForChanged ( System changeType, int timeout ) : System.IO.WaitForChangedResult
FileSystemWatcher::WaitForChanged ( WatcherChangeTypes changeType ) : WaitForChangedResult
FileSystemWatcher::WaitForChanged ( WatcherChangeTypes changeType, int timeout ) : WaitForChangedResult

Usage Example

Exemple #1
0
        private static void ReadFromFile()
        {
            long offset = 0;

            FileSystemWatcher fsw = new FileSystemWatcher
            {
                Path = "C:\\Share\\1",
                Filter = "INDICATE_REPORT.txt"
            };

            FileStream file = File.Open(
                FilePathWip21,
                FileMode.Open,
                FileAccess.Read,
                FileShare.Write);

            StreamReader reader = new StreamReader(file);
            while (true)
            {
                fsw.WaitForChanged(WatcherChangeTypes.Changed);

                file.Seek(offset, SeekOrigin.Begin);
                if (!reader.EndOfStream)
                {
                    do
                    {
                        Console.WriteLine(reader.ReadLine());
                    } while (!reader.EndOfStream);

                    offset = file.Position;
                }
            }
        }
All Usage Examples Of System.IO.FileSystemWatcher::WaitForChanged