コード例 #1
0
ファイル: GlobalConfiguration.cs プロジェクト: creeperlv/LWMS
        static void InitGlobalConfiguration()
        {
            LibraryInfo.SetFlag(FeatureFlags.Pipeline_AutoID_Random, 1);
            LibraryInfo.SetFlag(FeatureFlags.FileWR_AutoCreateFile, 1);
            LoadConfiguation();
            {
                StorageFile ManageModuleFile;
                if (ApplicationStorage.Configuration.CreateFile(TrustedInstaller, "ManageModules.ini", out ManageModuleFile))
                {
                    Trace.WriteLine(Localization.Language.Query("LWMS.Config.CreateDefaultCommandManifest", "Create default command module manifest."));
                    ManageCommandModules = ListData <string> .LoadFromStream(ManageModuleFile.OpenFileWR());

                    ManageCommandModules.Add(Path.Combine(ApplicationStorage.BasePath, "LWMS.Management.Commands.dll"));
                    ManageCommandModules.Save();
                }
                else
                {
                    ManageCommandModules = ListData <string> .LoadFromStream(ManageModuleFile.OpenFileWR(TrustedInstaller));
                }
            }
            {
                StorageFile RPipelineUnitDefinitionFile;
                if (ApplicationStorage.Configuration.CreateFile(TrustedInstaller, "RPipelineUnit.tsd", out RPipelineUnitDefinitionFile))
                {
                    RProcessUnits = TreeStructureData.CreateToFile(RPipelineUnitDefinitionFile.ToFileInfo(TrustedInstaller));
                    {
                        //LWMS.Core.dll
                        TreeNode treeNode = new TreeNode();
                        treeNode.Name  = "DLL";
                        treeNode.Value = "LWMS.Core.dll";
                        {
                            TreeNode unit = new TreeNode();
                            unit.Name  = "Unit.0";
                            unit.Value = "LWMS.Core.DefaultStaticFileUnit";
                            treeNode.AddChildren(unit);
                        }
                        RProcessUnits.RootNode.AddChildren(treeNode);
                    }
                    RProcessUnits.Serialize();
                }
                else
                {
                    RProcessUnits = TreeStructureData.LoadFromStream(RPipelineUnitDefinitionFile.OpenFileWR(TrustedInstaller));
                }
            }
            {
                StorageFile WPipelineUnitDefinitionFile;
                if (ApplicationStorage.Configuration.CreateFile(TrustedInstaller, "WPipelineUnit.tsd", out WPipelineUnitDefinitionFile))
                {
                    WProcessUnits = TreeStructureData.LoadFromStream(WPipelineUnitDefinitionFile.OpenFileWR(TrustedInstaller));
                    {
                        //LWMS.Core.dll
                        TreeNode treeNode = new TreeNode();
                        treeNode.Name  = "DLL";
                        treeNode.Value = "LWMS.Core.dll";
                        {
                            TreeNode unit = new TreeNode();
                            unit.Name  = "DefaultUnit";
                            unit.Value = "LWMS.Core.HttpRoutedLayer.DefaultStreamProcessUnit";
                            treeNode.AddChildren(unit);
                        }
                        WProcessUnits.RootNode.AddChildren(treeNode);
                    }
                    WProcessUnits.Serialize();
                }
                else
                {
                    WProcessUnits = TreeStructureData.LoadFromStream(WPipelineUnitDefinitionFile.OpenFileWR(TrustedInstaller));
                }
            }
            {
                //Load CMDOUT Pipelne units.
                StorageFile CMDOUTPipelineUnitsFile;
                if (ApplicationStorage.Configuration.CreateFile(TrustedInstaller, "CMDOUTPipelineUnit.tsd", out CMDOUTPipelineUnitsFile))
                {
                    CMDOUTProcessUnits = TreeStructureData.LoadFromStream(CMDOUTPipelineUnitsFile.OpenFileWR(TrustedInstaller));
                    {
                        //LWMS.Core.dll
                        TreeNode treeNode = new TreeNode();
                        treeNode.Name  = "DLL";
                        treeNode.Value = "LWMS.Management.dll";
                        {
                            TreeNode unit = new TreeNode();
                            unit.Name  = "ConsoleOutput";
                            unit.Value = "LWMS.Management.ConsoleCmdOutUnit";
                            treeNode.AddChildren(unit);
                        }
                        {
                            TreeNode unit = new TreeNode();
                            unit.Name  = "LogOutput";
                            unit.Value = "LWMS.Management.LogCmdOutUnit";
                            treeNode.AddChildren(unit);
                        }
                        CMDOUTProcessUnits.RootNode.AddChildren(treeNode);
                    }
                    {
                        //LWMS.Core.RemoteShell.Server.dll
                        TreeNode treeNode = new TreeNode();
                        treeNode.Name  = "DLL";
                        treeNode.Value = "LWMS.Core.RemoteShell.Server.dll";
                        {
                            TreeNode unit = new TreeNode();
                            unit.Name  = "RSCMDReciver";
                            unit.Value = "LWMS.Core.RemoteShell.Server.RSCMDReciver";
                            treeNode.AddChildren(unit);
                        }
                        CMDOUTProcessUnits.RootNode.AddChildren(treeNode);
                    }
                    CMDOUTProcessUnits.Serialize();
                }
                else
                {
                    CMDOUTProcessUnits = TreeStructureData.LoadFromStream(CMDOUTPipelineUnitsFile.OpenFileWR(TrustedInstaller));
                }
            }
            {
                //Init these fields.
                _ = MAX_LOG_SIZE;
                _ = LOG_WATCH_INTERVAL;
                //_ = WebSiteContentRoot;
                //_ = WebSiteModuleStorageRoot;
                //if (l == 0)
                //{

                //}
            }
        }