예제 #1
0
        private static void SubscribeToFileChangeNotifier()
        {
            const string jsonFilter = "*.json";

            try
            {
                FileChangeNotifier.StartFileWatch(
                    jsonFilter,
                    Paths.ElementColorInfosDirectory,
                    OnElementColorsInfosChanged);
                FileChangeNotifier.StartFileWatch(
                    jsonFilter,
                    Paths.TypeColorOffsetsDirectory,
                    OnTypeColorOffsetsChanged);

                FileChangeNotifier.StartFileWatch(
                    Paths.MaterialColorStateFileName,
                    Paths.MaterialConfigPath,
                    OnMaterialStateChanged);

                if (State.TemperatureOverlayState.CustomRangesEnabled)
                {
                    FileChangeNotifier.StartFileWatch(
                        Paths.TemperatureStateFileName,
                        Paths.OverlayConfigPath,
                        OnTemperatureStateChanged);
                }
            }
            catch (Exception e)
            {
                State.Logger.Log("SubscribeToFileChangeNotifier failed");
                State.Logger.Log(e);
            }
        }
예제 #2
0
        private void SubscribeToFileChangeNotifier()
        {
            const string jsonFilter = "*.json";

            try
            {
                FileChangeNotifier.StartFileWatch
                (
                    jsonFilter,
                    Paths.ElementColorInfosDirectory,
                    OnElementColorsInfosChanged
                );

                FileChangeNotifier.StartFileWatch
                (
                    Paths.MaterialColorStateFileName,
                    Paths.MaterialConfigPath,
                    OnMaterialStateChanged
                );
            }
            catch (Exception e)
            {
                State.Logger.Log("SubscribeToFileChangeNotifier failed");
                State.Logger.Log(e);
            }
        }
예제 #3
0
        private FileChangeNotifier[] WorkOrderMonitor = new FileChangeNotifier[2]; // If loading WO same with unloading WO , use only 1 monitor

        public WorkOrderInfo(string LocalWorkOrderDir, string LogDir, char LoadingStationCode)
        {
            loading   = new WorkOrderData(LocalWorkOrderDir, LogDir, LoadingStationCode.ToString());
            unloading = new WorkOrderData(LocalWorkOrderDir, LogDir, LoadingStationCode.ToString());

            for (int i = 0; i < WorkOrderMonitor.Length; i++)
            {
                WorkOrderMonitor[i] = new FileChangeNotifier();
                WorkOrderMonitor[i].OnWorkOrderContentChanged += new FileChangeNotifier.WOContentChangedHandler(WorkOrderInfo_OnWorkOrderContentChanged);
            }
        }
        private void InitialiseFileWatcher()
        {
            if (HasFile == false)
            {
                return;
            }

            TimeSpan pauseWatchingInterval = TimeSpan.FromSeconds(2);
            TimeSpan delayNotificationBy   = TimeSpan.FromMilliseconds(1000);

            _watcher          = new FileChangeNotifier(_filePath);
            _watcher.Changed += (sender, args) => ValidateFileAndRaiseSettingsChanged();
        }
예제 #5
0
        // TODO: too many parameters are needed for stopping file watch, fix oni-common
        public void Dispose()
        {
            FileChangeNotifier.StopFileWatch
            (
                Paths.MaterialColorStateFileName,
                Paths.MaterialConfigPath,
                OnMaterialStateChanged
            );

            FileChangeNotifier.StopFileWatch
            (
                "*.json",
                Paths.ElementColorInfosDirectory,
                OnElementColorsInfosChanged
            );
        }
