public DefaultConsole(IDependencyContainer container, IUserManager userManager) { UserManager = userManager; SessionConnectTime = DateTime.Now; BaseLogger.SkipTypeFromLogging(GetType()); Container = container.CreateChildContainer(); }
public async Task InitAsync(IRuntime runtime) { //Fix CodePage 437 not supported ZipConstants.DefaultCodePage = System.Text.Encoding.UTF8.CodePage; // Another possible workaround: // new I18N.West(); BaseLogger.SkipTypeFromLogging(typeof(UnturnedPlayerManager)); ApplyTlsWorkaround(); this.runtime = runtime; rocketGameObject = new GameObject(); Object.DontDestroyOnLoad(rocketGameObject); container = runtime.Container; eventManager = container.Resolve <IEventBus>(); playerManager = (UnturnedPlayerManager)container.Resolve <IUserManager>("host"); ModuleTranslations = container.Resolve <ITranslationCollection>(); logger = container.Resolve <ILogger>(); logger.LogInformation("Loading Rocket Unturned Implementation..."); container.RegisterSingletonType <AutomaticSaveWatchdog, AutomaticSaveWatchdog>(); container.Resolve <AutomaticSaveWatchdog>().Start(); LoadTranslations(); Provider.onServerHosted += OnServerHosted; if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) { rocketGameObject.SetActive(false); // deactivate object so it doesn't run Awake until all properties were set var console = rocketGameObject.AddComponent <UnturnedConsolePipe>(); console.Logger = logger; rocketGameObject.SetActive(true); // reactivate object } SteamChannel.onTriggerSend += TriggerSend; Provider.onCheckValid += OnCheckValid; Provider.onServerConnected += OnPlayerConnected; Provider.onServerDisconnected += OnPlayerDisconnected; DamageTool.playerDamaged += OnPlayerDamaged; Provider.onServerShutdown += OnServerShutdown; ChatManager.onChatted += (SteamPlayer player, EChatMode mode, ref Color color, ref bool isRich, string message, ref bool isVisible) => { UnturnedPlayer p = (UnturnedPlayer)playerManager.GetPlayerByIdAsync(player.playerID.steamID.m_SteamID.ToString()).GetAwaiter().GetResult(); UnturnedPlayerChatEvent @event = new UnturnedPlayerChatEvent(p, mode, color, isRich, message, !isVisible); eventManager.Emit(this, @event); color = @event.Color; isRich = @event.IsRichText; isVisible = [email protected]; }; CommandWindow.onCommandWindowOutputted += (text, color) => logger.LogNative(text?.ToString()); }
/// <inheritdoc /> public void Init() { BaseLogger.SkipTypeFromLogging(typeof(GlobalMembersHelper)); if (!Directory.Exists(WorkingDirectory)) { Directory.CreateDirectory(WorkingDirectory); } LoadPlugins(); }
public StdConsole(IDependencyContainer container) { SessionConnectTime = DateTime.UtcNow; BaseLogger.SkipTypeFromLogging(GetType()); Container = container.CreateChildContainer(); }
static NuGetLoggerAdapter() { BaseLogger.SkipTypeFromLogging(typeof(NuGetLoggerAdapter)); }
public UnturnedConsole(IDependencyContainer container) { SessionConnectTime = DateTime.Now; BaseLogger.SkipTypeFromLogging(GetType()); this.container = container; }
public TestConsole(IDependencyContainer container) { BaseLogger.SkipTypeFromLogging(GetType()); Container = container.CreateChildContainer(); }