private static void LoadLanguageMods() { FileInfo[] textList = Ship_Game.ResourceManager.GetFilesFromDirectory(string.Concat(Ship_Game.ResourceManager.WhichModPath, "/Localization/English/")); XmlSerializer serializer1 = new XmlSerializer(typeof(LocalizationFile)); FileInfo[] fileInfoArray = textList; for (int i = 0; i < (int)fileInfoArray.Length; i++) { FileStream stream = fileInfoArray[i].OpenRead(); LocalizationFile data = (LocalizationFile)serializer1.Deserialize(stream); //stream.Close(); stream.Dispose(); Ship_Game.ResourceManager.LanguageFile = data; } Localizer.FillLocalizer(); if (GlobalStats.Config.Language != "English") { textList = Ship_Game.ResourceManager.GetFilesFromDirectory(string.Concat(Ship_Game.ResourceManager.WhichModPath, "/Localization/", GlobalStats.Config.Language, "/")); FileInfo[] fileInfoArray1 = textList; for (int j = 0; j < (int)fileInfoArray1.Length; j++) { FileStream stream = fileInfoArray1[j].OpenRead(); LocalizationFile data = (LocalizationFile)serializer1.Deserialize(stream); //stream.Close(); stream.Dispose(); Ship_Game.ResourceManager.LanguageFile = data; } } Localizer.FillLocalizer(); }
static ResourceManager() { Ship_Game.ResourceManager.TextureDict = new Dictionary<string, Texture2D>(); Ship_Game.ResourceManager.weapon_serializer = new XmlSerializer(typeof(Weapon)); Ship_Game.ResourceManager.serializer_shipdata = new XmlSerializer(typeof(ShipData)); Ship_Game.ResourceManager.ShipsDict = new Dictionary<string, Ship>(); Ship_Game.ResourceManager.RoidsModels = new Dictionary<int, Model>(); Ship_Game.ResourceManager.JunkModels = new Dictionary<int, Model>(); Ship_Game.ResourceManager.TechTree = new Dictionary<string, Technology>(StringComparer.InvariantCultureIgnoreCase); Ship_Game.ResourceManager.Encounters = new List<Encounter>(); Ship_Game.ResourceManager.BuildingsDict = new Dictionary<string, Building>(); Ship_Game.ResourceManager.GoodsDict = new Dictionary<string, Good>(); Ship_Game.ResourceManager.WeaponsDict = new Dictionary<string, Weapon>(); Ship_Game.ResourceManager.ShipModulesDict = new Dictionary<string, ShipModule>(); Ship_Game.ResourceManager.ToolTips = new Dictionary<int, ToolTip>(); Ship_Game.ResourceManager.ProjTextDict = new Dictionary<string, Texture2D>(); Ship_Game.ResourceManager.ProjectileMeshDict = new Dictionary<string, ModelMesh>(); Ship_Game.ResourceManager.ProjectileModelDict = new Dictionary<string, Model>(); Ship_Game.ResourceManager.Initialized = false; Ship_Game.ResourceManager.WhichModPath = ""; Ship_Game.ResourceManager.RandomItemsList = new List<RandomItem>(); Ship_Game.ResourceManager.TroopsDict = new Dictionary<string, Troop>(); Ship_Game.ResourceManager.DDDict = new Dictionary<string, DiplomacyDialog>(); Ship_Game.ResourceManager.LanguageDict = new Dictionary<string, LocalizationFile>(); Ship_Game.ResourceManager.LanguageFile = new LocalizationFile(); Ship_Game.ResourceManager.ArtifactsDict = new Dictionary<string, Artifact>(); Ship_Game.ResourceManager.EventsDict = new Dictionary<string, ExplorationEvent>(); Ship_Game.ResourceManager.BigNebulas = new List<Texture2D>(); Ship_Game.ResourceManager.MedNebulas = new List<Texture2D>(); Ship_Game.ResourceManager.SmallNebulas = new List<Texture2D>(); Ship_Game.ResourceManager.SmallStars = new List<Texture2D>(); Ship_Game.ResourceManager.MediumStars = new List<Texture2D>(); Ship_Game.ResourceManager.LargeStars = new List<Texture2D>(); Ship_Game.ResourceManager.rt = new RacialTraits(); Ship_Game.ResourceManager.Empires = new List<EmpireData>(); Ship_Game.ResourceManager.HeaderSerializer = new XmlSerializer(typeof(HeaderData)); Ship_Game.ResourceManager.ModSerializer = new XmlSerializer(typeof(ModInformation)); Ship_Game.ResourceManager.ModelDict = new Dictionary<string, Model>(); Ship_Game.ResourceManager.EconSerializer = new XmlSerializer(typeof(EconomicResearchStrategy)); Ship_Game.ResourceManager.HullsDict = new Dictionary<string, ShipData>(StringComparer.InvariantCultureIgnoreCase); Ship_Game.ResourceManager.FlagTextures = new List<KeyValuePair<string, Texture2D>>(); //Added by McShooterz Ship_Game.ResourceManager.HostileFleets = new HostileFleets(); Ship_Game.ResourceManager.ShipNames = new ShipNames(); Ship_Game.ResourceManager.SoundEffectDict = new Dictionary<string, SoundEffect>(); Ship_Game.ResourceManager.AgentMissionData = new AgentMissionData(); Ship_Game.ResourceManager.MainMenuShipList = new MainMenuShipList(); Ship_Game.ResourceManager.ShipRoles = new Dictionary<string, ShipRole>(); Ship_Game.ResourceManager.HullBonuses = new Dictionary<string, HullBonus>(); Ship_Game.ResourceManager.PlanetaryEdicts = new Dictionary<string, PlanetEdict>(); Ship_Game.ResourceManager.OffSet = 0; }
private void SaveTechnologies() { LocalizationFile lf = new LocalizationFile() { TokenList = new List<Token>() }; int i = 0; foreach (KeyValuePair<string, Ship_Game.Gameplay.ShipModule> shipModulesDict in Ship_Game.ResourceManager.ShipModulesDict) { Token t = new Token() { Index = 900 + i }; lf.TokenList.Add(t); i++; t = new Token() { Index = 900 + i }; lf.TokenList.Add(t); i++; } XmlSerializer Serializer2 = new XmlSerializer(typeof(LocalizationFile)); TextWriter wf2 = new StreamWriter("Modules.xml"); Serializer2.Serialize(wf2, lf); wf2.Close(); AudioManager.PlayCue("echo_affirm"); }