Пример #1
0
        public OPLPacket(ObjectPropertyList list) : base(0xD6)
        {
            EnsureCapacity(128);

            Write((short)1);
            Write((int)list.Serial);
            Write((short)0);
            Write((int)list.GetHash());

            ArrayList props = list.GetProps();

            for (int i = 0; i < props.Count; i++)
            {
                ObjectProperty prop = (ObjectProperty)props[i];
                Write((int)prop.Number);

                if (prop.Args.Length > 0)
                {
                    byte[] buff = Encoding.Unicode.GetBytes(prop.Args);
                    Write((short)buff.Length);
                    Write(buff, 0, buff.Length);
                }
                else
                {
                    Write((short)0);
                }
            }

            Write((int)0);
        }
Пример #2
0
        public OPLPacket( ObjectPropertyList list )
            : base(0xD6)
        {
            EnsureCapacity( 128 );

            Write( (short) 1 );
            Write( (int) list.Serial );
            Write( (short) 0 );
            Write( (int) list.GetHash() );

            ArrayList props = list.GetProps();
            for(int i=0;i<props.Count;i++)
            {
                ObjectProperty prop = (ObjectProperty)props[i];
                Write( (int) prop.Number );

                if ( prop.Args.Length > 0 )
                {
                    byte[] buff = Encoding.Unicode.GetBytes( prop.Args );
                    Write( (short) buff.Length );
                    Write( buff, 0, buff.Length );
                }
                else
                {
                    Write( (short) 0 );
                }
            }

            Write( (int) 0 );
        }