Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AssetReferenceLink.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.Diagnostics;
5 using SiliconStudio.Core.IO;
6 using SiliconStudio.Core.Reflection;
7 using SiliconStudio.Core.Serialization;
8 
9 namespace SiliconStudio.Assets.Analysis
10 {
11  /// <summary>
12  /// Updateable reference link returned by <see cref="AssetReferenceAnalysis.Visit"/>.
13  /// </summary>
14  [DebuggerDisplay("{Path}")]
15  public class AssetReferenceLink
16  {
17  /// <summary>
18  /// Initializes a new instance of the <see cref="AssetReferenceLink" /> struct.
19  /// </summary>
20  /// <param name="path">The path.</param>
21  /// <param name="reference">The reference.</param>
22  /// <param name="updateReference">The update reference.</param>
23  public AssetReferenceLink(MemberPath path, object reference, Func<Guid?, string, object> updateReference)
24  {
25  Path = path;
26  this.reference = reference;
27  this.updateReference = updateReference;
28  }
29 
30  /// <summary>
31  /// The path to the member holding this reference.
32  /// </summary>
33  public readonly MemberPath Path;
34 
35  /// <summary>
36  /// A <see cref="IContentReference"/> or <see cref="UFile"/>.
37  /// </summary>
38  public object Reference
39  {
40  get
41  {
42  return reference;
43  }
44  }
45 
46  /// <summary>
47  /// Updates the reference.
48  /// </summary>
49  /// <param name="guid">The unique identifier.</param>
50  /// <param name="location">The location.</param>
51  public void UpdateReference(Guid? guid, string location)
52  {
53  reference = updateReference(guid, location);
54  }
55 
56  /// <summary>
57  /// A specialized method to update the reference (guid, and location).
58  /// </summary>
59  private readonly Func<Guid?, string, object> updateReference;
60 
61  private object reference;
62  }
63 }
Allows to get/set a property/field value on a deeply nested object instance (supporting members...
Definition: MemberPath.cs:14