示例#1
0
        public void RegisterToc(string tocFileKey, string fileKey)
        {
            if (string.IsNullOrEmpty(fileKey))
            {
                throw new ArgumentNullException(nameof(fileKey));
            }
            if (string.IsNullOrEmpty(tocFileKey))
            {
                throw new ArgumentNullException(nameof(tocFileKey));
            }

            TocMap.AddOrUpdate(
                fileKey,
                new HashSet <string>(FilePathComparer.OSPlatformSensitiveRelativePathComparer)
            {
                tocFileKey
            },
                (k, v) =>
            {
                lock (v)
                {
                    v.Add(tocFileKey);
                }
                return(v);
            });
        }
示例#2
0
        public IImmutableList <string> GetTocFileKeySet(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException(nameof(key));
            }
            if (TocMap.TryGetValue(key, out HashSet <string> sets))
            {
                return(sets.ToImmutableArray());
            }

            return(null);
        }
示例#3
0
        public void RegisterToc(string tocFileKey, string fileKey)
        {
            if (string.IsNullOrEmpty(fileKey))
            {
                throw new ArgumentNullException(nameof(fileKey));
            }
            if (string.IsNullOrEmpty(tocFileKey))
            {
                throw new ArgumentNullException(nameof(tocFileKey));
            }
            HashSet <string> sets;

            if (TocMap.TryGetValue(fileKey, out sets))
            {
                sets.Add(tocFileKey);
            }
            else
            {
                TocMap[fileKey] = new HashSet <string>(FilePathComparer.OSPlatformSensitiveComparer)
                {
                    tocFileKey
                };
            }
        }