Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/19 00:23:12 (5 years ago)
Author:
mkommend
Message:

#2520: Merged 16584, 16585,16594,16595, 16625, 16658, 16659, 16672, 16707, 16729, 16792, 16796, 16797, 16799, 16819, 16906, 16907, 16908, 16933, 16945, 16992, 16994, 16995, 16996, 16997, 17014, 17015, 17017, 17020, 17021, 17022, 17023, 17024, 17029, 17086, 17087, 17088, 17089 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Optimizer

  • stable/HeuristicLab.Optimizer/3.3/StartPage.cs

    r17097 r17105  
    2727using System.Threading;
    2828using System.Windows.Forms;
     29using HEAL.Attic;
    2930using HeuristicLab.Common;
    3031using HeuristicLab.Core;
    3132using HeuristicLab.MainForm;
    32 using HeuristicLab.Persistence.Default.Xml;
    3333
    3434namespace HeuristicLab.Optimizer {
     
    117117
    118118    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);
    124           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 file
    130         }
     119      using (var stream = assembly.GetManifestResourceStream(name)) {
     120        var serializer = new ProtoBufSerializer();
     121        var item = (NamedItem)serializer.Deserialize(stream, false);
     122        OnSampleLoaded(item, group, 1.0 / count);
    131123      }
    132124    }
     
    199191      Properties.Settings.Default.Save();
    200192    }
    201 
    202     #region Helpers
    203     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     #endregion
    209193  }
    210194}
Note: See TracChangeset for help on using the changeset viewer.