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


C# Variant.IsObject方法代码示例

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


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

示例1: ThrowScriptException

 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 protected internal static void ThrowScriptException(Variant val, ScriptBlock block
     , int srcpos)
 {
     string msg = null;
     if (val.IsObject())
     {
         VariantClosure clo = val.AsObjectClosure();
         if (clo.mObject != null)
         {
             Variant v2 = new Variant();
             string message_name = "message";
             int hr = clo.PropGet(0, message_name, v2, null);
             if (hr >= 0)
             {
                 msg = "script exception : " + v2.AsString();
             }
         }
     }
     if (msg == null || msg.Length == 0)
     {
         msg = "script exception";
     }
     throw new TJSScriptException(msg, block, srcpos, val);
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:26,代码来源:NativeConvertedClassBase.cs

示例2: SetPropertyDirect

 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 protected internal static void SetPropertyDirect(Variant target, int member, Variant
     param, Dispatch2 objthis, int flags)
 {
     if (target.IsObject())
     {
         VariantClosure clo = target.AsObjectClosure();
         string name = Sharpen.Extensions.ToString(member);
         int hr = clo.PropSet(flags, name, param, clo.mObjThis != null ? clo.mObjThis : objthis
             );
         if (hr < 0)
         {
             ThrowFrom_tjs_error(hr, name);
         }
     }
     else
     {
         if (target.IsString())
         {
             SetStringProperty(param, target, member);
         }
         else
         {
             if (target.IsOctet())
             {
                 SetOctetProperty(param, target, member);
             }
             else
             {
                 string mes = Error.VariantConvertErrorToObject.Replace("%1", Utils.VariantToReadableString
                     (target));
                 throw new VariantException(mes);
             }
         }
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:37,代码来源:NativeConvertedClassBase.cs

示例3: SetPropertyIndirect

 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 protected internal static void SetPropertyIndirect(Variant target, Variant member
     , Variant param, Dispatch2 objthis, int flags)
 {
     if (target.IsObject())
     {
         VariantClosure clo = target.AsObjectClosure();
         if (member.IsInteger() != true)
         {
             string str = member.AsString();
             int hr = clo.PropSet(flags, str, param, clo.mObjThis != null ? clo.mObjThis : objthis
                 );
             if (hr < 0)
             {
                 ThrowFrom_tjs_error(hr, str);
             }
         }
         else
         {
             int hr = clo.PropSetByNum(flags, member.AsInteger(), param, clo.mObjThis != null ?
                 clo.mObjThis : objthis);
             if (hr < 0)
             {
                 ThrowFrom_tjs_error_num(hr, member.AsInteger());
             }
         }
     }
     else
     {
         if (target.IsString())
         {
             SetStringProperty(param, target, member);
         }
         else
         {
             if (target.IsOctet())
             {
                 SetOctetProperty(param, target, member);
             }
             else
             {
                 string mes = Error.VariantConvertErrorToObject.Replace("%1", Utils.VariantToReadableString
                     (target));
                 throw new VariantException(mes);
             }
         }
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:49,代码来源:NativeConvertedClassBase.cs

示例4: FuncCall

 //private Callback mCallback;
 //private VariantClosure mCallbackClosure;
 // a class to receive member callback from class
 // destination object
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public override int FuncCall(int flag, string membername, Variant result, Variant
     [] param, Dispatch2 objthis)
 {
     // *param[0] = name   *param[1] = flags   *param[2] = value
     int flags = param[1].AsInteger();
     if ((flags & Interface.STATICMEMBER) == 0)
     {
         Variant val = new Variant(param[2]);
         if (val.IsObject())
         {
             // change object's objthis if the object's objthis is null
             if (val.AsObjectThis() == null)
             {
                 val.ChangeClosureObjThis(mDest);
             }
         }
         mDest.PropSet(Interface.MEMBERENSURE | Interface.IGNOREPROP | flags, param[0].AsString
             (), val, mDest);
     }
     if (result != null)
     {
         result.Set(1);
     }
     // returns true
     return Error.S_OK;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:32,代码来源:NativeClass.cs

示例5: GetPropertyDirect

 //getPropertyDirect( ra[ra_offset+ca[code+1]], ra[ra_offset+ca[code+2]], da[ca[code+3]], objthis, flags );
 // member は、固定值なので、事前に条件分岐できる、文字か数值で割り分け
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 protected internal static void GetPropertyDirect(Variant result, Variant target, 
     string member, Dispatch2 objthis, int flags)
 {
     if (target.IsObject())
     {
         VariantClosure clo = target.AsObjectClosure();
         int hr = clo.PropGet(flags, member, result, clo.mObjThis != null ? clo.mObjThis :
             objthis);
         if (hr < 0)
         {
             ThrowFrom_tjs_error(hr, member);
         }
     }
     else
     {
         if (target.IsString())
         {
             GetStringProperty(result, target, member);
         }
         else
         {
             if (target.IsOctet())
             {
                 GetOctetProperty(result, target, member);
             }
             else
             {
                 string mes = Error.VariantConvertErrorToObject.Replace("%1", Utils.VariantToReadableString
                     (target));
                 throw new VariantException(mes);
             }
         }
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:38,代码来源:NativeConvertedClassBase.cs

示例6: Callback

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual bool Callback(string name, int flags, Variant value)
 {
     if ((flags & Interface.HIDDENMEMBER) != 0)
     {
         return true;
     }
     if (mCalled)
     {
         mStream.Write(",\n");
     }
     mCalled = true;
     mStream.Write(mIndentStr);
     mStream.Write("\"");
     mStream.Write(LexBase.EscapeC(name));
     mStream.Write("\" => ");
     if (value.IsObject())
     {
         // object
         VariantClosure clo = value.AsObjectClosure();
         ArrayNI.SaveStructuredDataForObject(clo.SelectObject(), mStack, mStream, mIndentStr
             );
     }
     else
     {
         mStream.Write(Utils.VariantToExpressionString(value));
     }
     return true;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:30,代码来源:DictionaryNI.cs

示例7: VariantToReadableString

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 public static string VariantToReadableString(Variant val, int maxlen)
 {
     string ret = null;
     if (val == null || val.IsVoid())
     {
         ret = "(void)";
     }
     else
     {
         if (val.IsInteger())
         {
             ret = "(int)" + val.AsString();
         }
         else
         {
             if (val.IsReal())
             {
                 ret = "(real)" + val.AsString();
             }
             else
             {
                 if (val.IsString())
                 {
                     ret = "(string)\"" + LexBase.EscapeC(val.AsString()) + "\"";
                 }
                 else
                 {
                     if (val.IsOctet())
                     {
                         ret = "(octet)<% " + Variant.OctetToListString(val.AsOctet()) + " %>";
                     }
                     else
                     {
                         if (val.IsObject())
                         {
                             VariantClosure c = (VariantClosure)val.AsObjectClosure();
                             StringBuilder str = new StringBuilder(128);
                             str.Append("(object)");
                             str.Append('(');
                             if (c.mObject != null)
                             {
                                 str.Append('[');
                                 if (c.mObject is NativeClass)
                                 {
                                     str.Append(((NativeClass)c.mObject).GetClassName());
                                 }
                                 else
                                 {
                                     if (c.mObject is InterCodeObject)
                                     {
                                         str.Append(((InterCodeObject)c.mObject).GetName());
                                     }
                                     else
                                     {
                                         if (c.mObject is CustomObject)
                                         {
                                             string name = ((CustomObject)c.mObject).GetClassNames();
                                             if (name != null)
                                             {
                                                 str.Append(name);
                                             }
                                             else
                                             {
                                                 str.Append(c.mObject.GetType().FullName);
                                             }
                                         }
                                         else
                                         {
                                             str.Append(c.mObject.GetType().FullName);
                                         }
                                     }
                                 }
                                 str.Append(']');
                             }
                             else
                             {
                                 str.Append("0x00000000");
                             }
                             if (c.mObjThis != null)
                             {
                                 str.Append('[');
                                 if (c.mObjThis is NativeClass)
                                 {
                                     str.Append(((NativeClass)c.mObjThis).GetClassName());
                                 }
                                 else
                                 {
                                     if (c.mObjThis is InterCodeObject)
                                     {
                                         str.Append(((InterCodeObject)c.mObjThis).GetName());
                                     }
                                     else
                                     {
                                         if (c.mObjThis is CustomObject)
                                         {
                                             string name = ((CustomObject)c.mObjThis).GetClassNames();
                                             if (name != null)
                                             {
                                                 str.Append(name);
//.........这里部分代码省略.........
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:101,代码来源:Utils.cs

示例8: DefaultPropGet

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal static int DefaultPropGet(int flag, Variant targ, Variant result
     , Dispatch2 objthis)
 {
     if ((flag & Interface.IGNOREPROP) == 0)
     {
         // if IGNOREPROP is not specified
         // if member's type is tvtObject, call the object's PropGet with "member=NULL"
         //  ( default member invocation ). if it is succeeded, return its return value.
         // if the PropGet's return value is TJS_E_ACCESSDENYED,
         // return as an error, otherwise return the member itself.
         if (targ.IsObject())
         {
             VariantClosure tvclosure = targ.AsObjectClosure();
             int hr = Error.E_NOTIMPL;
             if (tvclosure.mObject != null)
             {
                 Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
                 hr = tvclosure.mObject.PropGet(0, null, result, disp);
             }
             if (hr >= 0)
             {
                 return hr;
             }
             if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
             {
                 return hr;
             }
         }
     }
     // return the member itself
     if (result == null)
     {
         return Error.E_INVALIDPARAM;
     }
     result.CopyRef(targ);
     return Error.S_OK;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:39,代码来源:CustomObject.cs

示例9: DefaultPropSet

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal static int DefaultPropSet(int flag, Variant targ, Variant param
     , Dispatch2 objthis)
 {
     if ((flag & Interface.IGNOREPROP) == 0)
     {
         if (targ.IsObject())
         {
             // roughly the same as TJSDefaultPropGet
             VariantClosure tvclosure = targ.AsObjectClosure();
             int hr = Error.E_NOTIMPL;
             if (tvclosure.mObject != null)
             {
                 Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
                 hr = tvclosure.mObject.PropSet(0, null, param, disp);
             }
             if (hr >= 0)
             {
                 return hr;
             }
             if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
             {
                 return hr;
             }
         }
     }
     // normal substitution
     if (param == null)
     {
         return Error.E_INVALIDPARAM;
     }
     targ.CopyRef(param);
     return Error.S_OK;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:35,代码来源:CustomObject.cs

示例10: DefaultIsValid

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal static int DefaultIsValid(int flag, Variant targ, Dispatch2 objthis
     )
 {
     if (targ.IsObject())
     {
         VariantClosure tvclosure = targ.AsObjectClosure();
         if (tvclosure.mObject != null)
         {
             // bypass
             Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
             return tvclosure.mObject.IsValid(flag, null, disp);
         }
     }
     // the target type is not tvtObject
     return Error.S_TRUE;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:18,代码来源:CustomObject.cs

示例11: DefaultOperation

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal static int DefaultOperation(int flag, Variant targ, Variant result
     , Variant param, Dispatch2 objthis)
 {
     int op = flag & OP_MASK;
     if (op != OP_INC && op != OP_DEC && param == null)
     {
         return Error.E_INVALIDPARAM;
     }
     if (op < OP_MIN || op > OP_MAX)
     {
         return Error.E_INVALIDPARAM;
     }
     if (targ.IsObject())
     {
         // the member may be a property handler if the member's type is "tvtObject"
         // so here try to access the object.
         int hr;
         VariantClosure tvclosure = targ.AsObjectClosure();
         if (tvclosure.mObject != null)
         {
             Dispatch2 ot = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
             Variant tmp = new Variant();
             hr = tvclosure.mObject.PropGet(0, null, tmp, ot);
             if (hr >= 0)
             {
                 DoVariantOperation(op, tmp, param);
                 hr = tvclosure.mObject.PropSet(0, null, tmp, ot);
                 if (hr < 0)
                 {
                     return hr;
                 }
                 if (result != null)
                 {
                     result.CopyRef(tmp);
                 }
                 return Error.S_OK;
             }
             else
             {
                 if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
                 {
                     return hr;
                 }
             }
         }
     }
     // normal operation is proceeded if "PropGet" is failed.
     DoVariantOperation(op, targ, param);
     if (result != null)
     {
         result.CopyRef(targ);
     }
     return Error.S_OK;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:56,代码来源:CustomObject.cs

示例12: DefaultInvalidate

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal static int DefaultInvalidate(int flag, Variant targ, Dispatch2
     objthis)
 {
     if (targ.IsObject())
     {
         VariantClosure tvclosure = targ.AsObjectClosure();
         if (tvclosure.mObject != null)
         {
             // bypass
             Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
             return tvclosure.mObject.Invalidate(flag, null, disp);
         }
     }
     return Error.S_FALSE;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:17,代码来源:CustomObject.cs

示例13: DefaultFuncCall

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal static int DefaultFuncCall(int flag, Variant targ, Variant result
     , Variant[] param, Dispatch2 objthis)
 {
     if (targ.IsObject())
     {
         int er = Error.E_INVALIDTYPE;
         VariantClosure tvclosure = targ.AsObjectClosure();
         if (tvclosure.mObject != null)
         {
             // bypass
             Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
             er = tvclosure.mObject.FuncCall(flag, null, result, param, disp);
             if (er == Error.E_INVALIDTYPE)
             {
                 // retry using PropGet
                 er = TryFuncCallViaPropGet(tvclosure, flag, result, param, objthis);
             }
         }
         return er;
     }
     return Error.E_INVALIDTYPE;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:24,代码来源:CustomObject.cs

示例14: DefaultCreateNew

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal static int DefaultCreateNew(int flag, Variant targ, Holder<Dispatch2
     > result, Variant[] param, Dispatch2 objthis)
 {
     if (targ.IsObject())
     {
         VariantClosure tvclosure = targ.AsObjectClosure();
         if (tvclosure.mObject != null)
         {
             // bypass
             Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
             return tvclosure.mObject.CreateNew(flag, null, result, param, disp);
         }
     }
     return Error.E_INVALIDTYPE;
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:17,代码来源:CustomObject.cs

示例15: TypeOfMemberDirect

 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 protected internal static void TypeOfMemberDirect(Variant result, Variant target, 
     int member, Dispatch2 objthis, int flags)
 {
     if (target.IsObject())
     {
         int hr;
         VariantClosure clo = target.AsObjectClosure();
         string name = Sharpen.Extensions.ToString(member);
         hr = clo.PropGet(flags, name, result, clo.mObjThis != null ? clo.mObjThis : objthis
             );
         if (hr == Error.S_OK)
         {
             TypeOf(result);
         }
         else
         {
             if (hr == Error.E_MEMBERNOTFOUND)
             {
                 result.Set("undefined");
             }
             else
             {
                 if (hr < 0)
                 {
                     ThrowFrom_tjs_error(hr, name);
                 }
             }
         }
     }
     else
     {
         if (target.IsString())
         {
             GetStringProperty(result, target, member);
             TypeOf(result);
         }
         else
         {
             if (target.IsOctet())
             {
                 GetOctetProperty(result, target, member);
                 TypeOf(result);
             }
             else
             {
                 string mes = Error.VariantConvertErrorToObject.Replace("%1", Utils.VariantToReadableString
                     (target));
                 throw new VariantException(mes);
             }
         }
     }
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:54,代码来源:NativeConvertedClassBase.cs


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