public override void lantern(List <string> result) { System.Random rnd = new System.Random(); string[] countries = { "United States of America", "Zimbabwe", "Poland", "New Zealand", "Australia", "Switzerland", "Greenland", "Iceland", "Russia", "Syria", "Niger", "Yemen", "Antarctica", "Bosnia and Herzegovina", "Democratic Republic of the Congo", "Jamaica" }; string mission1IP = "73.7.145.117"; //add more if necessary. if (result.Count == 2) { if (StringClassifier.getIP(result[1])) //if it is a real ip { int countryIndex = rnd.Next(countries.Length); //pseudorandomly generate country index for array output.text += ("This person is likely from " + countries[countryIndex]); if (result[1] == mission1IP) { output.text += Environment.NewLine; output.text += ("Job 1 complete. Suspect tracked. Check your inbox."); EnableEmails(); } } else if (StringClassifier.getIP(result[1]) == false) { output.text += "Your IP is in the incorrect format!"; } } else { output.text += "Use ip-trace [IP]"; } }
public override void lantern(List <string> result) { Random rnd = new Random(); string errorMessage = "Use ping [IP]"; if (result.Count == 2) // i.e. if the user entered the name of the command and some numbers to ping { if (StringClassifier.getIP(result[1])) { output.text += ("Pinging " + result[1] + "; Respone time " + rnd.Next(10, 100) + "ms"); } else if (StringClassifier.getIP(result[1]) == false) { output.text += "Your IP address is incorrect"; } } else { output.text += (errorMessage); } }
public void PartTwo(string value, bool isNice) => Assert.Equal(isNice, StringClassifier.IsNicer(value));
public void TestSurrounding(string value) => Assert.True(StringClassifier.HasSurounding(value));
public void TestNoPair() => Assert.False(StringClassifier.HasPair("aaa"));
public void TestPair(string value) => Assert.True(StringClassifier.HasPair(value));