private bool LoadSettingsCore(string settings, bool publishLoad) { var settingsFile = new FileInfo(Structure.CurrentWorldSettingsDirectory + settings); if (!settingsFile.Exists) { return(false); } Monitor = new Monitor(); var displaySettings = Builder.ReadSettings(settingsFile, Map, Monitor); SettingsName = settings; InvalidateMarkers(); displaySettings.Scenery = Settings.IconScenery; Map.SetDisplaySettings(displaySettings); _miniMap.InitializeMiniMapDisplay(displaySettings); Map.SetCenter(Map.HomeLocation); if (publishLoad) { EventPublisher.InformSettingsLoaded(this, EventArgs.Empty); } return(true); }
/// <summary> /// Loads world data for the specified path & settings file /// </summary> /// <param name="dataPath">The path to the World directory</param> /// <param name="settings">The settings filename</param> public bool LoadWorld(string dataPath, string settings) { HasLoaded = false; if (string.IsNullOrEmpty(dataPath) || !Directory.Exists(dataPath)) { return(false); } Structure = new InternalStructure(); Structure.SetPath(dataPath); Structure.LoadCurrentAndPreviousTwSnapshot(out _villages, out _players, out _tribes); if (_villageTypes != null) { _villageTypes.Close(); } _villageTypes = Structure.CurrentVillageTypes; bool settingLoadSuccess = LoadSettingsCore(settings, false); if (!settingLoadSuccess) { return(false); } Cache = new AutoCompleteCache(_players, _tribes); HasLoaded = true; EventPublisher.InformLoaded(this, EventArgs.Empty); EventPublisher.InformSettingsLoaded(this, EventArgs.Empty); return(true); }