예제 #1
0
        private void LoadCacheSegmentConfig()
        {
            string text = _storePath + SegmentConfigCacheFilePath;

            if (!File.Exists(text))
            {
                _cachedSegmentConfig = _clientDefaultConfig;
            }
            else
            {
                try
                {
                    using (StreamReader streamReader = new StreamReader(text))
                    {
                        string json = streamReader.ReadToEnd();
                        _cachedSegmentConfig = SegmentConfig.fromJsonDictionary(json);
                    }
                }
                catch (Exception ex)
                {
                    _cachedSegmentConfig = _clientDefaultConfig;
                    UnityEngine.Debug.LogError("autotune error processing cached config file: " + text + " , error: " + ex);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Loads from file.
        /// On failure this defaults to use client default setting.
        /// </summary>
        private void LoadCacheSegmentConfig()
        {
            var filePath = _storePath + SegmentConfigCacheFilePath;

            if (!File.Exists(filePath))
            {
                _cachedSegmentConfig = _clientDefaultConfig;
                Debug.Log("autotune did not find cached config in path: " + filePath);
                return;
            }

            try {
                using (var reader = new StreamReader(filePath)) {
                    var json = reader.ReadToEnd();
                    _cachedSegmentConfig = SegmentConfig.fromJsonDictionary(json);
                    Debug.Log("autotune loaded cached config: " + json);
                }
            }
            catch (Exception ex) {
                // for any issues with the file, use client defaults
                _cachedSegmentConfig = _clientDefaultConfig;
                Debug.LogError("autotune error processing cached config file: " + filePath + " , error: " + ex);
            }
        }