Ejemplo n.º 1
0
		public static void UpdateConf(Configuration c){
			using (Stream stream = File.Open(fileName, FileMode.Create))
			{
				BinaryFormatter b = new BinaryFormatter();
				b.Serialize(stream, c);
			}
		}
Ejemplo n.º 2
0
		public static void InitConf(){
			Configuration c = new Configuration();
			using (Stream stream = File.Open(fileName, FileMode.Create))
			{
				BinaryFormatter b = new BinaryFormatter();
				b.Serialize(stream, c);
			}
		}
Ejemplo n.º 3
0
		public static Configuration ReadConf(){
			Configuration c = new Configuration();
			Stream stream;
			try
			{
				stream = File.Open(fileName, FileMode.Open);
			}
			catch(Exception e)
			{
				InitConf();
				stream = File.Open(fileName, FileMode.Open);

			}

			BinaryFormatter b = new BinaryFormatter();
			c = (Configuration)b.Deserialize(stream);
			stream.Close();
			return c;
		}