public void BuildDirectoryTree() { Dictionary <int, MicrosoftSTFSDirectoryStructure> directoryList = new Dictionary <int, MicrosoftSTFSDirectoryStructure>(); FileTableEntry fileTableEntry = new FileTableEntry(); MicrosoftSTFSDirectoryStructure parentDirectoryStructure; MicrosoftSTFSDirectoryStructure directoryStructure; MicrosoftSTFSFileStructure fileStructure; String parentDirectoryName = String.Empty; ArrayList keyListArray = new ArrayList(); int[] keyList; //------------------ // add root folder //------------------ directoryStructure = new MicrosoftSTFSDirectoryStructure(this.SourceFileName, String.Empty, String.Empty, MicrosoftSTFS.ROOT_DIRECTORY_PATH_INDICATOR); directoryList.Add(MicrosoftSTFS.ROOT_DIRECTORY_PATH_INDICATOR, directoryStructure); //---------------------- // build directory list //---------------------- for (int i = 0; i < FileTableEntries.Length; i++) { fileTableEntry = FileTableEntries[i]; // build parent directory name parentDirectoryName = Path.Combine(directoryList[fileTableEntry.PathIndicator].ParentDirectoryName, directoryList[fileTableEntry.PathIndicator].DirectoryName); if (fileTableEntry.IsDirectory) { // create directory directoryStructure = new MicrosoftSTFSDirectoryStructure(this.SourceFileName, fileTableEntry.FileName, parentDirectoryName, fileTableEntry.PathIndicator); // add to list directoryList.Add(i, directoryStructure); } else { // create file structure fileStructure = new MicrosoftSTFSFileStructure( parentDirectoryName, this.SourceFileName, fileTableEntry.FileName, this.VolumeBaseOffset, fileTableEntry.StartingBlockForFileLE, fileTableEntry.FileSize, ByteConversion.GetDateTimeFromFAT32Date(fileTableEntry.UpdateDateTime), fileTableEntry.BlocksForFileLE1, this.HeaderSize, this.BlockSeparation); // add to directory directoryList[fileTableEntry.PathIndicator].FileArray.Add(fileStructure); } } // for (int i = 0; i < FileTableEntries.Length; i++) //----------------------- // assemble directories //----------------------- // build reversed keyList foreach (int key in directoryList.Keys) { keyListArray.Add(key); } keyListArray.Sort(); keyList = (int[])keyListArray.ToArray(typeof(int)); // loop through dirs backwards for (int i = keyList.GetUpperBound(0); i > 0; i--) { // add to sub directory of parent directoryStructure = directoryList[keyList[i]]; parentDirectoryStructure = directoryList[directoryStructure.ParentDirectoryId]; parentDirectoryStructure.SubDirectoryArray.Add(directoryStructure); // remove from directoryList directoryList.Remove(keyList[i]); } // Add root element to Volumes directory list this.DirectoryStructureArray.Add(directoryList[MicrosoftSTFS.ROOT_DIRECTORY_PATH_INDICATOR]); }