Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/02/19 16:07:07 (6 years ago)
Author:
gkronber
Message:

#2520: use new persistence in ContentManager (with fallback), ClipBoard (with fallback), as well as for deep-cloning in Scripting and for Hive Persistence (without fallback & incomplete)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2520_PersistenceReintegration/HeuristicLab.Core.Views/3.3/Clipboard.cs

    r16453 r16480  
    2828using System.Threading;
    2929using System.Windows.Forms;
     30using HEAL.Fossil;
    3031using HeuristicLab.Common;
    3132using HeuristicLab.MainForm;
     
    156157      foreach (string filename in items) {
    157158        try {
    158           T item = XmlParser.Deserialize<T>(filename);
     159          var ser = new ProtoBufSerializer();
     160          T item = (T)ser.Deserialize(filename);
    159161          OnItemLoaded(item, progressBar.Maximum / items.Length);
    160         }
    161         catch (Exception) { }
     162        } catch (Exception) {
     163          try {
     164            // try old format if protobuf deserialization fails
     165            T item = XmlParser.Deserialize<T>(filename);
     166            OnItemLoaded(item, progressBar.Maximum / items.Length);
     167          } catch (Exception) { }
     168        }
    162169      }
    163170      OnAllItemsLoaded();
     
    199206          i++;
    200207          SetEnabledStateOfContentViews(item, false);
    201           XmlGenerator.Serialize(item, ItemsPath + Path.DirectorySeparatorChar + i.ToString("00000000") + ".hl", CompressionLevel.Optimal);
     208          var ser = new ProtoBufSerializer();
     209          ser.Serialize(item, ItemsPath + Path.DirectorySeparatorChar + i.ToString("00000000") + ".hl");
    202210          OnItemSaved(item, progressBar.Maximum / listView.Items.Count);
    203211        }
Note: See TracChangeset for help on using the changeset viewer.