コード例 #1
0
        public static void SetValue(this CorValRef thisVal, EvaluationContext ctx, CorValRef val)
        {
            CorEvaluationContext cctx = (CorEvaluationContext)ctx;
            CorObjectAdaptor     actx = (CorObjectAdaptor)ctx.Adapter;

            if (actx.IsEnum(ctx, thisVal.Val.ExactType) && !actx.IsEnum(ctx, val.Val.ExactType))
            {
                ValueReference vr = actx.GetMember(ctx, null, thisVal, "value__");
                vr.Value = val;
                // Required to make sure that var returns an up-to-date value object
                thisVal.IsValid = false;
                return;
            }

            CorReferenceValue s = thisVal.Val.CastToReferenceValue();

            if (s != null)
            {
                CorReferenceValue v = val.Val.CastToReferenceValue();
                if (v != null)
                {
                    s.Value = v.Value;
                    return;
                }
            }
            CorGenericValue gv = CorObjectAdaptor.GetRealObject(cctx, thisVal.Val) as CorGenericValue;

            if (gv != null)
            {
                gv.SetValue(ctx.Adapter.TargetObjectToObject(ctx, val));
            }
        }
コード例 #2
0
        public CorDebuggerSession( )
        {
            documents = new Dictionary <string, DocInfo> (StringComparer.CurrentCultureIgnoreCase);
            modules   = new Dictionary <string, ModuleInfo> (StringComparer.CurrentCultureIgnoreCase);

            ObjectAdapter = new CorObjectAdaptor();
        }
コード例 #3
0
        public object GetElement(int[] indices)
        {
            return(new CorValRef(delegate {
                // If we have a zombie state array, reload it.
                if (!obj.IsValid)
                {
                    obj.Reload();
                    array = CorObjectAdaptor.GetRealObject(ctx, obj) as CorArrayValue;
                }

                return array != null ? array.GetElement(indices) : null;
            }));
        }
コード例 #4
0
        public override IStringAdaptor CreateStringAdaptor(EvaluationContext ctx, object str)
        {
            CorValue val = CorObjectAdaptor.GetRealObject(ctx, str);

            if (val is CorStringValue)
            {
                return(new StringAdaptor(ctx, (CorValRef)str, (CorStringValue)val));
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
        public override ICollectionAdaptor CreateArrayAdaptor(EvaluationContext ctx, object arr)
        {
            CorValue val = CorObjectAdaptor.GetRealObject(ctx, arr);

            if (val is CorArrayValue)
            {
                return(new ArrayAdaptor(ctx, (CorValRef)arr, (CorArrayValue)val));
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
        public int[] GetDimensions()
        {
            CorArrayValue array = CorObjectAdaptor.GetRealObject(ctx, obj) as CorArrayValue;

            if (array != null)
            {
                return(array.GetDimensions());
            }
            else
            {
                return(new int[0]);
            }
        }
コード例 #7
0
        public ObjectValue CreateElementValue(ArrayElementGroup grp, ObjectPath path, int[] indices)
        {
            CorArrayValue array = CorObjectAdaptor.GetRealObject(ctx, obj) as CorArrayValue;

            if (array != null)
            {
                CorValRef elem = (CorValRef)GetElement(indices);
                return(ctx.Adapter.CreateObjectValue(ctx, grp, path, elem, ObjectValueFlags.ArrayElement));
            }
            else
            {
                return(ObjectValue.CreateUnknown("?"));
            }
        }
コード例 #8
0
 public object GetElement(int[] indices)
 {
     return(new CorValRef(delegate {
         CorArrayValue array = CorObjectAdaptor.GetRealObject(ctx, obj) as CorArrayValue;
         if (array != null)
         {
             return array.GetElement(indices);
         }
         else
         {
             return null;
         }
     }));
 }
コード例 #9
0
        CorValRef Box(CorEvaluationContext ctx, CorValRef val)
        {
            CorValRef arr = new CorValRef(delegate {
                return(ctx.Session.NewArray(ctx, (CorType)GetValueType(ctx, val), 1));
            });
            CorArrayValue array = CorObjectAdaptor.GetRealObject(ctx, arr) as CorArrayValue;

            ArrayAdaptor realArr = new ArrayAdaptor(ctx, arr, array);

            realArr.SetElement(new int[] { 0 }, val);

            CorType at = (CorType)GetType(ctx, "System.Array");

            object[] argTypes = new object[] { GetType(ctx, "System.Int32") };
            return((CorValRef)RuntimeInvoke(ctx, at, arr, "GetValue", argTypes, new object[] { CreateValue(ctx, 0) }));
        }