public List<Trajectory> GetTrajectories() { List<Trajectory> trajectories = new List<Trajectory>(); var slotIDs = GetSlotIDs(); foreach (int id in slotIDs) { Console.Write("Downloading trajectory for slot {0}... ", id); Console.Clear(); string trajectoryRequest = ""; trajectoryRequest = String.Format("trajectory {0}\n", id); _socket.Send(trajectoryRequest); string trajectoryStr = ReadResponse(); Console.WriteLine("done."); if (trajectoryStr != "> " && !trajectoryStr.Contains("\"atoms\": []")) { TrajectoryParser trajectoryParser = new TrajectoryParser(trajectoryStr); trajectories.Add(trajectoryParser.Parse()); } } Console.WriteLine("Filtered out FahCore 17 slots, left with {0} trajectories.", trajectories.Count); return trajectories; }
private List<Trajectory> GetTrajectories() { List<Trajectory> trajectories = new List<Trajectory>(); try { var socket = new ClientSocket( Options.GetInstance().Host, Options.GetInstance().Port ); FAHClientIO io = new FAHClientIO(socket); trajectories = io.GetTrajectories(); if (trajectories.Count == 0) Console.Write("Not enough slots to work with. Using demo protein.\n"); } catch { Console.Write("Error connection to FAHClient (SocketException). Using demo protein.\n"); } if (trajectories.Count == 0) { //const string FILENAME = "/usr/share/FoldingAtomata/demoProtein"; //String proteinStr = File.ReadAllText(FILENAME); String proteinStr = global::FoldingAtomata.Resources.demoProtein; TrajectoryParser parser = new TrajectoryParser(proteinStr, false); trajectories.Add(parser.Parse()); } return trajectories; }