Пример #1
0
 public bool SaveRatios(Ratios ratios)
 {
     try
     {
         using (FileStream file = File.Create(RatioSettingFile))
         {
             BinaryFormatter formatter = new BinaryFormatter();
             formatter.Serialize(file, ratios);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
 public bool LoadRatios(String ratiosFile, out Ratios ratios)
 {
     try
     {
         using (FileStream file = File.Open(ratiosFile, FileMode.Open))
         {
             BinaryFormatter formatter = new BinaryFormatter();
             ratios = (Ratios)formatter.Deserialize(file);
         }
     }
     catch (Exception)
     {
         ratios = new Ratios();
         return(false);
     }
     return(true);
 }