private static void GetRegex() { string[] stringfiedRegex = FakeServer.GetFakeServer().ReturnRegex(); QueryVerifier queryVerifier = QueryVerifier.GetQueryVerifier(); for (int i = 0; i < stringfiedRegex.Length; i++) { queryVerifier.AddPattern(stringfiedRegex[i]); } }
private static void SetRegex(string message) { XmlMessage request = new XmlMessage(message); QueryVerifier queryVerifier = QueryVerifier.GetQueryVerifier(); string[] regex = request.GetElementsContentByTagName("regex"); for (int i = 0; i < regex.Length; i++) { queryVerifier.AddPattern(regex[i]); } }
private static void StartConsole(NetworkStream stream) { string lineOfCocain; string message; while (!(lineOfCocain = Console.ReadLine()).Equals("EXIT;")) { message = "Go to f**k yourself stupid shitty idiot"; if (QueryVerifier.GetQueryVerifier().EvaluateQuery(lineOfCocain)) { SendAndReceive.SendMessage(stream, TransactionCreator.GetTransactionCreator().CreateGroupDependingXML(QueryVerifier.GetQueryVerifier().queryMatch)); message = (new XmlMessage(SendAndReceive.ReceiveMessage(stream, 256))).GetElementsContentByTagName("payload")[0]; } Console.WriteLine(message); } QueryVerifier.GetQueryVerifier().EvaluateQuery(lineOfCocain); SendAndReceive.SendMessage(stream, TransactionCreator.GetTransactionCreator().CreateGroupDependingXML(QueryVerifier.GetQueryVerifier().queryMatch)); message = (new XmlMessage(SendAndReceive.ReceiveMessage(stream, 256))).GetElementsContentByTagName("payload")[0]; Console.WriteLine(message); tcpClient.Close(); }
public static void DoTheTest(string filePath, string outFilePath) { StreamReader reader = new StreamReader(filePath); int numberOfTest = 1; string textLine; string result = "# TEST" + numberOfTest + "\n"; double seconds = 0; double diff; DateTime date; while ((textLine = reader.ReadLine()) != null) { if (!textLine.Equals("")) { if (QueryVerifier.GetQueryVerifier().EvaluateQuery(textLine)) { date = DateTime.Now; result = result + DirectRequester.GetRequester().SendRequest(TransactionCreator.GetTransactionCreator().CreateGroupDependingXML(QueryVerifier.GetQueryVerifier().queryMatch)); diff = GetDiffAndAct(date, DateTime.Now); result = result + " (" + diff + "s)\n"; seconds = seconds + diff; } else { result = result + "bad sintax\n"; } } else { numberOfTest = numberOfTest + 1; result = result + "TOTAL TIME:" + seconds + "s\n\n" + "# TEST " + numberOfTest + "\n"; seconds = 0; } } result = result + "TOTAL TIME:" + seconds + "s"; File.WriteAllText(outFilePath, result); Console.WriteLine(result); FakeServer.GetFakeServer().SaveShit(); }