示例#1
0
        public void CreateAndDispose()
        {
            using (var physics = CreatePhysicsAndScene())
            {
                var agg = physics.Physics.CreateAggregate(100, true);

                agg.Dispose();

                Assert.IsFalse(ObjectTable.Contains(agg));
            }
        }
示例#2
0
        public void CreateAndDisposeParticleSystemInstance()
        {
            using (var physics = CreatePhysicsAndScene())
            {
                ParticleSystem particleSystem;
                using (particleSystem = physics.Physics.CreateParticleSystem(100))
                {
                    GC.Collect();

                    Assert.IsFalse(particleSystem.Disposed);
                    Assert.IsTrue(ObjectTable.Contains(particleSystem));
                }

                Assert.IsTrue(particleSystem.Disposed);
            }
        }
示例#3
0
        public void CreateAndDisposeParticleFluid()
        {
            using (var physics = CreatePhysicsAndScene())
            {
                ParticleSystem particleSystem = physics.Physics.CreateParticleSystem(100);

                ParticleFluid fluid = physics.Physics.CreateParticleFluid(100);

                Assert.IsTrue(ObjectTable.Contains(fluid));

                Assert.IsFalse(fluid.Disposed);

                fluid.Dispose();

                Assert.IsTrue(fluid.Disposed);
            }
        }
示例#4
0
        public List <PageItem> Process(int Flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;
            MemoryStream _fs = null;
            BinaryReader _fr = null;

            try
            {
                _fs = new MemoryStream(BitConverter.GetBytes(Flags));
                _fr = new BinaryReader(_fs);
                //Byte 1 will be ObjectID - a font in the object table
                byte ObjectID = _fr.ReadByte();
                //Byte 2 is the real flags
                byte RealFlags = _fr.ReadByte();
                // 0 1 2 3 4 5 6 7
                // X X X X X X X S
                // if S = type of brush - if S then ARGB, else a brush object in object table

                _ms = new MemoryStream(RecordData);
                _br = new BinaryReader(_ms);
                bool  BrushIsARGB = ((RealFlags & (int)Math.Pow(2, 7)) == (int)Math.Pow(2, 7));
                Brush b;
                if (BrushIsARGB)
                {
                    byte A, R, G, B;
                    B = _br.ReadByte();
                    G = _br.ReadByte();
                    R = _br.ReadByte();
                    A = _br.ReadByte();
                    b = new SolidBrush(Color.FromArgb(A, R, G, B));
                }
                else
                {
                    UInt32   BrushID = _br.ReadUInt32();
                    EMFBrush EMFb    = (EMFBrush)ObjectTable[(byte)BrushID];
                    b = EMFb.myBrush;
                }

                UInt32 FormatID     = _br.ReadUInt32(); // Index of Optional stringFormatobject in Object Table...
                UInt32 StringLength = _br.ReadUInt32();
                //bounding of string...
                Single recX      = _br.ReadSingle();
                Single recY      = _br.ReadSingle();
                Single recWidth  = _br.ReadSingle();
                Single recHeight = _br.ReadSingle();
                //Array of Chars...
                char[] StringData             = new char[StringLength];
                System.Text.UnicodeEncoding d = new System.Text.UnicodeEncoding();
                d.GetChars(_br.ReadBytes((int)StringLength * 2), 0, (int)StringLength * 2, StringData, 0);
                EMFFont      EF = (EMFFont)ObjectTable[(byte)ObjectID];
                Font         f  = EF.myFont;
                StringFormat sf;
                if (ObjectTable.Contains((byte)FormatID))
                {
                    EMFStringFormat ESF = (EMFStringFormat)ObjectTable[(byte)FormatID];
                    sf = ESF.myStringFormat;
                }
                else
                {
                    sf = new StringFormat();
                }

                DoInstructions(f, sf, b, recX, recY, recWidth, recHeight, new String(StringData));
                return(items);
            }
            finally
            {
                if (_br != null)
                {
                    _br.Close();
                }
                if (_ms != null)
                {
                    _ms.Dispose();
                }
                if (_fr != null)
                {
                    _fr.Close();
                }
                if (_fs != null)
                {
                    _fs.Dispose();
                }
            }
        }
 /// <summary>
 /// Returns true if the tags with the given id are in this collection.
 /// </summary>
 /// <param name="tagsId"></param>
 /// <returns></returns>
 public bool Contains(uint tagsId)
 {
     return(_tagsCollectionTable.Contains(tagsId));
 }