Example #1
0
        public void LoadData()
        {
            try
            {
                ReadOperation <string> operation = IOFactory.GetReadTextOperation(_pathToSaveFile);
                operation.DoOperationSync();
                string result = operation.GetResult();
                _data = JsonUtility.FromJson <DataContainer>(result);

                for (int i = _data.data.Count - 1; i >= 0; i--)
                {
                    DataElement element = _data.data[i];
                    if (string.IsNullOrEmpty(element.guid) == false)
                    {
                        _cacheData.Add(element.guid, i);
                    }
                    else
                    {
                        _data.data.RemoveAt(i);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.Log("Error at LoadData : " + e.Message);
                throw;
            }
        }
Example #2
0
        public void LoadMetadata()
        {
            try
            {
                ReadOperation <string> operation = IOFactory.GetReadTextOperation(_pathToMetadata);
                operation.DoOperationSync();
                string result = operation.GetResult();
                _metadata = JsonUtility.FromJson <MetadataContainer>(result);

                for (int i = 0; i < _metadata.metadata.Count; i++)
                {
                    MetadataElement element = _metadata.metadata[i];
                    _cacheMetadata.Add(element.key, i);
                }
            }
            catch (Exception e)
            {
                Debug.Log("Error at LoadMetadata : " + e.Message);
                throw;
            }
        }