예제 #1
0
파일: VixenSystem.cs 프로젝트: lzroc/Vixen
        public static void LoadSystemConfig(IProgress <Tuple <int, string> > progress = null)
        {
            while (_systemConfigSaving || _moduleConfigSaving)
            {
                Logging.Info("Reload Requested while save in progress. Waiting 5 ms.");
                Thread.Sleep(5);
            }
            Execution.initInstrumentation();
            DataFlow          = new DataFlowManager();
            Elements          = new ElementManager();
            Nodes             = new NodeManager();
            OutputControllers = new OutputControllerManager(
                new OutputDeviceCollection <OutputController>(),
                new OutputDeviceExecution <OutputController>());
            //SmartOutputControllers = new SmartOutputControllerManager(
            //	new ControllerLinkingManagement<SmartOutputController>(),
            //	new OutputDeviceCollection<SmartOutputController>(),
            //	new OutputDeviceExecution<SmartOutputController>());
            Previews = new PreviewManager(
                new OutputDeviceCollection <OutputPreview>(),
                new OutputDeviceExecution <OutputPreview>());
            Contexts = new ContextManager();
            Filters  = new FilterManager(DataFlow);

            ControllerManagement = new ControllerFacade();
            ControllerManagement.AddParticipant(OutputControllers);
            //ControllerManagement.AddParticipant(SmartOutputControllers);
            OutputDeviceManagement = new OutputDeviceFacade();
            OutputDeviceManagement.AddParticipant(OutputControllers);
            //OutputDeviceManagement.AddParticipant(SmartOutputControllers);
            OutputDeviceManagement.AddParticipant(Previews);

            // Load system data in order of dependency.
            // The system data generally resides in the data branch, but it
            // may not be in the case of an alternate context.
            string systemDataPath = _GetSystemDataPath();

            // Load module data before system config.
            // System config creates objects that use modules that have data in the store.
            ModuleStore = _LoadModuleStore(systemDataPath) ?? new ModuleStore();
            progress?.Report(Tuple.Create(50, "Module config loaded"));
            SystemConfig = _LoadSystemConfig(systemDataPath) ?? new SystemConfig();
            progress?.Report(Tuple.Create(70, "System config loaded"));

            Elements.AddElements(SystemConfig.Elements);
            Nodes.AddNodes(SystemConfig.Nodes);
            OutputControllers.AddRange(SystemConfig.OutputControllers.Cast <OutputController>());
            //SmartOutputControllers.AddRange(SystemConfig.SmartOutputControllers.Cast<SmartOutputController>());
            Previews.AddRange(SystemConfig.Previews.Cast <OutputPreview>());
            Filters.AddRange(SystemConfig.Filters);

            DataFlow.Initialize(SystemConfig.DataFlow);
        }
예제 #2
0
        public static void LoadSystemConfig()
        {
            Execution.initInstrumentation();
            DataFlow          = new DataFlowManager();
            Elements          = new ElementManager();
            Nodes             = new NodeManager();
            OutputControllers = new OutputControllerManager(
                new ControllerLinkingManagement <OutputController>(),
                new OutputDeviceCollection <OutputController>(),
                new OutputDeviceExecution <OutputController>());
            SmartOutputControllers = new SmartOutputControllerManager(
                new ControllerLinkingManagement <SmartOutputController>(),
                new OutputDeviceCollection <SmartOutputController>(),
                new OutputDeviceExecution <SmartOutputController>());
            Previews = new PreviewManager(
                new OutputDeviceCollection <OutputPreview>(),
                new OutputDeviceExecution <OutputPreview>());
            Contexts             = new ContextManager();
            Filters              = new FilterManager(DataFlow);
            ControllerLinking    = new ControllerLinker();
            ControllerManagement = new ControllerFacade();
            ControllerManagement.AddParticipant(OutputControllers);
            ControllerManagement.AddParticipant(SmartOutputControllers);
            OutputDeviceManagement = new OutputDeviceFacade();
            OutputDeviceManagement.AddParticipant(OutputControllers);
            OutputDeviceManagement.AddParticipant(SmartOutputControllers);
            OutputDeviceManagement.AddParticipant(Previews);

            // Load system data in order of dependency.
            // The system data generally resides in the data branch, but it
            // may not be in the case of an alternate context.
            string systemDataPath = _GetSystemDataPath();

            // Load module data before system config.
            // System config creates objects that use modules that have data in the store.
            ModuleStore  = _LoadModuleStore(systemDataPath) ?? new ModuleStore();
            SystemConfig = _LoadSystemConfig(systemDataPath) ?? new SystemConfig();

            Elements.AddElements(SystemConfig.Elements);
            Nodes.AddNodes(SystemConfig.Nodes);
            OutputControllers.AddRange(SystemConfig.OutputControllers.Cast <OutputController>());
            SmartOutputControllers.AddRange(SystemConfig.SmartOutputControllers.Cast <SmartOutputController>());
            Previews.AddRange(SystemConfig.Previews.Cast <OutputPreview>());
            ControllerLinking.AddRange(SystemConfig.ControllerLinking);
            Filters.AddRange(SystemConfig.Filters);

            DataFlow.Initialize(SystemConfig.DataFlow);
        }