private static void Create(this Sequences sequences, UdpSender sender, string sequence) { // char array to ulong array var linksSequence = new ulong[sequence.Length]; for (int i = 0; i < sequence.Length; i++) linksSequence[i] = sequence[i]; ulong resultLink = sequences.Create(linksSequence); sender.Send(string.Format("Sequence with balanced variant at {0} created.", resultLink)); }
private static void Main() { using (var receiver = new UdpReceiver(8888, m => Console.WriteLine("R.M.: {0}", m))) { receiver.Start(); using (var sender = new UdpSender(7777)) { Console.WriteLine("Welcome to sequences terminal."); string line; while (!string.IsNullOrWhiteSpace(line = Console.ReadLine())) sender.Send(line); Console.WriteLine("Empty request. Press any key to terminate process."); Console.ReadKey(); } receiver.Stop(); } Console.WriteLine(); Console.ReadKey(); }
private static void Search(this Sequences sequences, UdpSender sender, string sequenceQuery) { var linksSequenceQuery = new ulong[sequenceQuery.Length]; for (int i = 0; i < sequenceQuery.Length; i++) if (sequenceQuery[i] == '_') linksSequenceQuery[i] = 0; else linksSequenceQuery[i] = sequenceQuery[i]; var resultList = sequences.Each(linksSequenceQuery); //sequences.CollectMatchingSequences(linksSequenceQuery); //sequences.Each(linksSequenceQuery); if (resultList.Count == 0) { sender.Send("No full sequences found."); } else if (resultList.Count == 1) sender.Send(string.Format("Full sequence found - {0}.", resultList.First())); else { sender.Send(string.Format("Found {0} full sequences:", resultList.Count)); foreach (var result in resultList) sender.Send(string.Format("\t{0}", result)); } /* var resultHash = sequences.EachPart(linksSequenceQuery); // Subsequences if (resultHash.Count == 0) { sender.Send("No partial sequences found."); } else if (resultHash.Count == 1) sender.Send(string.Format("Partial sequence found - {0}.", resultHash.First())); else { sender.Send(string.Format("Found {0} partial sequences:", resultHash.Count)); foreach (var result in resultHash) sender.Send(string.Format("\t{0}", result)); } */ }