Professional Documents
Culture Documents
namespace IPR2
{
enum Direction { Left, Up, Down, Right }
class AirPlaneInfo
{
public double Speed { get; set; }
public int Height { get; set; }
public Direction Direction { get; set; }
public int Time { get; set; }
}
class AirPlane
{
public List<AirPlaneInfo> infos;
public int Index { get; set; }
}
class Program
{
static double passedSeconds;
SaveToFile(plane1);
SaveToFile(plane2);
while (true)
{
passedSeconds = (DateTime.Now - startTime).TotalSeconds;
Thread.Sleep(100);
}
}
Thread.Sleep(100);
if (info.Time < passedSeconds)
{
curIndex++;
}
}
}
try
{
using (var sr = new StreamReader($"plane{planeIndex}.txt"))
{
string line;
while ((line = sr.ReadLine()) != null)
{
var lines = line.Split();
plane.infos.Add(new AirPlaneInfo
{
Height = Convert.ToInt32(lines[0]),
Speed = Convert.ToDouble(lines[1]),
Time = Convert.ToInt32(lines[2]),
Direction = (Direction) Convert.ToInt32(lines[3])
});
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
throw;
}
return plane;
}