Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AssetCommand.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 SiliconStudio.BuildEngine;
4 using SiliconStudio.Core.Serialization;
5 
6 namespace SiliconStudio.Assets.Compiler
7 {
8  /// <summary>
9  /// A command processing an <see cref="Asset"/>.
10  /// </summary>
11  public abstract class AssetCommand : IndexFileCommand
12  {
13  }
14 
15  public abstract class AssetCommand<T> : AssetCommand
16  {
17  protected T asset;
18 
19  public string Url { get; set; }
20 
21  public T Asset
22  {
23  get { return asset; }
24  set { asset = value; }
25  }
26 
27  protected AssetCommand()
28  {
29  }
30 
31  protected AssetCommand(string url, T asset)
32  {
33  this.Url = url;
34  this.asset = asset;
35  }
36 
37  public override string Title
38  {
39  get
40  {
41  return string.Format("Asset command processing {0}", Url);
42  }
43  }
44 
45  protected override void ComputeParameterHash(BinarySerializationWriter writer)
46  {
47  base.ComputeParameterHash(writer);
48 
49  var url = Url;
50  writer.Serialize(ref asset, ArchiveMode.Serialize);
51  writer.Serialize(ref url, ArchiveMode.Serialize);
52  }
53 
54  public override string ToString()
55  {
56  // TODO provide automatic asset to string via YAML
57  return asset.ToString();
58  }
59  }
60 }
Base class for Asset.
Definition: Asset.cs:14
A command processing an Asset.
Definition: AssetCommand.cs:11
Implements SerializationStream as a binary writer.
override void ComputeParameterHash(BinarySerializationWriter writer)
Definition: AssetCommand.cs:45
A Command that reads and/or writes to the index file.