예제 #1
0
        private static void Main(string[] args)
        {
            //Set managers
            ManagerBase2.SetTraceLog(generaltracelog);
            CoreService.SetTraceLog(generaltracelog);

            //GET THE ASSEMBLY'S DIRECTORY
            string file  = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string fname = Path.GetFileNameWithoutExtension(file);

            //TRACELOG
            Trace.AutoFlush  = true;
            Trace.IndentSize = 4;
            if (System.Diagnostics.Trace.Listeners.Count <= 1 && (System.Diagnostics.Trace.Listeners["Default"] == null ||
                                                                  System.Diagnostics.Trace.Listeners["Default"].GetType() == typeof(System.Diagnostics.DefaultTraceListener)))
            {
                DelimitedListTraceListener del = new System.Diagnostics.DelimitedListTraceListener((fname + ".log.csv"), "text");
                del.Delimiter = ",";
                System.Diagnostics.Trace.Listeners.Add(del);
            }

            Trace.WriteLine("#############################################################################");
            Trace.WriteLine(string.Format("Saga Map Server starting on: {0}", DateTime.Now));
            Trace.WriteLine(string.Format("OS Information: {0}", Environment.OSVersion));
            Trace.WriteLine(string.Format("Number of Processors: {0}", Environment.ProcessorCount));
            Trace.WriteLine(string.Format("CLR Version: {0}", Environment.Version));
            Trace.WriteLine(string.Format("Working set: {0}", Environment.WorkingSet));
            Trace.WriteLine(string.Format("OS Bit Version: {0} Bit", IntPtr.Size * 8));
            Trace.WriteLine("#############################################################################");

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Do initial configuration
            FirstRunConfiguration();

            _ConsoleCommands               = ManagerBase2.ProvideManager <ConsoleCommands>("Saga.Manager.ConsoleSettings");
            _NetworkService                = ManagerBase2.ProvideManager <NetworkService>("Saga.Manager.NetworkSettings");
            _WorldTasks                    = ManagerBase2.ProvideManager <WorldTasks>("Saga.Manager.WorldTasks");
            _Database                      = ManagerBase2.ProvideManager <Database>("Saga.Manager.Database");
            _Quests                        = ManagerBase2.ProvideManager <Saga.Managers.Quests>("Saga.Manager.Quest");
            _ScriptCompiler                = ManagerBase2.ProvideManager <ScriptCompiler>("Saga.Manager.Scripting");
            _EventManager                  = FactoryBase.ProvideManager <EventManager>("Saga.Factory.Events");
            _Additions                     = FactoryBase.ProvideManager <Additions>("Saga.Factory.Addition");
            _Portals                       = FactoryBase.ProvideManager <Portals>("Saga.Factory.Portals");
            _Spells                        = FactoryBase.ProvideManager <Saga.Factory.Spells>("Saga.Factory.Spells");
            _StatusByLevel                 = FactoryBase.ProvideManager <Saga.Factory.StatusByLevel>("Saga.Factory.StatusByLevel");
            _Warps                         = FactoryBase.ProvideManager <Warps>("Saga.Factory.Warps");
            _Zones                         = FactoryBase.ProvideManager <Zones>("Saga.Factory.Zones");
            _ItemFactory                   = FactoryBase.ProvideManager <ItemsFactory>("Saga.Factory.Items");
            _Weaponary                     = FactoryBase.ProvideManager <Weaponary>("Saga.Factory.Weaponary");
            _SpawnTemplates                = FactoryBase.ProvideManager <SpawnTemplate>("Saga.Factory.SpawnTemplate");
            _SpawnWorldObjects             = FactoryBase.ProvideManager <SpawnWorldObjects>("Saga.Factory.SpawnWorldObjects");
            _SpawnMultiWorldObjectSettings = FactoryBase.ProvideManager <SpawnMultiWorldObjects>("Saga.Factory.SpawnMultiWorldObjects");
            _CharacterConfiguration        = FactoryBase.ProvideManager <CharacterConfiguration>("Saga.Factory.CharacterConfiguration");
            _ItemDrops                     = FactoryBase.ProvideManager <ItemsDrops>("Saga.Factory.ItemDrops");

            try
            {
                ManagerCollection section = (ManagerCollection)ConfigurationManager.GetSection("Saga.Managers");
                if (section != null)
                {
                    foreach (SingletonManagerElement element in section)
                    {
                        ManagerBase2 managerBase = ManagerBase2.ProvideManagerFromTypeString <ManagerBase2>(element.Type);
                        _CustomManagers.Add(element.Name, managerBase);
                    }
                }
            }
            catch (Exception e)
            {
                HostContext.Current.AddUnhandeldException(e);
            }
            finally
            {
                HostContext.Current.Initialize();
                HostContext.Current.BeforeQuerySettings();
                HostContext.Current.AfterQuerySettings();
                HostContext.Current.Load();
                HostContext.Current.Loaded();
            }

            Console.ReadLine();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            //Set managers
            ManagerBase2.SetTraceLog(generaltracelog);
            CoreService.SetTraceLog(generaltracelog);

            //GET THE ASSEMBLY'S DIRECTORY
            string file = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string fname = Path.GetFileNameWithoutExtension(file);

            //TRACELOG
            Trace.AutoFlush = true;
            Trace.IndentSize = 4;
            if (System.Diagnostics.Trace.Listeners.Count <= 1 && (System.Diagnostics.Trace.Listeners["Default"] == null ||
                System.Diagnostics.Trace.Listeners["Default"].GetType() == typeof(System.Diagnostics.DefaultTraceListener)))
            {
                DelimitedListTraceListener del = new System.Diagnostics.DelimitedListTraceListener((fname + ".log.csv"), "text");
                del.Delimiter = ",";
                System.Diagnostics.Trace.Listeners.Add(del);
            }

            Trace.WriteLine("#############################################################################");
            Trace.WriteLine(string.Format("Saga Map Server starting on: {0}", DateTime.Now));
            Trace.WriteLine(string.Format("OS Information: {0}", Environment.OSVersion));
            Trace.WriteLine(string.Format("Number of Processors: {0}", Environment.ProcessorCount));
            Trace.WriteLine(string.Format("CLR Version: {0}", Environment.Version));
            Trace.WriteLine(string.Format("Working set: {0}", Environment.WorkingSet));
            Trace.WriteLine(string.Format("OS Bit Version: {0} Bit", IntPtr.Size * 8));
            Trace.WriteLine("#############################################################################");

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Do initial configuration
            FirstRunConfiguration();

            _ConsoleCommands = ManagerBase2.ProvideManager<ConsoleCommands>("Saga.Manager.ConsoleSettings");
            _NetworkService = ManagerBase2.ProvideManager<NetworkService>("Saga.Manager.NetworkSettings");
            _WorldTasks = ManagerBase2.ProvideManager<WorldTasks>("Saga.Manager.WorldTasks");
            _Database = ManagerBase2.ProvideManager<Database>("Saga.Manager.Database");
            _Quests = ManagerBase2.ProvideManager<Saga.Managers.Quests>("Saga.Manager.Quest");
            _ScriptCompiler = ManagerBase2.ProvideManager<ScriptCompiler>("Saga.Manager.Scripting");
            _EventManager = FactoryBase.ProvideManager<EventManager>("Saga.Factory.Events");
            _Additions = FactoryBase.ProvideManager<Additions>("Saga.Factory.Addition");
            _Portals = FactoryBase.ProvideManager<Portals>("Saga.Factory.Portals");
            _Spells = FactoryBase.ProvideManager<Saga.Factory.Spells>("Saga.Factory.Spells");
            _StatusByLevel = FactoryBase.ProvideManager<Saga.Factory.StatusByLevel>("Saga.Factory.StatusByLevel");
            _Warps = FactoryBase.ProvideManager<Warps>("Saga.Factory.Warps");
            _Zones = FactoryBase.ProvideManager<Zones>("Saga.Factory.Zones");
            _ItemFactory = FactoryBase.ProvideManager<ItemsFactory>("Saga.Factory.Items");
            _Weaponary = FactoryBase.ProvideManager<Weaponary>("Saga.Factory.Weaponary");
            _SpawnTemplates = FactoryBase.ProvideManager<SpawnTemplate>("Saga.Factory.SpawnTemplate");
            _SpawnWorldObjects = FactoryBase.ProvideManager<SpawnWorldObjects>("Saga.Factory.SpawnWorldObjects");
            _SpawnMultiWorldObjectSettings = FactoryBase.ProvideManager<SpawnMultiWorldObjects>("Saga.Factory.SpawnMultiWorldObjects");
            _CharacterConfiguration = FactoryBase.ProvideManager<CharacterConfiguration>("Saga.Factory.CharacterConfiguration");
            _ItemDrops = FactoryBase.ProvideManager<ItemsDrops>("Saga.Factory.ItemDrops");

            try
            {
                ManagerCollection section = (ManagerCollection)ConfigurationManager.GetSection("Saga.Managers");
                if (section != null)
                {
                    foreach (SingletonManagerElement element in section)
                    {
                        ManagerBase2 managerBase = ManagerBase2.ProvideManagerFromTypeString<ManagerBase2>(element.Type);
                        _CustomManagers.Add(element.Name, managerBase);
                    }
                }
            }
            catch (Exception e)
            {
                HostContext.Current.AddUnhandeldException(e);
            }
            finally
            {
                HostContext.Current.Initialize();
                HostContext.Current.BeforeQuerySettings();
                HostContext.Current.AfterQuerySettings();
                HostContext.Current.Load();
                HostContext.Current.Loaded();
            }

            Console.ReadLine();
        }