Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
FailedCommand.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.Threading.Tasks;
5 
6 using SiliconStudio.BuildEngine;
7 using SiliconStudio.Core.Serialization;
8 
9 namespace SiliconStudio.Assets.Compiler
10 {
11  public class FailedCommand: Command
12  {
13  private readonly string objectThatFailed;
14 
15  public FailedCommand(string objectThatFailed)
16  {
17  this.objectThatFailed = objectThatFailed;
18  }
19 
20  public override string Title
21  {
22  get
23  {
24  return string.Format("Failed command [Object={0}]", objectThatFailed);
25  }
26  }
27 
28  protected override Task<ResultStatus> DoCommandOverride(ICommandContext commandContext)
29  {
30  return Task.FromResult(ResultStatus.Failed);
31  }
32 
33  public override string ToString()
34  {
35  return Title;
36  }
37 
38  protected override void ComputeParameterHash(BinarySerializationWriter writer)
39  {
40  // force execution of the command with a new GUID
41  var newGuid = Guid.NewGuid();
42  writer.Serialize(ref newGuid, ArchiveMode.Serialize);
43  }
44  }
45 }
Implements SerializationStream as a binary writer.
override void ComputeParameterHash(BinarySerializationWriter writer)
override Task< ResultStatus > DoCommandOverride(ICommandContext commandContext)
The method to override containing the actual command code. It is called by the DoCommand function ...