Exemplo n.º 1
0
        public void Watch(bool refreshContent, IApplicationObserver observer)
        {
            _appDomainWatcher = new AppDomainFileChangeWatcher(observer.RecycleAppDomain);
            _appDomainWatcher.WatchBinariesAt(BinPath);


            if (!refreshContent)
            {
                return;
            }

            var watchedDirectory = PublicAssetFolder.IsNotEmpty() ? PublicAssetFolder : ApplicationPath;
            var pattern          = "*.css;*.js";

            ContentMatches.Each(ext =>
            {
                if (!ext.StartsWith("*"))
                {
                    ext = "*" + ext;
                }
                pattern += ";" + ext;
            });

            var assetFileSet = FileSet.Deep(pattern);

            _watcher = new FileChangeWatcher(watchedDirectory, assetFileSet, new ContentRefresher(observer));
        }
Exemplo n.º 2
0
        public void Watch(bool refreshContent, IApplicationObserver observer)
        {
            _appDomainWatcher = new AppDomainFileChangeWatcher(observer.RecycleAppDomain);
            _appDomainWatcher.WatchBinariesAt(BinPath);


            if (!refreshContent)
            {
                return;
            }

            var watchedDirectory = PublicAssetFolder.IsNotEmpty() ? PublicAssetFolder : ApplicationPath;
            var pattern = "*.css;*.js";
            ContentMatches.Each(ext =>
            {
                if (!ext.StartsWith("*")) ext = "*" + ext;
                pattern += ";" + ext;
            });

            var assetFileSet = FileSet.Deep(pattern);

            _watcher = new FileChangeWatcher(watchedDirectory, assetFileSet, new ContentRefresher(observer));
        }
Exemplo n.º 3
0
 public FubuMvcApplicationFileWatcher(IApplicationObserver observer, IFileMatcher matcher)
 {
     _observer = observer;
     _matcher = matcher;
 }
Exemplo n.º 4
0
 public void RemoveObserver(IApplicationObserver observer)
 {
     _appObservers.Remove(observer);
 }
Exemplo n.º 5
0
 public void AddObserver(IApplicationObserver observer)
 {
     _appObservers.Add(observer);
 }
Exemplo n.º 6
0
 public ContentRefresher(IApplicationObserver observer)
 {
     _observer = observer;
 }
Exemplo n.º 7
0
        public void Watch(bool refreshContent, IApplicationObserver observer)
        {
            FileSystemEventHandler appDomain = (o, args) => {
                StopWatching();
                observer.RecycleAppDomain();
            };

            FileSystemEventHandler reload = (o, args) => {
                var watcher = o.As<FileSystemWatcher>();

                watcher.EnableRaisingEvents = false;

                try
                {
                    observer.RefreshContent();
                }
                finally
                {
                    watcher.EnableRaisingEvents = true;
                }
            };

            add(BinPath, "*.dll").OnChangeOrCreation(appDomain);
            add(BinPath, "*.exe").OnChangeOrCreation(appDomain);

            if (ConfigurationFile.IsNotEmpty())
            {
                add(ApplicationPath, ConfigurationFile).OnChangeOrCreation(appDomain);
            }

            if (!refreshContent)
            {
                return;
            }

            if (PublicAssetFolder.IsNotEmpty())
            {
                add(PublicAssetFolder, "*.js").OnChange(reload);
                add(PublicAssetFolder, "*.jsx").OnChange(reload);
                add(PublicAssetFolder, "*.css").OnChange(reload);
            }
            else
            {
                add(ApplicationPath, "*.js").OnChange(reload);
                add(ApplicationPath, "*.jsx").OnChange(reload);
                add(ApplicationPath, "*.css").OnChange(reload);

                LinkedFolders.Each(x => {
                    add(x, "*.js").OnChange(reload);
                    add(x, "*.jsx").OnChange(reload);
                    add(x, "*.css").OnChange(reload);
                });
            }

            ContentMatches.Each(ext => {
                if (!ext.StartsWith("*")) ext = "*" + ext;

                add(ApplicationPath, ext).OnChange(reload);

                LinkedFolders.Each(folder => add(folder, ext).OnChangeOrCreation(reload));
            });
        }
Exemplo n.º 8
0
 public ContentRefresher(IApplicationObserver observer)
 {
     _observer = observer;
 }
 public FubuMvcApplicationFileWatcher(IApplicationObserver observer, IFileMatcher matcher)
 {
     _observer = observer;
     _matcher  = matcher;
 }
Exemplo n.º 10
0
        public void Watch(bool refreshContent, IApplicationObserver observer)
        {
            FileSystemEventHandler appDomain = (o, args) => {
                StopWatching();
                observer.RecycleAppDomain();
            };

            FileSystemEventHandler reload = (o, args) => {
                var watcher = o.As <FileSystemWatcher>();

                watcher.EnableRaisingEvents = false;

                try
                {
                    observer.RefreshContent();
                }
                finally
                {
                    watcher.EnableRaisingEvents = true;
                }
            };

            add(BinPath, "*.dll").OnChangeOrCreation(appDomain);
            add(BinPath, "*.exe").OnChangeOrCreation(appDomain);

            if (ConfigurationFile.IsNotEmpty())
            {
                add(ApplicationPath, ConfigurationFile).OnChangeOrCreation(appDomain);
            }

            if (!refreshContent)
            {
                return;
            }

            if (PublicAssetFolder.IsNotEmpty())
            {
                add(PublicAssetFolder, "*.js").OnChange(reload);
                add(PublicAssetFolder, "*.jsx").OnChange(reload);
                add(PublicAssetFolder, "*.css").OnChange(reload);
            }
            else
            {
                add(ApplicationPath, "*.js").OnChange(reload);
                add(ApplicationPath, "*.jsx").OnChange(reload);
                add(ApplicationPath, "*.css").OnChange(reload);

                LinkedFolders.Each(x => {
                    add(x, "*.js").OnChange(reload);
                    add(x, "*.jsx").OnChange(reload);
                    add(x, "*.css").OnChange(reload);
                });
            }

            ContentMatches.Each(ext => {
                if (!ext.StartsWith("*"))
                {
                    ext = "*" + ext;
                }

                add(ApplicationPath, ext).OnChange(reload);

                LinkedFolders.Each(folder => add(folder, ext).OnChangeOrCreation(reload));
            });
        }