public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "name": Name = parser.ReadString(); break; case "type": Type = parser.ReadString(); break; case "morale": Morale = parser.ReadDouble(); break; case "strength": Strength = parser.ReadDouble(); break; } }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "name": Name = parser.ReadString(); break; case "tax": Tax = parser.ReadDouble(); break; case "add_core": Cores.Add(parser.ReadString()); break; case "top_provinces": TopProvinces = parser.ReadStringList(); break; case "army": Armies.Add(parser.Parse(new Army())); break; } }
public void TokenCallback(ParadoxParser parser, string token) { if (token.ToLower() == "holder") { ID = parser.ReadString(); } }
public void TokenCallback(ParadoxParser parser, string token) { if (token.ToLower() == "name") { Name = parser.ReadString(); } }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "first": First = parser.ReadString(); break; case "second": Second = parser.ReadString(); break; case "subject_type": SubjectType = parser.ReadString(); break; } }
public void TokenCallback(ParadoxParser parser, string token) { Action<ParadoxParser> temp; if (parseStrategy.TryGetValue(token, out temp)) temp(parser); else otherFields.Add(token, parser.ReadString()); }
public void TokenCallback(ParadoxParser parser, string token) { if (token != "id") throw new ApplicationException("Unrecognized token: " + token); if (parser.NextIsBracketed()) EventIds.Add(parser.Parse(new ParadoxId())); else EventNames.Add(parser.ReadString()); }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "name": Name = parser.ReadString(); break; case "leader": Leader = parser.Parse(new ParadoxId()); break; case "unit": Units.Add(parser.Parse(new Unit())); break; case "attachments": Attachments = parser.ReadList(() => parser.Parse (new ParadoxId())); break; } }
public void ReadSingleSpacedString() { var data = " michigan ".ToStream(); string actual = string.Empty; using (ParadoxParser parser = new ParadoxParser(data)) { actual = parser.ReadString(); } Assert.AreEqual("michigan", actual); }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "name": Name = parser.ReadString(); break; case "leader": Leader = parser.Parse(new ParadoxId()); break; case "unit": Units.Add(parser.Parse(new Unit())); break; case "attachments": Attachments = parser.ReadList(() => parser.Parse(new ParadoxId())); break; } }
public void TokenCallback(ParadoxParser parser, string token) { Action <ParadoxParser> temp; if (parseStrategy.TryGetValue(token, out temp)) { temp(parser); } else { otherFields.Add(token, parser.ReadString()); } }
private void ParseProvinceData(ParadoxParser parser, string tag) { if (tag.StartsWith("b_")) { m_curProv.Settlements.Add(new Settlement(tag, parser.ReadString())); return; } if (Char.IsDigit(tag[0])) { // Should be an event date. Option.ParseGeneric(parser, tag); m_curProv.History.Add((EventOption)Option.GetLastRoot()); return; } switch (tag) { case "max_settlements": m_curProv.MaxSettlements = parser.ReadInt32(); break; case "title": m_curProv.Title = parser.ReadString(); break; case "culture": m_curProv.Culture = parser.ReadString(); break; case "religion": m_curProv.Religion = parser.ReadString(); break; case "terrain": m_curProv.Terrain = parser.ReadString(); break; } }
/// <summary> /// used to parse group options of the type: tag = { tag2 = data ... } /// </summary> /// <param name="tag">The *last* read tag.</param> /// <returns>Parsed option can be retrieved using GetLastRoot()</returns> public static void ParseGeneric(ParadoxParser parser, string tag) { Option opt; if (parser.NextIsBracketed()) { if (tag == "data") { opt = new IntListOption(tag, parser.ReadIntList()); } else { if (tag.Contains(".") && tag.IndexOf(".", StringComparison.Ordinal) != tag.LastIndexOf(".", StringComparison.Ordinal)) { opt = new EventOption(tag); } else { opt = new GroupOption(tag); } m_optionStack.Push(opt); parser.Parse(ParseGeneric); m_optionStack.Pop(); } } else { opt = ParseSingle(tag, parser.ReadString()); } if (m_optionStack.Count == 0) // We're in the root. { m_lastParsedOptionRoot = opt; } else { Option parent = m_optionStack.Peek(); if (parent.Type == OptionType.Group) { ((GroupOption)parent).SubOptions.Add(opt); } else if (parent.Type == OptionType.Event) { ((EventOption)parent).SubOptions.Add(opt); } } }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "name": this.name = parser.ReadString(); break; case "owner": this.owner = parser.ReadString(); break; case "controller": this.controller = parser.ReadString(); break; case "culture": this.culture = parser.ReadString(); break; case "religion": this.religion = parser.ReadString(); break; case "core": this.cores.Add(parser.ReadString()); break; } }
private void ParseMap(ParadoxParser parser, string s) { IList <int> intList; switch (s) { case "max_provinces": MaxProvinces = parser.ReadInt32(); break; #region File List case "definitions": Definitions = parser.ReadString(); break; case "provinces": Provinces = parser.ReadString(); break; case "positions": Positions = parser.ReadString(); break; case "terrain": Terrain = parser.ReadString(); break; case "rivers": Rivers = parser.ReadString(); break; case "terrain_definition": TerrainDefinition = parser.ReadString(); break; case "heightmap": Heightmap = parser.ReadString(); break; case "tree_definition": TreeDefinition = parser.ReadString(); break; case "continent": Continent = parser.ReadString(); break; case "adjacencies": Adjacencies = parser.ReadString(); break; case "climate": Climate = parser.ReadString(); break; case "region": Region = parser.ReadString(); break; case "static": Static = parser.ReadString(); break; #endregion case "sea_zones": intList = parser.ReadIntList(); SeaZones.Add(new SeaZone(intList[0], intList[1])); break; case "ocean_region": parser.ReadString(); OceanRegions.Add(parser.ReadIntList().ToList()); break; case "tree": Tree.AddRange(parser.ReadIntList().ToList()); break; case "major_rivers": MajorRivers.AddRange(parser.ReadIntList()); break; } }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "parent": Entity.ParentId = parser.ReadString(); break; case "graphical_cultures": Entity.GraphicalCultures = parser.ReadStringList(); break; case "unit_graphical_cultures": Entity.UnitGraphicalCultures = parser.ReadStringList(); break; case "secondary_event_pictures": Entity.SecondaryEventPictures = parser.ReadString(); break; case "used_for_random": Entity.IsAvailableRandomly = parser.ReadBool(); break; case "nomadic_in_alt_start": Entity.IsNomadicInAlternateStart = parser.ReadBool(); break; case "horde": Entity.IsHorde = parser.ReadBool(); break; case "color": Entity.Colour = parser.ReadIntList().ToArray(); break; case "male_names": Entity.MaleNames = parser.ReadStringList(); break; case "female_names": Entity.FemaleNames = parser.ReadStringList(); break; case "from_dynasty_prefix": Entity.FromDynastyPrefix = parser.ReadString(); break; case "bastard_dynasty_prefix": Entity.BastardDynastyPrefix = parser.ReadString(); break; case "grammar_transform": Entity.GrammarTransformation = parser.ReadString(); break; case "male_patronym": Entity.MalePatronym = parser.ReadString(); break; case "female_patronym": Entity.FemalePatronym = parser.ReadString(); break; case "prefix": Entity.IsPatronymPrefix = parser.ReadBool(); break; case "dynasty_name_first": Entity.IsDynastyNameFirst = parser.ReadBool(); break; case "pat_grf_name_chance": Entity.PatrilinealGrandfatherNameChance = parser.ReadInt16(); break; case "pat_grm_name_chance": Entity.PatrilinealGrandmotherNameChance = parser.ReadInt16(); break; case "mat_grf_name_chance": Entity.MatrilinealGrandfatherNameChance = parser.ReadInt16(); break; case "mat_grm_name_chance": Entity.MatrilinealGrandmotherNameChance = parser.ReadInt16(); break; case "father_name_chance": Entity.FatherNameChance = parser.ReadInt16(); break; case "mother_name_chance": Entity.MotherNameChance = parser.ReadInt16(); break; case "dukes_called_kings": Entity.AreDukesCalledKings = parser.ReadBool(); break; case "baron_titles_hidden": Entity.AreBaronTitlesHidden = parser.ReadBool(); break; case "count_titles_hidden": Entity.AreCountTitlesHidden = parser.ReadBool(); break; case "founder_named_dynasties": Entity.AreDynastiesNamedByFounders = parser.ReadBool(); break; case "dynasty_title_names": Entity.HasDynasticTitleNames = parser.ReadBool(); break; case "castes": Entity.HasCastes = parser.ReadBool(); break; case "disinherit_from_blinding": Entity.IsDisinheritedFromBlinding = parser.ReadBool(); break; case "allow_looting": Entity.IsAllowedToLoot = parser.ReadBool(); break; case "seafarer": Entity.IsSeafarer = parser.ReadBool(); break; case "tribal_name": Entity.TribalName = parser.ReadString(); break; case "modifier": Entity.CulturalModifier = parser.ReadString(); break; default: throw new InvalidOperationException($"Unexpected token \"{token}\""); } }
public void TokenCallback(ParadoxParser parser, string token) { if (token[1] == '_') // Like e_something or c_something { LandedTitleDefinition landedTitle = new LandedTitleDefinition(); landedTitle.Entity.ParentId = Entity.Id; landedTitle.Entity.Id = token; Entity.Children.Add(parser.Parse(landedTitle).Entity); return; } switch (token) { // TODO: Implement these case "allow": case "coat_of_arms": case "gain_effect": case "pagan_coa": parser.ReadInsideBrackets((p) => { }); break; case "assimilate": Entity.AllowsAssimilation = parser.ReadBool(); break; case "color": Entity.PrimaryColour = parser.ReadIntList().ToArray(); break; case "color2": Entity.SecondaryColour = parser.ReadIntList().ToArray(); break; case "caliphate": Entity.IsCaliphate = parser.ReadBool(); break; case "capital": Entity.CapitalId = parser.ReadInt32(); break; case "controls_religion": Entity.ControlledReligionId = parser.ReadString(); break; case "creation_requires_capital": Entity.CreationRequiresCapital = parser.ReadBool(); break; case "culture": Entity.CultureId = parser.ReadString(); break; case "dignity": Entity.Dignity = parser.ReadInt32(); break; case "dynasty_title_names": Entity.UseDynastyTitleNames = parser.ReadBool(); break; case "female_names": Entity.FemaleNames = parser.ReadStringList(); break; case "foa": Entity.TitleFormOfAddress = parser.ReadString(); break; case "graphical_culture": Entity.GraphicalCulture = parser.ReadString(); break; case "has_top_de_jure_capital": Entity.HasTopDeJureCapital = parser.ReadBool(); break; case "holy_order": Entity.IsHolyOrder = parser.ReadBool(); break; case "holy_site": Entity.HolySites.Add(parser.ReadString()); break; case "independent": Entity.IsIndependent = parser.ReadBool(); break; case "landless": Entity.IsLandless = parser.ReadBool(); break; case "location_ruler_title": Entity.TitleContainsCapital = parser.ReadBool(); break; case "male_names": Entity.MaleNames = parser.ReadStringList(); break; case "mercenary": Entity.IsMercenaryGroup = parser.ReadBool(); break; case "mercenary_type": Entity.MercenaryType = parser.ReadString(); break; case "monthly_income": Entity.MonthlyIncome = parser.ReadInt32(); break; case "name_tier": Entity.TitleNameTierId = parser.ReadString(); break; case "pirate": Entity.IsPirate = parser.ReadBool(); break; case "primary": Entity.IsPrimaryTitle = parser.ReadBool(); break; case "purple_born_heirs": Entity.HasPurpleBornHeirs = parser.ReadBool(); break; case "religion": Entity.ReligionId = parser.ReadString(); break; case "short_name": Entity.UseShortName = parser.ReadBool(); break; case "strength_growth_per_century": Entity.StrengthGrowthPerCentury = parser.ReadFloat(); break; case "title": Entity.TitleLocalisationId = parser.ReadString(); break; case "title_female": Entity.TitleLocalisationFemaleId = parser.ReadString(); break; case "title_prefix": Entity.TitleLocalisationPrefixId = parser.ReadString(); break; case "tribe": Entity.IsTribe = parser.ReadBool(); break; default: string stringValue = parser.ReadString(); int intValue; if (int.TryParse(stringValue, out intValue)) { Entity.ReligiousValues.AddOrUpdate(token, intValue); } else { Entity.DynamicNames.AddOrUpdate(token, stringValue); } break; } }