Exemplo n.º 1
0
        /// <summary>
        /// Start the mud engine.
        /// </summary>
        /// <param name="Flags">Flags control engine functions</param>
        /// <param name="Database"></param>
        /// <param name="Assemblies">Modules to integrate</param>
        /// <returns></returns>
        public static bool Start(StartupFlags Flags, WorldDataService Database, params ModuleAssembly[] Assemblies)
        {
            ShuttingDown = false;
            Core.Flags = Flags;

            try
            {
                // Setup the rule engine and some basic rules.
                GlobalRules = new RuleEngine(NewRuleQueueingMode.QueueNewRules);
                GlobalRules.DeclarePerformRuleBook("at startup", "[] : Considered when the engine is started.");
                GlobalRules.DeclarePerformRuleBook<MudObject>("singleplayer game started", "Considered when a single player game is begun");

                // Integrate modules. The Core assembly is always integrated.
                IntegratedModules.Add(new ModuleAssembly(Assembly.GetExecutingAssembly(), new ModuleInfo { Author = "Blecki", Description = "RMUD Core", BaseNameSpace = "RMUD" }, "Core.dll"));
                IntegratedModules.AddRange(Assemblies);

                if ((Flags & StartupFlags.SearchDirectory) == StartupFlags.SearchDirectory)
                {
                    foreach (var file in System.IO.Directory.EnumerateFiles(System.IO.Directory.GetCurrentDirectory()).Where(p => System.IO.Path.GetExtension(p) == ".dll"))
                    {
                        var assembly = System.Reflection.Assembly.LoadFrom(file);

                        var infoType = assembly.GetTypes().FirstOrDefault(t => t.IsSubclassOf(typeof(ModuleInfo)));
                        if (infoType != null)
                        {
                            IntegratedModules.Add(new ModuleAssembly(assembly, file));
                            if ((Flags & StartupFlags.Silent) == 0)
                                Console.WriteLine("Discovered module: " + file);
                        }
                    }
                }

                foreach (var startupAssembly in IntegratedModules)
                    IntegrateModule(startupAssembly);

                PersistentValueSerializer.AddGlobalSerializer(new BitArraySerializer());

                InitializeCommandProcessor();

                GlobalRules.FinalizeNewRules();

                Core.Database = Database;
                Database.Initialize();

                GlobalRules.ConsiderPerformRule("at startup");

                if ((Flags & StartupFlags.SingleThreaded) == 0)
                    StartThreadedCommandProcesor();
            }
            catch (Exception e)
            {
                LogError("Failed to start mud engine.");
                LogError(e.Message);
                LogError(e.StackTrace);
                throw;
            }
            return true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs initialization.  Depending on the startup
        /// flags, only loads those modules that have been specified.
        /// </summary>
        /// <param name="startup">Which modules to init?</param>
        /// <returns></returns>
        public static bool Init(StartupFlags startup = StartupFlags.All)
        {
            getExtensionDirs();

            _startupFlags = startup;

            AppWindowPosition = CoreGlobals.AppPreferences.ScannerPosition;

            bool retVal = createThemeManager();

            if (retVal)
            {
                retVal = createPanelManager();
            }

            if (retVal)
            {
                retVal = initWidgetManager();
            }

            if (retVal)
            {
                retVal = createWordPredictionManager();
            }

            if (retVal)
            {
                retVal = createTTSManager();
            }

            if (retVal)
            {
                retVal = createSpellCheckManager();
            }

            if (retVal)
            {
                retVal = createAbbreviationsManager();
            }

            createTalkWindowManager();

            if (retVal)
            {
                retVal = createAgentManager();
            }

            if (_initWarning)
            {
                retVal = false;
            }

            Log.Debug("Returning " + retVal + " from context init");
            return(retVal);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Start the mud engine.
        /// </summary>
        /// <param name="Flags">Flags control engine functions</param>
        /// <param name="Database"></param>
        /// <param name="Assemblies">Modules to integrate</param>
        /// <returns></returns>
        public static bool Start(StartupFlags Flags, String DatabasePath, WorldDataService Database, Assembly AdditionalAssembly = null)
        {
            Core.DatabasePath = DatabasePath;

            ShuttingDown = false;
            Core.Flags   = Flags;

            try
            {
                // Setup the rule engine and some basic rules.
                GlobalRules = new RuleEngine(NewRuleQueueingMode.QueueNewRules);
                GlobalRules.DeclarePerformRuleBook("at startup", "[] : Considered when the engine is started.");
                GlobalRules.DeclarePerformRuleBook <MudObject>("singleplayer game started", "Considered when a single player game is begun");

                DefaultParser = new CommandParser();

                InitializeEngine(Assembly.GetExecutingAssembly());
                if (AdditionalAssembly != null)
                {
                    InitializeEngine(AdditionalAssembly);
                }
                InitializeCommandProcessor();

                GlobalRules.FinalizeNewRules();

                Core.Database = Database;
                Database.Initialize();

                GlobalRules.ConsiderPerformRule("at startup");

                if ((Flags & StartupFlags.SingleThreaded) == 0)
                {
                    StartThreadedCommandProcesor();
                }
            }
            catch (Exception e)
            {
                LogError("Failed to start mud engine.");
                LogError(e.Message);
                LogError(e.StackTrace);
                throw;
            }
            return(true);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Checks if the specified flag is in startup
 /// </summary>
 /// <param name="flag">Flag to check for</param>
 /// <returns>true if it is</returns>
 private static bool isEnabled(StartupFlags flag)
 {
     return((_startupFlags & flag) == flag);
 }
Exemplo n.º 5
0
 public static extern IntPtr CorBindToRuntimeEx(string pwszVersion, string pwszBuildFlavor, StartupFlags startupFlags, Guid rclsid, Guid riid, out IntPtr pClrHost);
Exemplo n.º 6
0
        /// <summary>
        /// Start the mud engine.
        /// </summary>
        /// <param name="Flags">Flags control engine functions</param>
        /// <param name="Database"></param>
        /// <param name="Assemblies">Modules to integrate</param>
        /// <returns></returns>
        public static bool Start(StartupFlags Flags, WorldDataService Database, params ModuleAssembly[] Assemblies)
        {
            ShuttingDown = false;
            Core.Flags   = Flags;

            try
            {
                // Setup the rule engine and some basic rules.
                GlobalRules = new RuleEngine(NewRuleQueueingMode.QueueNewRules);
                GlobalRules.DeclarePerformRuleBook("at startup", "[] : Considered when the engine is started.");
                GlobalRules.DeclarePerformRuleBook <MudObject>("singleplayer game started", "Considered when a single player game is begun");

                // Integrate modules. The Core assembly is always integrated.
                IntegratedModules.Add(new ModuleAssembly(Assembly.GetExecutingAssembly(), new ModuleInfo {
                    Author = "Blecki", Description = "RMUD Core", BaseNameSpace = "RMUD"
                }, "Core.dll"));
                IntegratedModules.AddRange(Assemblies);

                if ((Flags & StartupFlags.SearchDirectory) == StartupFlags.SearchDirectory)
                {
                    foreach (var file in System.IO.Directory.EnumerateFiles(System.IO.Directory.GetCurrentDirectory()).Where(p => System.IO.Path.GetExtension(p) == ".dll"))
                    {
                        var assembly = System.Reflection.Assembly.LoadFrom(file);

                        var infoType = assembly.GetTypes().FirstOrDefault(t => t.IsSubclassOf(typeof(ModuleInfo)));
                        if (infoType != null)
                        {
                            IntegratedModules.Add(new ModuleAssembly(assembly, file));
                            if ((Flags & StartupFlags.Silent) == 0)
                            {
                                Console.WriteLine("Discovered module: " + file);
                            }
                        }
                    }
                }

                foreach (var startupAssembly in IntegratedModules)
                {
                    IntegrateModule(startupAssembly);
                }

                PersistentValueSerializer.AddGlobalSerializer(new BitArraySerializer());

                InitializeCommandProcessor();

                GlobalRules.FinalizeNewRules();

                Core.Database = Database;
                Database.Initialize();

                GlobalRules.ConsiderPerformRule("at startup");

                if ((Flags & StartupFlags.SingleThreaded) == 0)
                {
                    StartThreadedCommandProcesor();
                }
            }
            catch (Exception e)
            {
                LogError("Failed to start mud engine.");
                LogError(e.Message);
                LogError(e.StackTrace);
                throw;
            }
            return(true);
        }
Exemplo n.º 7
0
Arquivo: Context.cs Projeto: glwu/acat
 /// <summary>
 /// Checks if the specified flag is in startup
 /// </summary>
 /// <param name="flag">Flag to check for</param>
 /// <returns>true if it is</returns>
 private static bool isEnabled(StartupFlags flag)
 {
     return (_startupFlags & flag) == flag;
 }
Exemplo n.º 8
0
Arquivo: Context.cs Projeto: glwu/acat
        /// <summary>
        /// Performs initialization.  Depending on the startup
        /// flags, only loads those modules that have been specified.
        /// </summary>
        /// <param name="startup">Which modules to init?</param>
        /// <returns></returns>
        public static bool Init(StartupFlags startup = StartupFlags.All)
        {
            getExtensionDirs();

            _startupFlags = startup;

            AppWindowPosition = CoreGlobals.AppPreferences.ScannerPosition;

            bool retVal = createThemeManager();

            if (retVal)
            {
                retVal = createPanelManager();
            }

            if (retVal)
            {
                retVal = initWidgetManager();
            }

            if (retVal)
            {
                retVal = createWordPredictionManager();
            }

            if (retVal)
            {
                retVal = createTTSManager();
            }

            if (retVal)
            {
                retVal = createSpellCheckManager();
            }

            if (retVal)
            {
                retVal = createAbbreviationsManager();
            }

            createTalkWindowManager();

            if (retVal)
            {
                retVal = createAgentManager();
            }

            if (_initWarning)
            {
                retVal = false;
            }

            Log.Debug("Returning " + retVal + " from context init");
            return retVal;
        }