public static ConversionMap FromHashCollection(LeagueHashCollection col)
        {
            var result  = new ConversionMap();
            var mapping = new Dictionary <string, Dictionary <string, uint> >();

            foreach (var entry in col.Hashes)
            {
                var hash    = entry.Key;
                var section = entry.Value.First();
                var name    = section.Value.First();
                if (!mapping.ContainsKey(section.Key))
                {
                    mapping[section.Key] = new Dictionary <string, uint>();
                }
                mapping[section.Key].Add(name, hash);
            }

            foreach (var kvp in mapping)
            {
                foreach (var entry in kvp.Value)
                {
                    var key  = new InibinKey(kvp.Key, entry.Key);
                    var hash = entry.Value;
                    result.Add(key, hash);
                }
            }
            return(result);
        }
        public void AddByKey(InibinKey key, InibinValue value)
        {
            var hash = _conversionMap.GetHash(key);

            _hashToValue.Add(hash, value);
            _keyToValue.Add(key, value);
        }
 public uint GetHash(InibinKey key)
 {
     if (!_keyToHash.ContainsKey(key))
     {
         throw new NotSupportedException();
     }
     return(_keyToHash[key]);
 }
 public InibinKey GetKey(uint hash)
 {
     if (!_hashToKey.ContainsKey(hash))
     {
         var key = new InibinKey("UNKNOWN_HASHES", hash.ToString());
         _keyToHash.Add(key, hash);
         _hashToKey.Add(hash, key);
     }
     return(_hashToKey[hash]);
 }
        public static ConversionMap Load(string path)
        {
            var result = new ConversionMap();
            var map    = JsonConvert.DeserializeObject <Dictionary <string, Dictionary <string, uint> > >(File.ReadAllText(path));

            foreach (var kvp in map)
            {
                foreach (var entry in kvp.Value)
                {
                    var key  = new InibinKey(kvp.Key, entry.Key);
                    var hash = entry.Value;
                    result.Add(key, hash);
                }
            }
            return(result);
        }
 private void Add(InibinKey key, uint hash)
 {
     _keyToHash.Add(key, hash);
     _hashToKey.Add(hash, key);
 }