예제 #1
0
        /// <exception cref="VariantException"></exception>
        /// <exception cref="TjsException"></exception>
        public virtual void Assign(Dispatch2 dsp)
        {
            // copy members from "dsp" to "Owner"
            // determin dsp's object type
            //Holder<ArrayNI> arrayni = new Holder<ArrayNI>(null);
            ArrayNI array = (ArrayNI)dsp.GetNativeInstance(ArrayClass.ClassID);

            if (array != null)
            {
                // copy from array
                mItems.Clear();
                int count = array.mItems.Count;
                for (int i = 0; i < count; i++)
                {
                    mItems.AddItem(new Variant(array.mItems[i]));
                }
            }
            else
            {
                //mItems.addAll( array.mItems );
                // convert from dictionary or others
                mItems.Clear();
                ArrayNI.DictionaryEnumCallback callback = new ArrayNI.DictionaryEnumCallback(mItems
                                                                                             );
                dsp.EnumMembers(Interface.IGNOREPROP, callback, dsp);
            }
        }
예제 #2
0
 /// <exception cref="VariantException"></exception>
 /// <exception cref="TjsException"></exception>
 public virtual void AssignStructure(Dispatch2 dsp, AList <Dispatch2> stack)
 {
     // assign structured data from dsp
     //ArrayNI dicni = null;
     if (dsp.GetNativeInstance(DictionaryClass.ClassID) != null)
     {
         // copy from dictionary
         stack.AddItem(dsp);
         try
         {
             CustomObject owner = mOwner.Get();
             owner.Clear();
             DictionaryNI.AssignStructCallback callback = new DictionaryNI.AssignStructCallback
                                                              (stack, owner);
             dsp.EnumMembers(Interface.IGNOREPROP, callback, dsp);
         }
         finally
         {
             stack.Remove(stack.Count - 1);
         }
     }
     else
     {
         throw new TjsException(Error.SpecifyDicOrArray);
     }
 }
예제 #3
0
 /// <exception cref="VariantException"></exception>
 /// <exception cref="TjsException"></exception>
 public virtual int EnumMembers(int flags, EnumMembersCallback callback, Dispatch2
                                objthis)
 {
     if (mObject == null)
     {
         throw new TjsException(Error.NullAccess);
     }
     return(mObject.EnumMembers(flags, callback, mObjThis != null ? mObjThis : (objthis
                                                                                != null ? objthis : mObject)));
 }
예제 #4
0
        /// <exception cref="VariantException"></exception>
        /// <exception cref="TjsException"></exception>
        public virtual void Assign(Dispatch2 dsp, bool clear)
        {
            // copy members from "dsp" to "Owner"
            // determin dsp's object type
            ArrayNI      arrayni = null;
            CustomObject owner   = mOwner.Get();

            if (dsp != null && (arrayni = (ArrayNI)dsp.GetNativeInstance(ArrayClass.ClassID))
                != null)
            {
                // convert from array
                if (clear)
                {
                    owner.Clear();
                }
                int count = arrayni.mItems.Count;
                for (int i = 0; i < count; i++)
                {
                    Variant v    = arrayni.mItems[i];
                    string  name = v.AsString();
                    i++;
                    if (i >= count)
                    {
                        break;
                    }
                    Variant v2 = arrayni.mItems[i];
                    owner.PropSet(Interface.MEMBERENSURE | Interface.IGNOREPROP, name, v2, owner);
                }
            }
            else
            {
                // otherwise
                if (clear)
                {
                    owner.Clear();
                }
                DictionaryNI.AssignCallback callback = new DictionaryNI.AssignCallback(owner);
                dsp.EnumMembers(Interface.IGNOREPROP, callback, dsp);
            }
        }
예제 #5
0
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual void Assign(Dispatch2 dsp, bool clear)
 {
     // copy members from "dsp" to "Owner"
     // determin dsp's object type
     ArrayNI arrayni = null;
     CustomObject owner = mOwner.Get();
     if (dsp != null && (arrayni = (ArrayNI)dsp.GetNativeInstance(ArrayClass.ClassID))
          != null)
     {
         // convert from array
         if (clear)
         {
             owner.Clear();
         }
         int count = arrayni.mItems.Count;
         for (int i = 0; i < count; i++)
         {
             Variant v = arrayni.mItems[i];
             string name = v.AsString();
             i++;
             if (i >= count)
             {
                 break;
             }
             Variant v2 = arrayni.mItems[i];
             owner.PropSet(Interface.MEMBERENSURE | Interface.IGNOREPROP, name, v2, owner);
         }
     }
     else
     {
         // otherwise
         if (clear)
         {
             owner.Clear();
         }
         DictionaryNI.AssignCallback callback = new DictionaryNI.AssignCallback(owner);
         dsp.EnumMembers(Interface.IGNOREPROP, callback, dsp);
     }
 }
예제 #6
0
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual void Assign(Dispatch2 dsp)
 {
     // copy members from "dsp" to "Owner"
     // determin dsp's object type
     //Holder<ArrayNI> arrayni = new Holder<ArrayNI>(null);
     ArrayNI array = (ArrayNI)dsp.GetNativeInstance(ArrayClass.ClassID);
     if (array != null)
     {
         // copy from array
         mItems.Clear();
         int count = array.mItems.Count;
         for (int i = 0; i < count; i++)
         {
             mItems.AddItem(new Variant(array.mItems[i]));
         }
     }
     else
     {
         //mItems.addAll( array.mItems );
         // convert from dictionary or others
         mItems.Clear();
         ArrayNI.DictionaryEnumCallback callback = new ArrayNI.DictionaryEnumCallback(mItems
             );
         dsp.EnumMembers(Interface.IGNOREPROP, callback, dsp);
     }
 }
예제 #7
0
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual void AssignStructure(Dispatch2 dsp, AList<Dispatch2> stack)
 {
     // assign structured data from dsp
     //ArrayNI dicni = null;
     if (dsp.GetNativeInstance(DictionaryClass.ClassID) != null)
     {
         // copy from dictionary
         stack.AddItem(dsp);
         try
         {
             CustomObject owner = mOwner.Get();
             owner.Clear();
             DictionaryNI.AssignStructCallback callback = new DictionaryNI.AssignStructCallback
                 (stack, owner);
             dsp.EnumMembers(Interface.IGNOREPROP, callback, dsp);
         }
         finally
         {
             stack.Remove(stack.Count - 1);
         }
     }
     else
     {
         throw new TJSException(Error.SpecifyDicOrArray);
     }
 }