Example #1
0
        private void CollectFilesystem(Network network, FileInfo fileInfo)
        {
            if (!fileInfo.Exists)
            {
                return;
            }

            var apik = ApiKey.FromFile(network, fileInfo);

            if (apik == null)
            {
                return;
            }

            _keys.Add(apik);
        }
        private CoverageMapMemory Get()
        {
            lock (Lock)
            {
                var cm = CoverageMapsCache.FirstOrDefault(x => x.Id == _adapter.SeriesId);
                if (cm != null)
                {
                    return(cm);
                }

                cm = new CoverageMapMemory {
                    Id = _adapter.SeriesId
                };
                CoverageMapsCache.Add(cm);
                return(cm);
            }
        }
Example #3
0
        protected TypeIndexDictionariesBase(IEnumerable <Type> types, Func <Type, T> hashFunction)
        {
            Types = types.ToList();
            try
            {
                _typeLookup = Types.ToDictionary(hashFunction, t => t);
            }
            catch
            {
                var table = Types.ToDictionary(t => t, hashFunction);
                var dupes = new UniqueList <string>();
                foreach (var t in table)
                {
                    if (table.Values.Count(x => x.Equals(t.Value)) > 1)
                    {
                        dupes.Add(t.Key.FullName);
                    }
                }

                var dup = string.Join(", ", dupes);
                throw new Exception("Type(s) '" + dup + "' cannot be added to " + GetType() + " because of a hash collision.");
            }
            _hashLookup = _typeLookup.ToDictionary(k => k.Value, v => v.Key);
        }