예제 #6
0
        private static void SubscribeToFileChangeNotifier()
        {
            var jsonFilter = "*.json";

            try
            {
                FileChangeNotifier.StartFileWatch(jsonFilter, Paths.ElementColorInfosDirectory, OnElementColorsInfosChanged);
                FileChangeNotifier.StartFileWatch(jsonFilter, Paths.TypeColorOffsetsDirectory, OnTypeColorOffsetsChanged);

                FileChangeNotifier.StartFileWatch(Paths.MaterialColorStateFileName, Paths.MaterialConfigPath, OnMaterialStateChanged);
            }
            catch (Exception e)
            {
                State.Logger.Log("SubscribeToFIleChangeNotifierFailed");
                State.Logger.Log(e);
            }
        }
        static DynamicLanguageHttpModule()
        {
            s_globalVirtualPathWithoutExtension = VirtualPathUtility.ToAbsolute("~/" + globalFileName);

            foreach (string extension in EngineHelper.FileExtensions)
            {
                // Register for global.<ext> file change notifications
                FileChangeNotifier.Register(Path.Combine(HttpRuntime.AppDomainAppPath, globalFileName + extension),
                                            OnFileChanged);
            }

            // Create string with the special response header
            string  mwName     = typeof(DynamicLanguageHttpModule).Assembly.FullName.Split(',')[0];
            Version mwVersion  = typeof(DynamicLanguageHttpModule).Assembly.GetName().Version;
            Version dlrVersion = typeof(ScriptEngine).Assembly.GetName().Version;

            s_merlinWebHeader = string.Format("{0} v{1}.{2}(CTP); DLR v{3}.{4}",
                                              mwName, mwVersion.Major, mwVersion.Minor, dlrVersion.Major, dlrVersion.Minor);
        }
예제 #8
0
        private static void SubscribeToFileChangeNotifier()
        {
            const string jsonFilter = "*.json";

            try
            {
                if (State.TemperatureOverlayState.CustomRangesEnabled)
                {
                    FileChangeNotifier.StartFileWatch(
                        Paths.TemperatureStateFileName,
                        Paths.MaterialConfigPath,
                        OnTemperatureStateChanged);
                }
            }
            catch (Exception e)
            {
                State.Logger.Log("SubscribeToFileChangeNotifier failed");
                State.Logger.Log(e);
            }
        }
예제 #9
0
        static EngineHelper()
        {
            // Add the App_Script folder to the path to allow script files to be imported from there
            string appPath = System.Web.HttpRuntime.AppDomainAppPath;

            s_scriptFolder = Path.Combine(appPath, ScriptFolderName);

            var setup = ScriptRuntimeSetup.ReadConfiguration();

            // Set the host type
            setup.HostType = typeof(WebScriptHost);

            setup.Options["SearchPaths"] = new string[] { s_scriptFolder };

            s_scriptEnvironment = new ScriptRuntime(setup);
            s_scriptEnvironment.LoadAssembly(typeof(ControlMembersInjector).Assembly);      // for our member injectors


            // Register for notifications when something in App_Script changes
            FileChangeNotifier.Register(s_scriptFolder, OnAppScriptFileChanged);

            List <string> fileExtensions = new List <string>();

            foreach (var language in s_scriptEnvironment.Setup.LanguageSetups)
            {
                fileExtensions.AddRange(language.FileExtensions);
            }
            s_fileExtensions = Array.ConvertAll(fileExtensions.ToArray(), e => e.ToLower());

            List <string> simpleNames = new List <string>();

            foreach (var language in s_scriptEnvironment.Setup.LanguageSetups)
            {
                simpleNames.AddRange(language.Names);
            }
            s_languageIds = Array.ConvertAll(simpleNames.ToArray(), n => n.ToLower());
        }
예제 #10
0
        private static void StartConfigFileWatcher()
        {
            FileChangeNotifier.StartFileWatch(Paths.OnionStateFileName, Paths.OnionConfigPath, OnConfigChanged);

            _logger.Log("Config file watcher started");
        }
예제 #11
0
        private static void StartConfigFileWatcher()
        {
            FileChangeNotifier.StartFileWatch("OnionPatchesState.json", Paths.GetModsPath() + Path.DirectorySeparatorChar + "OnionPatches" + Path.DirectorySeparatorChar + "Config", OnConfigChanged);

            _logger.Log("Config file watcher started");
        }
예제 #12
0
파일: Hooks.cs 프로젝트: pata1994/ONI-Mods
        /*
         * private static void ResetGridSettingsChunks(int width, int height)
         * {
         *  GridSettings.Reset(width * 32, height * 32);
         * }
         */

        private static void StartConfigFileWatcher()
        {
            FileChangeNotifier.StartFileWatch(Paths.GetStateFileName("ONI-Common"), Paths.GetStatePath("ONI-Common"), OnConfigChanged);

            _logger.Log("Config file watcher started");
        }