您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
43 行
1.2 KiB
43 行
1.2 KiB
using System;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace UnityConsole
|
|
{
|
|
/// <summary>
|
|
/// An exception thrown when attempting to retrieve a command that does not exist.
|
|
/// </summary>
|
|
[Serializable]
|
|
public class NoSuchCommandException : Exception
|
|
{
|
|
/// <summary>
|
|
/// The command that does not exist.
|
|
/// </summary>
|
|
public string command { get; private set; }
|
|
|
|
public NoSuchCommandException() : base() { }
|
|
|
|
public NoSuchCommandException(string message) : base(message) { }
|
|
|
|
public NoSuchCommandException(string message, string command)
|
|
: base(message)
|
|
{
|
|
this.command = command;
|
|
}
|
|
|
|
protected NoSuchCommandException(SerializationInfo info, StreamingContext context)
|
|
: base(info, context)
|
|
{
|
|
if (info != null)
|
|
this.command = info.GetString("command");
|
|
}
|
|
|
|
// Perform serialization
|
|
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
|
{
|
|
base.GetObjectData(info, context);
|
|
|
|
if (info != null)
|
|
info.AddValue("command", command);
|
|
}
|
|
}
|
|
}
|