public static Email RandomChildishEmail(bool usCommonOnly = true) { var shortWords = Etx.EnglishWords.Where(x => x.Item1.Length <= 3).Select(x => x.Item1).ToArray(); var shortWordList = new List <string>(); var otherWords = ChildishUserNames; var withUcase = NfString.CapWords(Etx.RandomPickOne(shortWords), ' '); shortWordList.Add(withUcase); shortWordList.Add(Etx.RandomPickOne(otherWords)); if (Etx.RandomCoinToss()) { shortWordList.Add(NfString.CapWords(Etx.RandomPickOne(shortWords), ' ')); } shortWordList = Etx.RandomShuffle(shortWordList.ToArray()).ToList(); if (Etx.RandomCoinToss()) { shortWordList.Add((Etx.RandomCoinToss() ? "_" : "") + Etx.RandomInteger(100, 9999)); } return(RandomEmail(string.Join("", shortWordList), usCommonOnly)); }
internal static bool TryParseXml(XmlElement node, out AmericanHighSchool hs) { try { hs = new AmericanHighSchool(); if (node == null) { return(false); } if (node.LocalName != "high-school") { return(false); } var attr = node.Attributes["name"]; hs.Name = attr == null ? String.Empty : attr.Value; attr = node.Attributes["urban-centric"]; if (attr != null) { switch (attr.Value) { case "City-Large": hs.UrbanCentric = UrbanCentric.City | UrbanCentric.Large; break; case "City-Midsize": hs.UrbanCentric = UrbanCentric.City | UrbanCentric.Large; break; case "City-Small": hs.UrbanCentric = UrbanCentric.City | UrbanCentric.Small; break; case "Rural-Distant": hs.UrbanCentric = UrbanCentric.Rural | UrbanCentric.Distant; break; case "Rural-Fringe": hs.UrbanCentric = UrbanCentric.Rural | UrbanCentric.Fringe; break; case "Rural-Remote": hs.UrbanCentric = UrbanCentric.Rural | UrbanCentric.Remote; break; case "Suburb-Large": hs.UrbanCentric = UrbanCentric.Suburb | UrbanCentric.Large; break; case "Suburb-Midsize": hs.UrbanCentric = UrbanCentric.Suburb | UrbanCentric.Midsize; break; case "Suburb-Small": hs.UrbanCentric = UrbanCentric.Suburb | UrbanCentric.Small; break; case "Town-Distant": hs.UrbanCentric = UrbanCentric.Town | UrbanCentric.Distant; break; case "Town-Fringe": hs.UrbanCentric = UrbanCentric.Town | UrbanCentric.Fringe; break; case "Town-Remote": hs.UrbanCentric = UrbanCentric.Town | UrbanCentric.Remote; break; } } attr = node.Attributes["teachers"]; if (attr != null) { if (Double.TryParse(attr.Value, out var dblOut)) { hs.TotalTeachers = dblOut; } } attr = node.Attributes["total-students"]; if (attr != null) { if (Int32.TryParse(attr.Value, out var intOut)) { hs.TotalStudents = intOut; } } if (node.ParentNode == null || node.ParentNode.LocalName != "zip-stat" || node.ParentNode.Attributes?["value"] == null) { return(true); } var zipStatNode = node.ParentNode; if (zipStatNode.Attributes != null) { attr = zipStatNode.Attributes["value"]; } hs.PostalCode = attr?.Value; hs.Name = NfString.CapWords(hs.Name.Replace("JR\\SR", "Jr\\Sr"), ' '); return(true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine($"{ex.Message}\n{ex.StackTrace}"); hs = null; return(false); } }