Table of Contents

Class FileIndex

Namespace
SunamoFilesIndex
Assembly
SunamoFilesIndex.dll

Resembles database work - uses int numbers to mark folders

Working with CheckBoxData Use FolderItem, FileItem

public class FileIndex
Inheritance
FileIndex
Inherited Members
Extension Methods

Fields

Files

All files in the index

public List<FileItem> Files

Field Value

List<FileItem>

Properties

BasePath

Gets the base path of the indexed folder structure

public string? BasePath { get; }

Property Value

string

Methods

AddFolderRecursively(string)

Process all files including subfolders Folder path must end with backslash

public void AddFolderRecursively(string folder)

Parameters

folder string

Folder path to index (must end with backslash)

AggregateFilesFromAllFolders(string, FileIndex, Dictionary<string, int>, List<string>)

Add file to dictionary with relative path if it doesn't exist Use relative path to file to find relative directory ID and insert with file path ID to dictionary

public static void AggregateFilesFromAllFolders(string folderOfSolution, FileIndex fileIndex, Dictionary<string, int> relativeFilePathForEveryColumn, List<string> filesFromAllFoldersUniqueRelative)

Parameters

folderOfSolution string

Base path that will be discarded, used to make relative file paths

fileIndex FileIndex

FileIndex object containing files to process

relativeFilePathForEveryColumn Dictionary<string, int>

Dictionary where key is relative file path, value is column index

filesFromAllFoldersUniqueRelative List<string>

List of relative file paths, used to fill dictionary, not modified

CheckVertically(CheckBoxDataShared<TWithSize<string>>[,])

Check (or uncheck) all in columns by filesize

public static CheckBoxDataShared<TWithSize<string>>[,] CheckVertically(CheckBoxDataShared<TWithSize<string>>[,] allRows)

Parameters

allRows CheckBoxDataShared<TWithSize<string>>[,]

The matrix of checkbox data to process

Returns

CheckBoxDataShared<TWithSize<string>>[,]

Updated matrix with ticked/unticked checkboxes based on file sizes

ExistsFilesOnDrive(Dictionary<string, FileIndex>, Dictionary<string, int>)

Create matrix from files where each file will be in specific column When file doesn't exist, it will be null Load size of files from disc

public static CheckBoxDataShared<TWithSize<string>?>?[,] ExistsFilesOnDrive(Dictionary<string, FileIndex> files, Dictionary<string, int> relativeFilePathForEveryColumn)

Parameters

files Dictionary<string, FileIndex>

Dictionary with folder paths as keys and FileIndex objects as values

relativeFilePathForEveryColumn Dictionary<string, int>

Dictionary where key is relative file path, value is column index

Returns

CheckBoxDataShared<TWithSize<string>>[,]

Matrix of CheckBoxData with file information

FindAllFilesWithName(string)

Find all files with the specified name

public List<FileItem> FindAllFilesWithName(string name)

Parameters

name string

Name of the file to find

Returns

List<FileItem>

List of files with matching name

GetFilesInRelativeFolder(int)

Get all files in relative folder by index

public IList<FileItem> GetFilesInRelativeFolder(int relativeDirectoryIndex)

Parameters

relativeDirectoryIndex int

Index of the relative directory

Returns

IList<FileItem>

List of files in that directory

GetFoldersWithName(int[], string)

Get folders with specified name from given parent IDs

public IList<FolderItem> GetFoldersWithName(int[] parentIds, string name)

Parameters

parentIds int[]

Array of parent folder IDs to search in (null = search all)

name string

Name of the folder to find

Returns

IList<FolderItem>

List of folders matching the criteria

GetIndexOfFolder(FolderItem)

Get index of folder in internal collection

public int GetIndexOfFolder(FolderItem item)

Parameters

item FolderItem

Folder item to find

Returns

int

Index of the folder

GetRelativeFolder(int)

Get relative folder path by index

public string GetRelativeFolder(int folder)

Parameters

folder int

Index of the folder

Returns

string

Relative folder path

GetRelativeFolder(string)

Return index of folder or -1 if not found

public int GetRelativeFolder(string folder)

Parameters

folder string

Folder path to search for

Returns

int

Index of the folder or -1 if not found

IndexFolders(IList<string>)

Process recursively all folders - for every folder one FileIndex object in output

public static Dictionary<string, FileIndex> IndexFolders(IList<string> folders)

Parameters

folders IList<string>

List of folder paths to index

Returns

Dictionary<string, FileIndex>

Dictionary with folder paths as keys and FileIndex objects as values

Nuke()

Clear folders and files collection

public void Nuke()