Esempio n. 1
0
 //ToXml function
 public void ToXml(XmlWriter xmlWriter)
 {
     xmlWriter.WriteElementString("oldLat", oldLat.ToString());
     xmlWriter.WriteElementString("oldLon", oldLon.ToString());
     xmlWriter.WriteElementString("Lat", Lat.ToString());
     xmlWriter.WriteElementString("Lon", Lon.ToString());
     xmlWriter.WriteElementString("Height", Height.ToString());
     xmlWriter.WriteElementString("Throttel", Throttel.ToString());
     xmlWriter.WriteElementString("Rudder", Rudder.ToString());
 }
Esempio n. 2
0
        public const string SCENARIO_FILE = "~/App_Data/{0}.txt"; // The Path of the Secnario

        public void writeToFile()
        {
            string path = HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, FileName));

            listen();
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(path, true))
            {
                file.WriteLine(Lon.ToString());
                file.WriteLine(Lat.ToString());
                file.WriteLine(Throttle.ToString());
                file.WriteLine(Rudder.ToString());
            }
        }
Esempio n. 3
0
        public void addYourselfToXml(XDocument xDocument)
        {
            XElement root = xDocument.Element("Locations");
            IEnumerable <XElement> rows = root.Descendants("Location");
            XElement firstRow           = rows.Last();

            firstRow.AddAfterSelf(
                new XElement("Location",
                             new XElement("Lat", Lat.ToString()),
                             new XElement("Lon", Lon.ToString()),
                             new XElement("Rudder", Rudder.ToString()),
                             new XElement("Throttle", Throttle.ToString())));

            /* XElement root = xDocument.Element("Locations");
             * XElement son = new XElement("Location");
             * son.Add(new XElement("Lat", Lat.ToString()));
             * son.Add(new XElement("Lon", Lon.ToString()));
             * son.Add(new XElement("Rudder", Rudder.ToString()));
             * son.Add(new XElement("Throttle", Lat.ToString()));
             * root.Add(son);*/
        }
Esempio n. 4
0
 /// <summary>
 /// this saves the info to the file.
 /// </summary>
 public void SaveToFile()
 {
     if (FileName != null)
     {
         string path = HttpContext.Current.Server.MapPath(String.Format(filePath, FileName));
         string line = (Lat.ToString() + "," + Lon.ToString() + "," + Throttle.ToString() + "," + Rudder.ToString());
         using (FileStream fs = new FileStream(path, FileMode.Append, FileAccess.Write))
             using (StreamWriter sw = new StreamWriter(fs))
             {
                 sw.WriteLine(line);
             }
     }
 }