AcTools.DataAnalyzer.HashStorage.Add C# (CSharp) Метод

Add() публичный Метод

public Add ( string carId, string rulesSetId, string hashValue ) : void
carId string
rulesSetId string
hashValue string
Результат void
        public void Add(string carId, string rulesSetId, string hashValue) {
            if (!_dictionary.ContainsKey(rulesSetId)) {
                _dictionary[rulesSetId] = new Dictionary<string, string>();
            }

            _dictionary[rulesSetId][carId] = hashValue;
        }

Usage Example

Пример #1
0
        private HashStorage CreateNew([NotNull] RulesEntry[] rulesSet, string[] carIds)
        {
            var hashStorage = new HashStorage(_rulesKeys);

            foreach (var car in carIds)
            {
                var carLocation = FileUtils.GetCarDirectory(_acRoot, car);
                if (!Directory.Exists(carLocation))
                {
                    continue;
                }

                var carData = DataWrapper.FromCarDirectory(carLocation);
                var bytes   = new byte[rulesSet.Length][];
                for (var i = 0; i < rulesSet.Length; i++)
                {
                    var set = rulesSet[i];
                    bytes[i] = set.Rules.GetHash(carData);
                }

                hashStorage.Add(car, bytes);
            }

            hashStorage.ParamsHashCode = _paramsHashCode;
            hashStorage.SaveTo(_storageLocation);
            return(hashStorage);
        }