Пример #1
0
            public static void LoadFromCache()
            {
                string spacePath = string.Format(@"{0}/SpaceList.json", Constants.SPACES_CACHE);

                if (System.IO.File.Exists(spacePath))
                {
                    foreach (var space in JSONTools.Load <Space[]>(spacePath))
                    {
                        if (!s_spaces.Contains(space))
                        {
                            s_spaces.Add(space);
                        }
                    }
                }
            }
Пример #2
0
        private bool TryFetchFromCache(string spaceID)
        {
            bool   success   = false;
            string spacePath = string.Format("{0}/{1}.json", Constants.SPACES_CACHE, spaceID);

            if (System.IO.File.Exists(spacePath))
            {
                try
                {
                    var cachedSpace = JSONTools.Load <Space>(spacePath);
                    Copy(cachedSpace);

                    success = true;
                }
                catch (Exception ex)
                {
                    Debug.LogError(name + " (" + id + ") [Error Loading Space from Cache] " + ex);
                }
            }

            return(success);
        }