Changeset 1733 for trunk/sources/HeuristicLab.Persistence/3.3/Default
- Timestamp:
- 05/04/09 16:43:46 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r1704 r1733 161 161 162 162 public static void Serialize(object obj, string filename, Configuration config) { 163 string tempfile = Path.GetTempFileName(); 164 try { 165 Serialize(obj, File.Create(tempfile), config); 166 File.Copy(tempfile, filename, true); 167 File.Delete(tempfile); 168 } catch (Exception x) { 169 Logger.Warn("Exception caught, no data has been written."); 170 throw; 171 } 172 } 173 174 public static void Serialize(object obj, Stream stream, Configuration config) { 163 175 try { 164 176 Serializer serializer = new Serializer(obj, config); 165 177 XmlGenerator generator = new XmlGenerator(); 166 178 ILog logger = Logger.GetDefaultLogger(); 167 using (ZipOutputStream zipStream = new ZipOutputStream( File.Create(filename))) {179 using (ZipOutputStream zipStream = new ZipOutputStream(stream)) { 168 180 zipStream.SetLevel(9); 169 181 zipStream.PutNextEntry(new ZipEntry("data.xml"));
Note: See TracChangeset
for help on using the changeset viewer.