- Timestamp:
- 06/25/19 23:14:06 (5 years ago)
- Location:
- branches/2435-alglib_3_15
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2435-alglib_3_15
- Property svn:mergeinfo changed
-
branches/2435-alglib_3_15/HeuristicLab.Optimizer
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Optimizer (added) merged: 16992,16997,17022-17023
- Property svn:mergeinfo changed
-
branches/2435-alglib_3_15/HeuristicLab.Optimizer/3.3/StartPage.cs
r16565 r17034 23 23 using System.Collections.Generic; 24 24 using System.IO; 25 using System.IO.Compression; 25 26 using System.Linq; 26 27 using System.Reflection; 27 28 using System.Threading; 28 29 using System.Windows.Forms; 30 using HEAL.Attic; 29 31 using HeuristicLab.Common; 30 32 using HeuristicLab.Core; 31 33 using HeuristicLab.MainForm; 32 using HeuristicLab.Persistence.Default.Xml;33 34 34 35 namespace HeuristicLab.Optimizer { … … 117 118 118 119 private void LoadSample(string name, Assembly assembly, ListViewGroup group, int count) { 119 string path = Path.GetTempFileName();120 try {121 using (var stream = assembly.GetManifestResourceStream(name)) {122 WriteStreamToTempFile(stream, path); // create a file in a temporary folder (persistence cannot load these files directly from the stream)123 var item = XmlParser.Deserialize<INamedItem>(path);120 using (var stream = assembly.GetManifestResourceStream(name)) { 121 var serializer = new ProtoBufSerializer(); 122 // TODO remove deflateStream with next release of HEAL.Attic 123 using (var deflateStream = new DeflateStream(stream, CompressionMode.Decompress, true)) { 124 var item = (NamedItem)serializer.Deserialize(deflateStream, false); 124 125 OnSampleLoaded(item, group, 1.0 / count); 125 }126 } catch (Exception) {127 } finally {128 if (File.Exists(path)) {129 File.Delete(path); // make sure we remove the temporary file130 126 } 131 127 } … … 199 195 Properties.Settings.Default.Save(); 200 196 } 201 202 #region Helpers203 private void WriteStreamToTempFile(Stream stream, string path) {204 using (FileStream output = new FileStream(path, FileMode.Create, FileAccess.Write)) {205 stream.CopyTo(output);206 }207 }208 #endregion209 197 } 210 198 }
Note: See TracChangeset
for help on using the changeset viewer.