/// <summary> /// Resets the API. /// </summary> public void Reset() { //Reset services. try { Events = new Events.EventHandler(); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'Events'.", ex); } try { Commander = new CommanderStatus(this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'Commander'.", ex); } try { Location = new LocationStatus(this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'Location'.", ex); } try { DiscordRichPresence = new RichPresenceClient(this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'DiscordRichPresence'.", ex); } try { StatusWatcher = new StatusWatcher(this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'StatusWatcher'.", ex); } try { CargoWatcher = new CargoWatcher(this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'CargoWatcher'.", ex); } try { Status = EliteAPI.Status.GameStatus.FromFile(new FileInfo(JournalDirectory + "//Status.json"), this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'Status'.", ex); } try { JournalParser = new JournalParser(this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'JournalParser'.", ex); } try { MaterialWatcher = new MaterialWatcher(this); } catch (Exception ex) { Logger.Log(Severity.Warning, "Couldn't instantiate service 'MaterialWatcher'.", ex); } JournalParser.processedLogs = new List <string>(); }
private void Startup() { ThreadUtility.MainThread = Thread.CurrentThread; InitIoC(); SetupLogging(); // Set up custom synchronization context. // Sorry Godot. _taskManager.Initialize(); // Load config. _configurationManager.LoadFromFile(PathHelpers.ExecutableRelativeFile("client_config.toml")); if (Mode == DisplayMode.Clyde) { _clyde = IoCManager.Resolve <IClyde>(); } // Init resources. // Doesn't do anything right now because TODO Godot asset management is a bit ad-hoc. _resourceCache.LoadBaseResources(); _resourceCache.LoadLocalResources(); // Bring display up as soon as resources are mounted. _displayManager.Initialize(); _displayManager.SetWindowTitle("Space Station 14"); if (Mode == DisplayMode.Clyde) { _fontManager = IoCManager.Resolve <IFontManagerInternal>(); _fontManager.Initialize(); } //identical code for server in baseserver if (!AssemblyLoader.TryLoadAssembly <GameShared>(_resourceManager, $"Content.Shared")) { Logger.Warning($"[ENG] Could not load any Shared DLL."); } if (!AssemblyLoader.TryLoadAssembly <GameClient>(_resourceManager, $"Content.Client")) { Logger.Warning($"[ENG] Could not load any Client DLL."); } // Call Init in game assemblies. AssemblyLoader.BroadcastRunLevel(AssemblyLoader.RunLevel.Init); _eyeManager.Initialize(); _serializer.Initialize(); _userInterfaceManager.Initialize(); _networkManager.Initialize(false); _inputManager.Initialize(); _console.Initialize(); _prototypeManager.LoadDirectory(new ResourcePath(@"/Prototypes/")); _prototypeManager.Resync(); _tileDefinitionManager.Initialize(); _mapManager.Initialize(); _lightManager.Initialize(); _entityManager.Initialize(); _gameStateManager.Initialize(); _overlayManager.Initialize(); _placementManager.Initialize(); _viewVariablesManager.Initialize(); RichPresenceClient presence = new RichPresenceClient(); _client.Initialize(); AssemblyLoader.BroadcastRunLevel(AssemblyLoader.RunLevel.PostInit); _stateManager.RequestStateChange <MainScreen>(); _clyde?.Ready(); var args = GetCommandLineArgs(); if (args.Contains("--connect")) { _client.ConnectToServer("127.0.0.1", 1212); } }