Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AssetToImportMerge.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Generic;
5 using System.Diagnostics;
6 using SiliconStudio.Assets.Diff;
7 
8 namespace SiliconStudio.Assets
9 {
10  /// <summary>
11  /// Describes a mergeable previous item. The item as a <see cref="MatchingFactor"/> and <see cref="IsMergeable"/>
12  /// is <c>true</c> if the <see cref="AssetToImportMergeGroup.Item"/> can be merged into <see cref="PreviousItem"/>.
13  /// </summary>
14  [DebuggerDisplay("MergeItem: {PreviousItem} Matching: {MatchingFactor}")]
15  public class AssetToImportMerge
16  {
17  /// <summary>
18  /// Initializes a new instance of the <see cref="AssetToImportMerge"/> class.
19  /// </summary>
20  /// <param name="previousItem">The previous item.</param>
21  /// <param name="diff">The difference.</param>
22  /// <param name="mergePreviewResult">The merge preview result.</param>
23  internal AssetToImportMerge(AssetItem previousItem, AssetDiff diff, MergeResult mergePreviewResult)
24  {
25  PreviousItem = previousItem;
26  this.Diff = diff;
27  this.MergePreviewResult = mergePreviewResult;
28  DependencyGroups = new List<AssetToImportMergeGroup>();
29  }
30 
31  /// <summary>
32  /// Gets the previous item matching the new item to import.
33  /// </summary>
34  /// <value>The previous item.</value>
35  public AssetItem PreviousItem { get; private set; }
36 
37  /// <summary>
38  /// Gets the difference between the <see cref="PreviousItem"/> and the item to import.
39  /// </summary>
40  /// <value>The difference.</value>
41  public AssetDiff Diff { get; private set; }
42 
43  /// <summary>
44  /// Gets a value indicating whether the new item is mergeable into the <see cref="PreviousItem"/>.
45  /// </summary>
46  /// <value><c>true</c> if the new item is mergeable into the <see cref="PreviousItem"/>; otherwise, <c>false</c>.</value>
47  public bool IsMergeable
48  {
49  get
50  {
51  return MergePreviewResult != null && !MergePreviewResult.HasErrors;
52  }
53  }
54 
55  /// <summary>
56  /// Gets the merge preview result.
57  /// </summary>
58  /// <value>The merge preview result.</value>
59  public MergeResult MergePreviewResult { get; private set; }
60 
61  /// <summary>
62  /// Gets the matching factor, between 0.0 and 1.0, a match of 1.0 indicates that the assets are identical.
63  /// </summary>
64  /// <value>The matching factor.</value>
65  public double MatchingFactor { get; internal set; }
66 
67  /// <summary>
68  /// Gets the list of <see cref="AssetToImportMergeGroup"/> this merge is dependent on.
69  /// </summary>
70  /// <value>The dependency groups.</value>
71  public List<AssetToImportMergeGroup> DependencyGroups { get; private set; }
72  }
73 }
Result of a merge. Contains Asset != null if there are no errors.
Definition: MergeResult.cs:10
An asset item part of a Package accessible through SiliconStudio.Assets.Package.Assets.
Definition: AssetItem.cs:17
Describes a mergeable previous item. The item as a MatchingFactor and IsMergeable is true if the Asse...
Class AssetDiff. This class cannot be inherited.
Definition: AssetDiff.cs:15