예제 #1
0
        static void Main(string[] args)
        {
            var autoreloadPath = "_autoreload";
            var lastUpdate     = DateTime.Now;

            using (var dirCopy = new LiveDirCopy(new DirectoryInfo("."), autoreloadPath))
                using (var runner = new OwinRunner(autoreloadPath))
                    using (var watcher = new DirWatcher(".", autoreloadPath))
                    {
                        runner.Start();

                        Observable
                        .FromEventPattern(watcher, "OnChanged")
                        .Select(PathFromEventArgs)
                        .Buffer(EveryHalfSecond())
                        .Where(SomethingHasHappened)
                        .Select(paths => paths.Distinct())
                        .Subscribe(paths =>
                        {
                            runner.Stop();
                            foreach (var path in paths)
                            {
                                dirCopy.Update(path);
                            }
                            runner.Start();
                        });

                        Console.WriteLine("...");
                        Console.ReadLine();
                    }
        }
예제 #2
0
파일: Program.cs 프로젝트: nyctef/evefifo
        static void Main(string[] args)
        {
            var autoreloadPath = "_autoreload";
            var lastUpdate = DateTime.Now;
            using (var dirCopy = new LiveDirCopy(new DirectoryInfo("."), autoreloadPath))
            using (var runner = new OwinRunner(autoreloadPath))
            using (var watcher = new DirWatcher(".", autoreloadPath))
            {
                runner.Start();

                Observable
                    .FromEventPattern(watcher, "OnChanged")
                    .Select(PathFromEventArgs)
                    .Buffer(EveryHalfSecond())
                    .Where(SomethingHasHappened)
                    .Select(paths => paths.Distinct())
                    .Subscribe(paths =>
                        {
                            runner.Stop();
                            foreach (var path in paths)
                            {
                                dirCopy.Update(path);
                            }
                            runner.Start();
                        });

                Console.WriteLine("...");
                Console.ReadLine();
            }
        }