internal void AddRegion(GridRegion regionInfo, int x, int y)
 {
     GridRegionCache newcache = new GridRegionCache();
     newcache.locX = x;
     newcache.locY = y;
     newcache.region = regionInfo;
     bool found = false;
     for (int i = 0; i < cache.Count; i++)
     {
         if (regionInfo != null)
         {
             if (cache[i].region == null)
             {
                 if (cache[i].locX == x && cache[i].locY == y)
                 {
                     found = true;
                     cache[i] = newcache;
                 }
             }
             else
             {
                 if (cache[i].region.RegionID == regionInfo.RegionID)
                 {
                     found = true;
                     cache[i] = newcache;
                 }
             }
         }
         else
         {
             if (cache[i].locX == x && cache[i].locY == y)
             {
                 found = true;
                 cache[i] = newcache;
             }
         }
     }
     if (!found)
         cache.Add(newcache, ExpireTime);
 }
 internal void AddRegion(GridRegion regionInfo, int x, int y)
 {
     GridRegionCache newcache = new GridRegionCache();
     newcache.LastUpdated = DateTime.UtcNow;
     newcache.locX = x;
     newcache.locY = y;
     newcache.region = regionInfo;
     bool found = false;
     for (int i = 0; i < cache.Count; i++)
     {
         if (regionInfo != null)
         {
             if (cache[i].region == null)
             {
                 if (cache[i].locX == x && cache[i].locY == y)
                 {
                     found = true;
                     TimeSpan ts = cache[i].LastUpdated - DateTime.UtcNow;
                     if (ts.Hours > 1)
                     {
                         cache[i] = newcache;
                     }
                 }
             }
             else
             {
                 if (cache[i].region.RegionID == regionInfo.RegionID)
                 {
                     found = true;
                     TimeSpan ts = cache[i].LastUpdated - DateTime.UtcNow;
                     if (ts.Hours > 1)
                     {
                         cache[i] = newcache;
                     }
                 }
             }
         }
         else
         {
             if (cache[i].locX == x && cache[i].locY == y)
             {
                 found = true;
                 TimeSpan ts = cache[i].LastUpdated - DateTime.UtcNow;
                 if (ts.Hours > 1)
                 {
                     cache[i] = newcache;
                 }
             }
         }
     }
     if (!found)
         cache.Add(newcache);
 }
 public void AddRegion(GridRegion regionInfo)
 {
     if (regionInfo == null)
         return;
     GridRegionCache newcache = new GridRegionCache();
     newcache.locX = regionInfo.RegionLocX;
     newcache.locY = regionInfo.RegionLocY;
     newcache.region = regionInfo;
     bool found = false;
     for (int i = 0; i < cache.Count; i++)
     {
         if (cache[i].region == null)
         {
             if (cache[i].locX == newcache.region.RegionLocX && cache[i].locY == newcache.region.RegionLocY)
             {
                 found = true;
                 cache[i] = newcache;
             }
         }
         else
         {
             if (cache[i].region.RegionID == regionInfo.RegionID)
             {
                 found = true;
                 cache[i] = newcache;
             }
         }
     }
     if (!found)
         cache.Add(newcache, ExpireTime);
 }
 public void AddRegion(GridRegion regionInfo)
 {
     if (regionInfo == null)
         return;
     GridRegionCache newcache = new GridRegionCache();
     newcache.LastUpdated = DateTime.UtcNow;
     newcache.locX = regionInfo.RegionLocX;
     newcache.locY = regionInfo.RegionLocY;
     newcache.region = regionInfo;
     bool found = false;
     for (int i = 0; i < cache.Count; i++)
     {
         if (cache[i].region == null)
         {
             if (cache[i].locX == newcache.region.RegionLocX && cache[i].locY == newcache.region.RegionLocY)
             {
                 found = true;
                 TimeSpan ts = cache[i].LastUpdated - DateTime.UtcNow;
                 if (ts.Hours > 1)
                 {
                     cache[i] = newcache;
                 }
             }
         }
         else
         {
             if (cache[i].region.RegionID == regionInfo.RegionID)
             {
                 found = true;
                 TimeSpan ts = cache[i].LastUpdated - DateTime.UtcNow;
                 if (ts.Hours > 1)
                 {
                     cache[i] = newcache;
                 }
             }
         }
     }
     if (!found)
         cache.Add(newcache);
 }