using Newtonsoft.Json;
using UAssetAPI.UnrealTypes;
namespace UAssetAPI.Kismet.Bytecode.Expressions
{
///
/// A single Kismet bytecode instruction, corresponding to the instruction.
///
public class EX_Assert : KismetExpression
{
///
/// The token of this expression.
///
public override EExprToken Token { get { return EExprToken.EX_Assert; } }
///
/// Line number.
///
[JsonProperty]
public ushort LineNumber;
///
/// Whether or not this assertion is in debug mode.
///
[JsonProperty]
public bool DebugMode;
///
/// Expression to assert.
///
[JsonProperty]
public KismetExpression AssertExpression;
public EX_Assert()
{
}
///
/// Reads out the expression from a BinaryReader.
///
/// The BinaryReader to read from.
public override void Read(AssetBinaryReader reader)
{
LineNumber = reader.ReadUInt16();
DebugMode = reader.ReadBoolean();
AssertExpression = ExpressionSerializer.ReadExpression(reader);
}
///
/// Writes the expression to a BinaryWriter.
///
/// The BinaryWriter to write from.
/// The iCode offset of the data that was written.
public override int Write(AssetBinaryWriter writer)
{
int offset = 0;
writer.Write(LineNumber); offset += sizeof(ushort);
writer.Write(DebugMode); offset += sizeof(bool);
offset += ExpressionSerializer.WriteExpression(AssertExpression, writer);
return offset;
}
}
}