示例#1
0
        private FREObject RunExtensibleTests(FREContext ctx, uint argc, FREObject[] argv)
        {
            Trace("***********Start Extensible test***********");
            var rectangle = argv[0].AsRect();

            rectangle.Width  = 999;
            rectangle.Height = 111;

            var point   = new Point(10, 88);
            var unused  = new FrePointSharp(point);
            var unused1 = unused.AsPoint();

            return(rectangle.ToFREObject());
        }
示例#2
0
        private FREObject RunExtensibleTests(FREContext ctx, uint argc, FREObject[] argv)
        {
            Trace("***********Start Extensible test***********");
            var rectangle = argv[0].AsRect();

            rectangle.Width  = 999;
            rectangle.Height = 111;

            var point       = new Point(10, 88);
            var frePoint    = new FrePointSharp(point);
            var targetPoint = new FrePointSharp(new Point(100, 444));

            frePoint.CopyFrom(targetPoint);
            return(rectangle.ToFREObject());
        }
示例#3
0
 /// <summary>
 /// Converts a FrePointSharp to a C# Point
 /// </summary>
 /// <param name="inFre"></param>
 /// <returns></returns>
 public static Point AsPoint(this FrePointSharp inFre) => inFre.Value;
示例#4
0
        /// <summary>
        /// Returns the FREArray as a C# ArrayList.
        /// </summary>
        /// <returns></returns>
        public ArrayList AsArrayList()
        {
            var al  = new ArrayList();
            var len = Length;

            if (len <= 0)
            {
                return(al);
            }
            for (uint i = 0; i < len; i++)
            {
                var itm  = At(i);
                var type = itm.Type();
                switch (type)
                {
                case FreObjectTypeSharp.String:
                    al.Add(FreSharpHelper.GetAsString(itm));
                    break;

                case FreObjectTypeSharp.Bytearray:
                    var ba = new FreByteArraySharp(itm);
                    ba.Acquire();
                    var baTarget = new byte[ba.Length];
                    ba.Bytes.CopyTo(baTarget, 0);
                    al.Add(baTarget);
                    ba.Release();
                    break;

                case FreObjectTypeSharp.Array:
                case FreObjectTypeSharp.Vector:
                    var arrFre = new FREArray(itm);
                    al.Add(arrFre.AsArrayList());
                    break;

                case FreObjectTypeSharp.Bitmapdata:
                    var bmdFre = new FreBitmapDataSharp(itm);
                    al.Add(bmdFre.AsBitmap());
                    break;

                case FreObjectTypeSharp.Boolean:
                    al.Add(FreSharpHelper.GetAsBool(itm));
                    break;

                case FreObjectTypeSharp.Null:
                    break;

                case FreObjectTypeSharp.Int:
                    al.Add(FreSharpHelper.GetAsInt(itm));
                    break;

                case FreObjectTypeSharp.Object:
                case FreObjectTypeSharp.Class:
                    al.Add(FreSharpHelper.GetAsDictionary(itm));
                    break;

                case FreObjectTypeSharp.Number:
                    al.Add(FreSharpHelper.GetAsDouble(itm));
                    break;

                case FreObjectTypeSharp.Rectangle:
                    var rectFre = new FreRectangleSharp(itm);
                    al.Add(rectFre.Value);
                    break;

                case FreObjectTypeSharp.Point:
                    var pointFre = new FrePointSharp(itm);
                    al.Add(pointFre.Value);
                    break;

                case FreObjectTypeSharp.Date:
                    al.Add(FreSharpHelper.GetAsDateTime(itm));
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(al);
        }