Changeset 22


Ignore:
Timestamp:
02/21/08 09:35:02 (13 years ago)
Author:
gkronber
Message:

fixed issues with save/load from/to file (ticket #25)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/PersistenceManager.cs

    r21 r22  
    6262    }
    6363    public static void Save(IStorable instance, string filename) {
    64       if (File.Exists(filename)) File.WriteAllText(filename, "");
    65       Save(instance, File.OpenWrite(filename));
     64      FileStream stream = File.Create(filename);
     65      Save(instance, stream);
     66      stream.Close();
    6667    }
    6768    public static void Save(IStorable instance, Stream stream) {
     
    7172    }
    7273    public static IStorable Load(string filename) {
    73       return Load(File.OpenRead(filename));
     74      FileStream stream = File.OpenRead(filename);
     75      IStorable storable = Load(stream);
     76      stream.Close();
     77      return storable;
    7478    }
    7579    public static IStorable Load(Stream stream) {
Note: See TracChangeset for help on using the changeset viewer.