本文整理汇总了C#中Kirikiri.Tjs2.Variant.IsNumber方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.IsNumber方法的具体用法?C# Variant.IsNumber怎么用?C# Variant.IsNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kirikiri.Tjs2.Variant
的用法示例。
在下文中一共展示了Variant.IsNumber方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetOctetProperty
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
private static void SetOctetProperty(Variant param, Variant octet, Variant member
)
{
// processes properties toward octets.
if (member.IsNumber() != true)
{
string name = member.GetString();
if (name == null)
{
ThrowFrom_tjs_error(Error.E_MEMBERNOTFOUND, string.Empty);
}
if (name.Equals("length"))
{
ThrowFrom_tjs_error(Error.E_ACCESSDENYED, string.Empty);
}
else
{
if (name[0] >= '0' && name[0] <= '9')
{
ThrowFrom_tjs_error(Error.E_ACCESSDENYED, string.Empty);
}
}
ThrowFrom_tjs_error(Error.E_MEMBERNOTFOUND, name);
}
else
{
// member.Type() == tvtInteger || member.Type() == tvtReal
ThrowFrom_tjs_error(Error.E_ACCESSDENYED, string.Empty);
}
}
示例2: GetOctetProperty
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
private static void GetOctetProperty(Variant result, Variant octet, Variant member
)
{
// processes properties toward octets.
if (member.IsNumber() != true)
{
string name = member.GetString();
if (name == null)
{
ThrowFrom_tjs_error(Error.E_MEMBERNOTFOUND, string.Empty);
}
if (name.Equals("length"))
{
// get string length
ByteBuffer o = octet.AsOctet();
if (o != null)
{
result.Set(o.Capacity());
}
else
{
result.Set(0);
}
return;
}
else
{
if (name[0] >= '0' && name[0] <= '9')
{
ByteBuffer o = octet.AsOctet();
int n = int.Parse(name);
int len = o != null ? o.Capacity() : 0;
if (n < 0 || n >= len)
{
throw new TJSException(Error.RangeError);
}
result.Set(o.Get(n));
return;
}
}
ThrowFrom_tjs_error(Error.E_MEMBERNOTFOUND, name);
}
else
{
// member.Type() == tvtInteger || member.Type() == tvtReal
ByteBuffer o = octet.AsOctet();
int n = member.AsInteger();
int len = o != null ? o.Capacity() : 0;
if (n < 0 || n >= len)
{
throw new TJSException(Error.RangeError);
}
result.Set(o.Get(n));
return;
}
}
示例3: GetStringProperty
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
private static void GetStringProperty(Variant result, Variant str, Variant member
)
{
// processes properties toward strings.
if (member.IsNumber() != true)
{
string name = member.GetString();
if (name == null)
{
ThrowFrom_tjs_error(Error.E_MEMBERNOTFOUND, string.Empty);
}
if (name.Equals("length"))
{
// get string length
string s = str.AsString();
if (s == null)
{
result.Set(0);
}
else
{
// tTJSVariantString::GetLength can return zero if 'this' is NULL
result.Set(s.Length);
}
return;
}
else
{
if (name[0] >= '0' && name[0] <= '9')
{
string s = str.AsString();
int n = int.Parse(name);
int len = s.Length;
if (n == len)
{
result.Set(string.Empty);
return;
}
if (n < 0 || n > len)
{
throw new TJSException(Error.RangeError);
}
result.Set(Sharpen.Runtime.Substring(s, n, n + 1));
return;
}
}
ThrowFrom_tjs_error(Error.E_MEMBERNOTFOUND, name);
}
else
{
// member.Type() == tvtInteger || member.Type() == tvtReal
string s = str.AsString();
int n = member.AsInteger();
int len = s.Length;
if (n == len)
{
result.Set(string.Empty);
return;
}
if (n < 0 || n > len)
{
throw new TJSException(Error.RangeError);
}
result.Set(Sharpen.Runtime.Substring(s, n, n + 1));
return;
}
}
示例4: DefaultIsInstanceOf
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
public static int DefaultIsInstanceOf(int flag, Variant targ, string name, Dispatch2
objthis)
{
if (targ.IsVoid())
{
return Error.S_FALSE;
}
if ("Object".Equals(name))
{
return Error.S_TRUE;
}
if (targ.IsNumber())
{
if ("Number".Equals(name))
{
return Error.S_TRUE;
}
else
{
return Error.S_FALSE;
}
}
else
{
if (targ.IsString())
{
if ("String".Equals(name))
{
return Error.S_TRUE;
}
else
{
return Error.S_FALSE;
}
}
else
{
if (targ.IsOctet())
{
if ("Octet".Equals(name))
{
return Error.S_TRUE;
}
else
{
return Error.S_FALSE;
}
}
else
{
if (targ.IsObject())
{
VariantClosure tvclosure = targ.AsObjectClosure();
if (tvclosure.mObject != null)
{
// bypass
Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
return tvclosure.mObject.IsInstanceOf(flag, null, name, disp);
}
return Error.S_FALSE;
}
}
}
}
return Error.S_FALSE;
}