Beispiel #1
0
    // Token: 0x0600073A RID: 1850 RVA: 0x0003A558 File Offset: 0x00038758
    private void GotPackage(IAsyncResult ar)
    {
        IPEndPoint ipendPoint = new IPEndPoint(0L, 0);

        byte[] array;
        try
        {
            array = this.m_listner.EndReceive(ar, ref ipendPoint);
        }
        catch (ObjectDisposedException)
        {
            return;
        }
        if (array.Length < 5)
        {
            return;
        }
        ZPackage zpackage = new ZPackage(array);

        if (zpackage.ReadChar() != 'F')
        {
            return;
        }
        if (zpackage.ReadChar() != 'E')
        {
            return;
        }
        if (zpackage.ReadChar() != 'J')
        {
            return;
        }
        if (zpackage.ReadChar() != 'D')
        {
            return;
        }
        int port = zpackage.ReadInt();

        this.m_lock.WaitOne();
        this.AddHost(ipendPoint.Address.ToString(), port);
        this.m_lock.ReleaseMutex();
        this.m_listner.BeginReceive(new AsyncCallback(this.GotPackage), null);
    }
Beispiel #2
0
        public static object ReadVariable(this ZPackage zp, Type t)
        {
            if (t == typeof(int))
            {
                return(zp.ReadInt());
            }
            if (t == typeof(uint))
            {
                return(zp.ReadUInt());
            }
            if (t == typeof(bool))
            {
                return(zp.ReadBool());
            }
            if (t == typeof(char))
            {
                return(zp.ReadChar());
            }
            if (t == typeof(sbyte))
            {
                return(zp.ReadSByte());
            }
            if (t == typeof(long))
            {
                return(zp.ReadLong());
            }
            if (t == typeof(ulong))
            {
                return(zp.ReadULong());
            }
            if (t == typeof(float))
            {
                return(zp.ReadSingle());
            }
            if (t == typeof(double))
            {
                return(zp.ReadDouble());
            }
            if (t == typeof(string))
            {
                return(zp.ReadString());
            }

            return(null);
        }
Beispiel #3
0
    // Token: 0x06000793 RID: 1939 RVA: 0x0003BE94 File Offset: 0x0003A094
    public void Load(ZPackage pkg, int version)
    {
        this.m_ownerRevision = pkg.ReadUInt();
        this.m_dataRevision  = pkg.ReadUInt();
        this.m_persistent    = pkg.ReadBool();
        this.m_owner         = pkg.ReadLong();
        this.m_timeCreated   = pkg.ReadLong();
        this.m_pgwVersion    = pkg.ReadInt();
        if (version >= 16 && version < 24)
        {
            pkg.ReadInt();
        }
        if (version >= 23)
        {
            this.m_type = (ZDO.ObjectType)pkg.ReadSByte();
        }
        if (version >= 22)
        {
            this.m_distant = pkg.ReadBool();
        }
        if (version < 13)
        {
            pkg.ReadChar();
            pkg.ReadChar();
        }
        if (version >= 17)
        {
            this.m_prefab = pkg.ReadInt();
        }
        this.m_sector   = pkg.ReadVector2i();
        this.m_position = pkg.ReadVector3();
        this.m_rotation = pkg.ReadQuaternion();
        int num = (int)pkg.ReadChar();

        if (num > 0)
        {
            this.InitFloats();
            for (int i = 0; i < num; i++)
            {
                int key = pkg.ReadInt();
                this.m_floats[key] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        int num2 = (int)pkg.ReadChar();

        if (num2 > 0)
        {
            this.InitVec3();
            for (int j = 0; j < num2; j++)
            {
                int key2 = pkg.ReadInt();
                this.m_vec3[key2] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        int num3 = (int)pkg.ReadChar();

        if (num3 > 0)
        {
            this.InitQuats();
            for (int k = 0; k < num3; k++)
            {
                int key3 = pkg.ReadInt();
                this.m_quats[key3] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        int num4 = (int)pkg.ReadChar();

        if (num4 > 0)
        {
            this.InitInts();
            for (int l = 0; l < num4; l++)
            {
                int key4 = pkg.ReadInt();
                this.m_ints[key4] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        int num5 = (int)pkg.ReadChar();

        if (num5 > 0)
        {
            this.InitLongs();
            for (int m = 0; m < num5; m++)
            {
                int key5 = pkg.ReadInt();
                this.m_longs[key5] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        int num6 = (int)pkg.ReadChar();

        if (num6 > 0)
        {
            this.InitStrings();
            for (int n = 0; n < num6; n++)
            {
                int key6 = pkg.ReadInt();
                this.m_strings[key6] = pkg.ReadString();
            }
        }
        else
        {
            this.ReleaseStrings();
        }
        if (version < 17)
        {
            this.m_prefab = this.GetInt("prefab", 0);
        }
    }
Beispiel #4
0
    public void Load(ZPackage pkg, int version)
    {
        this.m_ownerRevision = pkg.ReadUInt();
        this.m_dataRevision  = pkg.ReadUInt();
        this.m_persistent    = pkg.ReadBool();
        this.m_owner         = pkg.ReadLong();
        this.m_timeCreated   = pkg.ReadLong();
        this.m_pgwVersion    = pkg.ReadInt();
        if (version >= 16 && version < 24)
        {
            pkg.ReadInt();
        }
        if (version >= 23)
        {
            this.m_type = (ZDO.ObjectType)pkg.ReadSByte();
        }
        if (version >= 22)
        {
            this.m_distant = pkg.ReadBool();
        }
        if (version < 13)
        {
            int num1 = (int)pkg.ReadChar();
            int num2 = (int)pkg.ReadChar();
        }
        if (version >= 17)
        {
            this.m_prefab = pkg.ReadInt();
        }
        this.m_sector   = pkg.ReadVector2i();
        this.m_position = pkg.ReadVector3();
        this.m_rotation = pkg.ReadQuaternion();
        int num3 = (int)pkg.ReadChar();

        if (num3 > 0)
        {
            this.InitFloats();
            for (int index = 0; index < num3; ++index)
            {
                this.m_floats[pkg.ReadInt()] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        int num4 = (int)pkg.ReadChar();

        if (num4 > 0)
        {
            this.InitVec3();
            for (int index = 0; index < num4; ++index)
            {
                this.m_vec3[pkg.ReadInt()] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        int num5 = (int)pkg.ReadChar();

        if (num5 > 0)
        {
            this.InitQuats();
            for (int index = 0; index < num5; ++index)
            {
                this.m_quats[pkg.ReadInt()] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        int num6 = (int)pkg.ReadChar();

        if (num6 > 0)
        {
            this.InitInts();
            for (int index = 0; index < num6; ++index)
            {
                this.m_ints[pkg.ReadInt()] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        int num7 = (int)pkg.ReadChar();

        if (num7 > 0)
        {
            this.InitLongs();
            for (int index = 0; index < num7; ++index)
            {
                this.m_longs[pkg.ReadInt()] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        int num8 = (int)pkg.ReadChar();

        if (num8 > 0)
        {
            this.InitStrings();
            for (int index = 0; index < num8; ++index)
            {
                this.m_strings[pkg.ReadInt()] = pkg.ReadString();
            }
        }
        else
        {
            this.ReleaseStrings();
        }
        if (version >= 17)
        {
            return;
        }
        this.m_prefab = this.GetInt("prefab", 0);
    }