Beispiel #1
0
    // Token: 0x060007D0 RID: 2000 RVA: 0x0003D640 File Offset: 0x0003B840
    private void HandleDestroyedZDO(ZDOID uid)
    {
        if (uid.userID == this.m_myid && uid.id >= this.m_nextUid)
        {
            this.m_nextUid = uid.id + 1U;
        }
        ZDO zdo = this.GetZDO(uid);

        if (zdo == null)
        {
            return;
        }
        if (this.m_onZDODestroyed != null)
        {
            this.m_onZDODestroyed(zdo);
        }
        this.RemoveFromSector(zdo, zdo.GetSector());
        this.m_objectsByID.Remove(zdo.m_uid);
        ZDOPool.Release(zdo);
        foreach (ZDOMan.ZDOPeer zdopeer in this.m_peers)
        {
            zdopeer.m_zdos.Remove(uid);
        }
        if (ZNet.instance.IsServer())
        {
            long ticks = ZNet.instance.GetTime().Ticks;
            this.m_deadZDOs[uid] = ticks;
        }
    }
Beispiel #2
0
 // Token: 0x060007F6 RID: 2038 RVA: 0x0003EA48 File Offset: 0x0003CC48
 public static void Release(Dictionary <ZDOID, ZDO> objects)
 {
     foreach (ZDO zdo in objects.Values)
     {
         ZDOPool.Release(zdo);
     }
 }
Beispiel #3
0
    // Token: 0x060007B9 RID: 1977 RVA: 0x0003CB88 File Offset: 0x0003AD88
    public void Load(BinaryReader reader, int version)
    {
        reader.ReadInt64();
        uint num  = reader.ReadUInt32();
        int  num2 = reader.ReadInt32();

        ZDOPool.Release(this.m_objectsByID);
        this.m_objectsByID.Clear();
        this.ResetSectorArray();
        ZLog.Log(string.Concat(new object[]
        {
            "Loading ",
            num2,
            " zdos , my id ",
            this.m_myid,
            " data version:",
            version
        }));
        ZPackage zpackage = new ZPackage();

        for (int i = 0; i < num2; i++)
        {
            ZDO zdo = ZDOPool.Create(this);
            zdo.m_uid = new ZDOID(reader);
            int    count = reader.ReadInt32();
            byte[] data  = reader.ReadBytes(count);
            zpackage.Load(data);
            zdo.Load(zpackage, version);
            zdo.SetOwner(0L);
            this.m_objectsByID.Add(zdo.m_uid, zdo);
            this.AddToSector(zdo, zdo.GetSector());
            if (zdo.m_uid.userID == this.m_myid && zdo.m_uid.id >= num)
            {
                num = zdo.m_uid.id + 1U;
            }
        }
        this.m_deadZDOs.Clear();
        int num3 = reader.ReadInt32();

        for (int j = 0; j < num3; j++)
        {
            ZDOID key   = new ZDOID(reader.ReadInt64(), reader.ReadUInt32());
            long  value = reader.ReadInt64();
            this.m_deadZDOs.Add(key, value);
            if (key.userID == this.m_myid && key.id >= num)
            {
                num = key.id + 1U;
            }
        }
        this.CapDeadZDOList();
        ZLog.Log("Loaded " + this.m_deadZDOs.Count + " dead zdos");
        this.RemoveOldGeneratedZDOS();
        this.m_nextUid = num;
    }
Beispiel #4
0
 // Token: 0x060007B6 RID: 1974 RVA: 0x0003C8F4 File Offset: 0x0003AAF4
 public void ShutDown()
 {
     if (!ZNet.instance.IsServer())
     {
         this.FlushClientObjects();
     }
     ZDOPool.Release(this.m_objectsByID);
     this.m_objectsByID.Clear();
     this.m_tempToSync.Clear();
     this.m_tempToSyncDistant.Clear();
     this.m_tempNearObjects.Clear();
     this.m_tempRemoveList.Clear();
     this.m_peers.Clear();
     this.ResetSectorArray();
     GC.Collect();
 }
Beispiel #5
0
    // Token: 0x060007BA RID: 1978 RVA: 0x0003CD68 File Offset: 0x0003AF68
    private void RemoveOldGeneratedZDOS()
    {
        List <ZDOID> list = new List <ZDOID>();

        foreach (KeyValuePair <ZDOID, ZDO> keyValuePair in this.m_objectsByID)
        {
            int pgwversion = keyValuePair.Value.GetPGWVersion();
            if (pgwversion != 0 && pgwversion != ZoneSystem.instance.m_pgwVersion)
            {
                list.Add(keyValuePair.Key);
                this.RemoveFromSector(keyValuePair.Value, keyValuePair.Value.GetSector());
                ZDOPool.Release(keyValuePair.Value);
            }
        }
        foreach (ZDOID key in list)
        {
            this.m_objectsByID.Remove(key);
        }
        ZLog.Log("Removed " + list.Count + " OLD generated ZDOS");
    }