//The function convert the data to xml
        private string ToXml(Models.FlightValue flightValue)
        {
            //Initiate XML stuff
            StringBuilder     sb       = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();
            XmlWriter         writer   = XmlWriter.Create(sb, settings);

            writer.WriteStartDocument();
            writer.WriteStartElement("Flight");
            flightValue.ToXml(writer);
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Flush();
            return(sb.ToString());
        }
Exemplo n.º 2
0
        public const string SCENARIO_FILE = "~/App_Data/{0}.txt";           // The Path of the Secnario
        public void toFile(string fileName)
        {
            FileStream stream;
            string     path = System.Web.HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, fileName));

            if (!System.IO.File.Exists(path))
            {
                stream = System.IO.File.Open(path, FileMode.OpenOrCreate);
            }
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(path, true))
            {
                Models.FlightValue flight = Info.Instance.flightValueP;
                file.Write(flight.Lat + ",");
                file.Write(flight.Lon + ",");
                file.Write(flight.Rudder + ",");
                file.WriteLine(flight.Throttle + ",");
            }
        }
        public const string SCENARIO_FILE = "~/App_Data/{0}.txt";           // The Path of the Secnario

        //Thr function save the values to a file

        public void toFile(string fileName)
        {
            string path = System.Web.HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, fileName));

            //If the file dose not exist create the file
            if (!System.IO.File.Exists(path))
            {
                System.IO.File.Create(path).Dispose();
            }
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(path, true))
            {
                //Write the data to the file
                Models.FlightValue flight = Info.Instance.flightValueP;
                file.Write(flight.Lat + ",");
                file.Write(flight.Lon + ",");
                file.Write(flight.Rudder + ",");
                file.WriteLine(flight.Throttle + ",");
            }
        }