Esempio n. 1
0
        /// <summary>
        /// Loads the statistics from local storage.
        /// </summary>
        public void Load()
        {
            try
            {
                SuccessfulGenerations = _persistenceLayer.HasKey(ConduitSuccessfulGenerationsKey)
                    ? _persistenceLayer.GetInt(ConduitSuccessfulGenerationsKey)
                    : 0;

                if (_persistenceLayer.HasKey(ConduitSignatureFrequencyKey))
                {
                    var json = _persistenceLayer.GetString(ConduitSignatureFrequencyKey);
                    SignatureFrequency = JsonMapper.ToObject <Dictionary <string, int> >(json);
                }
                else
                {
                    SignatureFrequency = new Dictionary <string, int>();
                }

                if (_persistenceLayer.HasKey(ConduitIncompatibleSignatureFrequencyKey))
                {
                    var json = _persistenceLayer.GetString(ConduitIncompatibleSignatureFrequencyKey);
                    IncompatibleSignatureFrequency = JsonMapper.ToObject <Dictionary <string, int> >(json);
                }
                else
                {
                    IncompatibleSignatureFrequency = new Dictionary <string, int>();
                }
            }
            catch (Exception e)
            {
                Debug.LogError($"Failed to load Conduit statistics. {e}");
            }
        }