예제 #1
0
        public static void SaveSystemConfig()
        {
            if (SystemConfig != null)
            {
                // 'copy' the current details (nodes/elements/controllers) from the executing state
                // to the SystemConfig, so they're there for writing when we save

                // we may not want to always save the disabled devices to the config (ie. if the system is stopped at the
                // moment) since the disabled devices are inferred from the running status of active devices
                if (_state == RunState.Started)
                {
                    SaveDisabledDevices();
                }

                SystemConfig.OutputControllers      = OutputControllers;
                SystemConfig.SmartOutputControllers = SmartOutputControllers;
                SystemConfig.Previews          = Previews;
                SystemConfig.Elements          = Elements;
                SystemConfig.Nodes             = Nodes.GetRootNodes();
                SystemConfig.ControllerLinking = ControllerLinking;
                SystemConfig.Filters           = Filters;
                SystemConfig.DataFlow          = DataFlow;

                SystemConfig.Save();
            }

            if (ModuleStore != null)
            {
                ModuleStore.Save();
            }
        }
예제 #2
0
        /// <summary>
        /// Saves the system config.
        /// </summary>
        /// <returns>Queue of Tasks that are processing the saving. Can be monitored if next steps require saving to be complete.</returns>
        public static Queue <Task> SaveSystemConfig()
        {
            var taskQueue = new Queue <Task>();

            if (SystemConfig != null)
            {
                // 'copy' the current details (nodes/elements/controllers) from the executing state
                // to the SystemConfig, so they're there for writing when we save

                // we may not want to always save the disabled devices to the config (ie. if the system is stopped at the
                // moment) since the disabled devices are inferred from the running status of active devices
                if (_state == RunState.Started)
                {
                    SaveDisabledDevices();
                }

                SystemConfig.OutputControllers = OutputControllers;
                //SystemConfig.SmartOutputControllers = SmartOutputControllers;
                SystemConfig.Previews = Previews;
                SystemConfig.Elements = Elements;
                SystemConfig.Nodes    = Nodes.GetRootNodes();
                SystemConfig.Filters  = Filters;
                SystemConfig.DataFlow = DataFlow;

                taskQueue.Enqueue(Task.Factory.StartNew(() => SystemConfig.Save()));
            }

            if (ModuleStore != null)
            {
                taskQueue.Enqueue(Task.Factory.StartNew(() => ModuleStore.Save()));
            }

            return(taskQueue);
        }
예제 #3
0
        public static async Task <bool> SaveModuleConfigAsync()
        {
            if (ModuleStore != null)
            {
                if (_moduleConfigSaving)
                {
                    Logging.Error("Module config is already being saved. Skipping duplicate request.");
                    return(false);
                }

                _moduleConfigSaving = true;
                Logging.Info("Saving Module Config.");
                return(await Task.Factory.StartNew(() =>
                {
                    ModuleStore.Save();
                    _moduleConfigSaving = false;
                    Logging.Info("Module Config saved.");
                    return true;
                }));
            }
            return(false);
        }
예제 #4
0
 public XmlModuleStoreFilePolicy(ModuleStore moduleStore, XElement content)
 {
     _moduleStore = moduleStore;
     _content = content;
 }
예제 #5
0
파일: FileService.cs 프로젝트: stewmc/vixen
 public void SaveModuleStoreFile(ModuleStore moduleStore, string filePath)
 {
     IObjectPersistor<ModuleStore> persistor = PersistorFactory.Instance.CreateModuleStorePersistor();
     persistor.SaveToFile(moduleStore, filePath);
 }
예제 #6
0
파일: FileService.cs 프로젝트: stewmc/vixen
 public void SaveModuleStoreFile(ModuleStore moduleStore)
 {
     SaveModuleStoreFile(moduleStore, ModuleStore.DefaultFilePath);
 }