public string GetName(RTPN_NameSlot slot, Gender gender = 0) { string str; List <string> strs = this.NamesFor(slot, gender); int num = 0; if (strs.Count == 0) { Log.Error(string.Concat(new object[] { "Name list for gender=", gender, " slot=", slot, " is empty." })); return("Errorname"); } while (true) { str = strs.RandomElement <string>(); if (!NameUseChecker.NameWordIsUsed(str)) { return(str); } num++; if (num > 50) { break; } } return(str); }
public void AddNames(RTPN_NameSlot slot, Gender gender, IEnumerable <string> namesToAdd) { IEnumerator <string> enumerator = namesToAdd.GetEnumerator(); try { while (enumerator.MoveNext()) { string current = enumerator.Current; this.NamesFor(slot, gender).Add(current); } } finally { if (enumerator == null) { } enumerator.Dispose(); } }
public void AddNamesFromFile(RTPN_NameSlot slot, Gender gender, string fileName) { string namesPath = Path.GetFullPath(Path.Combine(modBasePath, "Name Lists/")).Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar); this.AddNames(slot, gender, RTPN_FileRead.LinesFromFile(string.Concat(namesPath, fileName))); }
public List <string> NamesFor(RTPN_NameSlot slot, Gender gender) { return(this.names[(int)gender, (int)slot]); }