public string LocationsToString(FlightSample flightSample) { string location = flightSample.location.longtitude.ToString() + "," + flightSample.location.latitude.ToString() + "," + flightSample.altitude.ToString() + "," + flightSample.direction.ToString() + "," + flightSample.velocity.ToString(); return(location); }
public FlightSample CreateFlightSample() { rnd = new Random(); FlightSample flightSample = new FlightSample((double)rnd.Next(1, 50), (double)rnd.Next(1, 50)); flightSample.altitude = (float)rnd.Next(1, 50); flightSample.direction = (float)rnd.Next(1, 50); flightSample.velocity = (float)rnd.Next(1, 50); return(flightSample); }
//converting FlightSample to XML string ToXml(FlightSample sample) { //Initiate XML stuff StringBuilder sb = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); XmlWriter writer = XmlWriter.Create(sb, settings); writer.WriteStartDocument(); sample.ToXml(writer); writer.WriteEndDocument(); writer.Flush(); return(sb.ToString()); }
public void SaveLocations(FlightSample flightSample, string fileName, bool toCreateFile) { string location = LocationsToString(flightSample); string path = HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, fileName)); if (toCreateFile) { if (File.Exists(path)) { File.Delete(path); } } using (System.IO.StreamWriter file = new System.IO.StreamWriter(path, true)) { file.WriteLine(location); } }
public void SaveLocation(FlightSample flightSample, string fileName, bool toCreateFile) { infoModel = InfoModel.Instance; infoModel.SaveLocations(flightSample, fileName, toCreateFile); }
public void GetLocation(string fileName, bool toCreateFile) { FlightSample flightSample = CreateFlightSample(); SaveLocation(flightSample, fileName, toCreateFile); }