/// <summary> /// Called pre application start /// </summary> public static void PreStart() { BatComputer.PreStart(); LogBase Logger = BatComputer.Bootstrapper.Resolve <LogBase>(new NullLogger()); Logger.LogMessage("Current asset helpers: {0}", MessageType.Debug, BatComputer.Bootstrapper.Resolve <AssetManager>().ToString()); Logger.LogMessage("Current serializers: {0}", MessageType.Debug, BatComputer.Bootstrapper.Resolve <SerializationManager>().ToString()); DependencyResolver.SetResolver(new Bootstrapper.DependencyResolver(BatComputer.Bootstrapper)); }
/// <summary> /// Called after the application has been initiated /// </summary> public static void PostStart() { LogBase Logger = Bootstrapper.Resolve <LogBase>(new NullLogger()); Logger.LogMessage("Starting post start tasks", MessageType.Info); Bootstrapper.Resolve <TaskManager>().Run(RunTime.PostStart); }
/// <summary> /// Called at the end of the application /// </summary> public static void End() { if (Bootstrapper != null) { LogBase Logger = Bootstrapper.Resolve <LogBase>(new NullLogger()); if (Logger != null) { Logger.LogMessage("Application ending", MessageType.Info); Logger.LogMessage("Starting end tasks", MessageType.Info); } Bootstrapper.Resolve <TaskManager>().Run(RunTime.End); if (Logger != null) { Logger.Dispose(); Logger = null; } Bootstrapper.Dispose(); Bootstrapper = null; } }
/// <summary> /// Called at the start of the application /// </summary> public static void PreStart() { new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).LoadAssemblies(false).ForEach(x => x); Bootstrapper = AppDomain.CurrentDomain.GetAssemblies().Objects <IBootstrapper>().FirstOrDefault(); Bootstrapper.Register <IBootstrapper>(Bootstrapper); AppDomain.CurrentDomain.GetAssemblies().Objects <IModule>().ForEach(x => x.Load(Bootstrapper)); LogBase Logger = Bootstrapper.Resolve <LogBase>(new NullLogger()); Logger.LogMessage("Batman starting", MessageType.Info); Logger.LogMessage("Current bootstrapper: {0}", MessageType.Debug, Bootstrapper.Name); Logger.LogMessage("Current file systems detected: {0}", MessageType.Debug, Bootstrapper.Resolve <FileManager>().ToString()); Logger.LogMessage("Communication systems detected: {0}", MessageType.Debug, Bootstrapper.Resolve <CommunicationManager>().ToString()); Logger.LogMessage("Profiler detected: {0}", MessageType.Debug, Bootstrapper.Resolve <IProfiler>().Name); Logger.LogMessage("Starting pre start tasks", MessageType.Info); Bootstrapper.Resolve <TaskManager>().Run(RunTime.PreStart); }