Example #1
0
 public static bool SaveToString(StarSector sector)
 {
     Debug.WriteLine("Saving Star Sector");
     try
     {
         var wfile = new StreamWriter("Star Sector.txt");
         wfile.WriteLine(sector.ToString());
         wfile.Close();
     }
     catch (Exception) { return(false); }
     return(true);
 }
Example #2
0
        public static StarSector LoadXML(StreamReader fileStream)
        {
            Debug.WriteLine("Loading Star Sector");
            StarSector sector = null;

            try {
                var reader = new System.Xml.Serialization.XmlSerializer(typeof(StarSector));
                sector = (StarSector)reader.Deserialize(fileStream);
            }
            catch (Exception) { }

            return(sector);
        }
Example #3
0
 public static bool Save(StarSector sector)
 {
     Debug.WriteLine("Saving Star Sector");
     try
     {
         var writer = new System.Xml.Serialization.XmlSerializer(typeof(StarSector));
         var wfile  = new StreamWriter("Star Sector.xml");
         writer.Serialize(wfile, sector);
         wfile.Close();
     }
     catch (Exception) { return(false); }
     return(true);
 }