forked from sin365/AxibugEmuOnline
46 lines
924 B
C#
46 lines
924 B
C#
/// <summary>
|
|
/// StringºÍBoolµÄ·ìºÏ¹Ö
|
|
/// </summary>
|
|
public struct MsgBool
|
|
{
|
|
public string ErrorMsg;
|
|
public bool Value;
|
|
|
|
public override readonly string ToString()
|
|
{
|
|
if (Value)
|
|
{
|
|
return true.ToString();
|
|
}
|
|
else
|
|
{
|
|
return ErrorMsg;
|
|
}
|
|
}
|
|
|
|
public static implicit operator MsgBool(string errorMsg)
|
|
{
|
|
return new MsgBool { Value = false, ErrorMsg = errorMsg };
|
|
}
|
|
|
|
public static implicit operator MsgBool(bool value)
|
|
{
|
|
return new MsgBool { Value = value };
|
|
}
|
|
|
|
public static implicit operator bool(MsgBool msgBool)
|
|
{
|
|
return msgBool.Value;
|
|
}
|
|
|
|
public static implicit operator (bool, string)(MsgBool msgBool)
|
|
{
|
|
return (msgBool.Value, msgBool.ErrorMsg);
|
|
}
|
|
|
|
public static implicit operator string(MsgBool msgBool)
|
|
{
|
|
return msgBool.ToString();
|
|
}
|
|
}
|