Exemplo n.º 1
0
        public override void CopyFrom(Stream stream)
        {
            ShapesArray from = ShapesArray.CreateFrom(stream, false);

            for (int index = 0; (long)index < ((ArrayBase <ShapeBase>)from).Length; ++index)
            {
                this[(long)index] = ((ArrayBase <ShapeBase>)from)[(long)index];
            }
        }
Exemplo n.º 2
0
 private void GetPointerAndSize(long id, out long pointer, out int size)
 {
     if (id >= this._index.Length)
     {
         pointer = -1L;
         size    = -1;
     }
     else
     {
         ShapesArray.ExtractPointerAndSize(this._index[id], out pointer, out size);
     }
 }
Exemplo n.º 3
0
        public virtual long CopyTo(Stream stream)
        {
            long position1 = stream.Position;

            stream.Write(BitConverter.GetBytes(this._index.Length), 0, 8);
            stream.Seek(stream.Position + 8L, SeekOrigin.Begin);
            long position2 = stream.Position;
            long num1      = position2 + this._index.Length * 8L;
            long pointer1  = 0;

            using (BinaryWriter stream1 = new BinaryWriter((Stream) new LimitedStream(stream, position2)))
            {
                using (BinaryWriter stream2 = new BinaryWriter((Stream) new LimitedStream(stream, num1)))
                {
                    for (int index1 = 0; (long)index1 < this._index.Length; ++index1)
                    {
                        stream2.SeekBegin(pointer1 * 4L);
                        long pointer2;
                        int  size;
                        ShapesArray.ExtractPointerAndSize(this._index[(long)index1], out pointer2, out size);
                        if (size >= 0)
                        {
                            for (int index2 = 0; index2 < size; ++index2)
                            {
                                stream2.Write(this._coordinates[pointer2 + (long)(index2 * 2)]);
                                stream2.Write(this._coordinates[pointer2 + (long)(index2 * 2) + 1L]);
                            }
                            stream1.SeekBegin((long)(index1 * 8));
                            stream1.Write(ShapesArray.BuildPointerAndSize(pointer1, size));
                            pointer1 += (long)(size * 2);
                        }
                    }
                }
            }
            stream.Seek(position1 + 8L, SeekOrigin.Begin);
            stream.Write(BitConverter.GetBytes(pointer1), 0, 8);
            long num2 = 16L + this._index.Length * 8L + pointer1 * 4L;

            stream.Seek(position1 + num2, SeekOrigin.Begin);
            return(num2);
        }
Exemplo n.º 4
0
 public static void Set(this ShapesArray index, long id, IEnumerable <ICoordinate> shape)
 {
     ((ArrayBase <ShapeBase>)index)[id] = (ShapeBase) new ShapeEnumerable(shape);
 }
Exemplo n.º 5
0
        public static ShapesArray CreateFrom(Stream stream, bool copy)
        {
            long size;

            return(ShapesArray.CreateFrom(stream, copy, out size));
        }
Exemplo n.º 6
0
 private void SetPointerAndSize(long id, long pointer, int size)
 {
     this._index[id] = ShapesArray.BuildPointerAndSize(pointer, size);
 }