当前位置: 首页>>代码示例>>C#>>正文


C# Variant.GetString方法代码示例

本文整理汇总了C#中Kirikiri.Tjs2.Variant.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.GetString方法的具体用法?C# Variant.GetString怎么用?C# Variant.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kirikiri.Tjs2.Variant的用法示例。


在下文中一共展示了Variant.GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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;
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:69,代码来源:NativeConvertedClassBase.cs

示例2: 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);
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:32,代码来源:NativeConvertedClassBase.cs

示例3: 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;
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:58,代码来源:NativeConvertedClassBase.cs


注:本文中的Kirikiri.Tjs2.Variant.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。