/// <summary> /// Initialize the NPC factions. /// </summary> private static void LoadFactions() { // This is a workaround until XmlGenerator can be updated foreach (string factionInfo in Properties.Resources.chrFactions.Split('\n')) { string[] entries = factionInfo.Split(','); NPCCorporation baseCorp = null, militiaCorp = null; if (entries.Length > 9) { // factionID,factionName,description,raceIDs,solarSystemID,corporationID, // sizeFactor,stationCount,stationSystemCount,militiaCorporationID,iconID int id, end = entries.Length, corpID, militiaID; string factionName = entries[1].Trim(); // Find executor and militia corps (also NPC) if (entries[end - 2].TryParseInv(out militiaID)) { militiaCorp = GetCorporationByID(militiaID); } if (entries[end - 6].TryParseInv(out corpID)) { baseCorp = GetCorporationByID(corpID); } if (entries[0].TryParseInv(out id) && !string.IsNullOrEmpty(factionName) && id > 0 && baseCorp != null) { s_factionsByID.Add(id, new Faction(id, baseCorp, militiaCorp, factionName)); } } } }
/// <summary> /// Initializes a new instance of the <see cref="Faction"/> class. /// </summary> /// <param name="station">The station.</param> /// <exception cref="System.ArgumentNullException">station</exception> public Faction(int id, NPCCorporation baseCorp, NPCCorporation militiaCorp, string name) { baseCorp.ThrowIfNull(nameof(baseCorp)); // Militia corp can be null if (name.IsEmptyOrUnknown()) { throw new ArgumentException("name"); } Corporation = baseCorp; ID = id; MilitiaCorporation = militiaCorp; Name = name; }