Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/29/19 15:57:35 (5 years ago)
Author:
mkommend
Message:

#2521: Merged trunk changes into problem refactoring branch.

Location:
branches/2521_ProblemRefactoring
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring

  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/ArrayExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/AsyncHelper.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/CancelEventArgs.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Cloner.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/ColorGradient.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Constants.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Content/ContentManager.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System;
     23using System.Collections.Generic;
     24using System.Linq;
    2325using System.Threading;
     26using System.Threading.Tasks;
     27using HEAL.Attic;
    2428
    2529namespace HeuristicLab.Common {
    2630  public abstract class ContentManager {
     31    public class Info {
     32      public Info() { }
     33
     34      public Info(string filename, TimeSpan duration) {
     35        Filename = filename;
     36        Duration = duration;
     37      }
     38
     39      public Info(string filename, SerializationInfo serInfo) {
     40        Filename = filename;
     41        Duration = serInfo.Duration;
     42        UnknownTypeGuids = serInfo.UnknownTypeGuids;
     43        NumberOfSerializedObjects = serInfo.NumberOfSerializedObjects;
     44        SerializedTypes = serInfo.SerializedTypes;       
     45      }
     46
     47      public TimeSpan Duration { get; internal set; }
     48      public IEnumerable<Guid> UnknownTypeGuids { get; internal set; } = Enumerable.Empty<Guid>();
     49      public int NumberOfSerializedObjects { get; internal set; }
     50      public IEnumerable<Type> SerializedTypes { get; internal set; } = Enumerable.Empty<Type>();
     51      public string Filename { get; internal set; } = string.Empty;
     52    }
     53
    2754    private static ContentManager instance;
    2855
     
    3663
    3764    public static IStorableContent Load(string filename) {
     65      return Load(filename, out var _);
     66    }
     67
     68    public static IStorableContent Load(string filename, out Info serializationInfo) {
    3869      if (instance == null) throw new InvalidOperationException("ContentManager is not initialized.");
    39       IStorableContent content = instance.LoadContent(filename);
    40       content.Filename = filename;
     70      IStorableContent content = instance.LoadContent(filename, out serializationInfo);
     71     
     72      if (content != null) content.Filename = filename;
    4173      return content;
    4274    }
    43     public static void LoadAsync(string filename, Action<IStorableContent, Exception> loadingCompletedCallback) {
     75
     76
     77    public static Task LoadAsync(string filename, Action<IStorableContent, Exception> loadingCompletedCallback) {
     78      return LoadAsync(filename, (content, error, info) => loadingCompletedCallback(content, error)); // drop info
     79    }
     80
     81    public static async Task LoadAsync(string filename, Action<IStorableContent, Exception, Info> loadingCompletedCallback) {
    4482      if (instance == null) throw new InvalidOperationException("ContentManager is not initialized.");
    45       var func = new Func<string, IStorableContent>(instance.LoadContent);
    46       func.BeginInvoke(filename, delegate (IAsyncResult result) {
    47         Exception error = null;
    48         IStorableContent content = null;
    49         try {
    50           content = func.EndInvoke(result);
    51           content.Filename = filename;
    52         } catch (Exception ex) {
    53           error = ex;
    54         }
    55         loadingCompletedCallback(content, error);
    56       }, null);
     83
     84      Exception error = null;
     85      IStorableContent result = null;
     86      Info serializationInfo = null;
     87      try {
     88        result = await Task.Run(() => {
     89          var content = instance.LoadContent(filename, out serializationInfo);
     90          if(content!=null) content.Filename = filename;
     91          return content;
     92        });
     93      } catch(Exception ex) {
     94        error = ex;
     95      }
     96      loadingCompletedCallback(result, error, serializationInfo);
    5797    }
    58     protected abstract IStorableContent LoadContent(string filename);
     98
     99    protected abstract IStorableContent LoadContent(string filename, out Info serializationInfo);
    59100
    60101    public static void Save(IStorableContent content, string filename, bool compressed, CancellationToken cancellationToken = default(CancellationToken)) {
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Content/IContent.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Content/IStorableContent.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/DeepCloneable.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/DoubleExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/EnumerableExtensions.cs

    r17225 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/EventArgs.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/ExceptionExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/IDeepCloneable.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/ListExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/MatrixExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/NaturalStringComparer.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/ObjectExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Plugin.cs.frame

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2929  /// Plugin class for HeuristicLab.Common plugin.
    3030  /// </summary>
    31   [Plugin("HeuristicLab.Common", "3.3.15.$WCREV$")]
     31  [Plugin("HeuristicLab.Common", "3.3.16.$WCREV$")]
    3232  [PluginFile("HeuristicLab.Common-3.3.dll", PluginFileType.Assembly)]
    3333  [PluginDependency("HeuristicLab.Attic", "1.0")]
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Point2D.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Properties/AssemblyInfo.cs.frame

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3232[assembly: AssemblyCompany("")]
    3333[assembly: AssemblyProduct("HeuristicLab")]
    34 [assembly: AssemblyCopyright("(c) 2002-2018 HEAL")]
     34[assembly: AssemblyCopyright("(c) HEAL")]
    3535[assembly: AssemblyTrademark("")]
    3636[assembly: AssemblyCulture("")]
     
    5454// by using the '*' as shown below:
    5555[assembly: AssemblyVersion("3.3.0.0")]
    56 [assembly: AssemblyFileVersion("3.3.15.$WCREV$")]
     56[assembly: AssemblyFileVersion("3.3.16.$WCREV$")]
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/ReferenceEqualityComparer.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/SequenceGenerator.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Statistics/EmpiricalCumulativeDistributionFunction.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/Statistics/EnumerableStatisticExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/TimeSpanHelper.cs

    r16723 r17226  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/TypeEqualityComparer.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/2521_ProblemRefactoring/HeuristicLab.Common/3.3/TypeExtensions.cs

    r16723 r17226  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
Note: See TracChangeset for help on using the changeset viewer.