Esempio 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);
			}
		}
Esempio 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);
			}
		}
Esempio 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;
		}