Example #1
0
        /// <summary>
        /// Adds a <see cref="AegisFileInfo"/> to the index.
        /// </summary>
        /// <param name="fileInfo">The <see cref="AegisFileInfo"/> to add.</param>
        public void Add(AegisFileInfo fileInfo)
        {
            var existingFileInfo = this.FileTree.Find(fileInfo.Path);

            if (existingFileInfo != null ||
                this.FileEntriesById.ContainsKey(fileInfo.FileId))
            {
                throw new AegisInternalErrorException("File index entry already exists.");
            }

            this.FileEntriesById.TryAdd(fileInfo.FileId, fileInfo);
            this.FileTree.Add(fileInfo);
        }
Example #2
0
        /// <summary>
        /// Adds information about a file to the tree.
        /// </summary>
        /// <param name="fileInfo">The file to add.</param>
        public void Add(AegisFileInfo fileInfo)
        {
            var treeNode = this.GetNodeForDirectoryPath(fileInfo.Path.DirectoryPath, createIfNotExists: true);

            treeNode.Files.Add(fileInfo.Path.FileName, fileInfo);
        }