﻿// file selection functions

// SetHardSymLinkMode(int mode) to set selection and action mode 0 - hard link mode, 1 - sym link mode
SetHardSymLinkMode(1) set symbolic link mode 
SetHardSymLinkMode(0) set back hard link mode (default)

// SelectAll(bool setSelection) to select / unselect all files 
// Usage: 
SelectAll(true) // select all
SelectAll(false) // unselect all

// SelectFirstFiles(bool setSelection) to select / unselect first files in groups
// Usage: 
SelectFirstFiles(true) // select first files in groups
SelectFirstFiles(false) // unselect first files in groups

// SelectLastFiles(bool setSelection) to select / unselect last files in groups
// Usage: 
SelectFirstFiles(true) // select last files in groups
SelectFirstFiles(false) // unselect last files in groups

// SelectFile(bool setSelection, string filePathOrWildCard) to select / unselect specified file(s) by path, name or wildcard
// Usage:
SelectFile(true, 'c:\test\1.txt')  // select file 'c:\\test\1.txt' (if it's in result list)
SelectFile(true, 'picture.jpg')  // select file(s) with name 'picture.jpg' (if any is in result list)
SelectFile(false, 'picture*.jpg')  // unselect file(s) with wildecard 'picture*.jpg' (if any is in result list)

// SelectFilesInFolder(bool setSelection, string folder) to select/unselect files in the given folder
// Usage:
SelectFilesInFolder(true, 'c:\test\') // select all found files in the folder c:\test\
SelectFilesInFolder(false, 'c:\test\') // unselect all found files in the folder c:\test\

// SelectFilesInFolderAndSubfolders(bool setSelection, string folder) to select/unselect files in the given folder and subfolder
// Usage:
SelectFilesInFolderAndSubfolders(true, 'c:\test\') // select all found files in the folder c:\test\ and subfolders
SelectFilesInFolderAndSubfolders(false, 'c:\test\') // unselect all found files in the folder c:\test\ and subfolders

// SelectFilesByExt(bool setSelection, string extension) to select/unselect files with the given extension
// Usage:
SelectFilesByExt(true, '.jpg') // select all .jpg files 
SelectFilesByExt(false, '.jpg') // unselect all .jpg files 

// SelectAllLinksIfAnyFileIsUnchecked(bool setSelection) to select / unselect all hard- or sym- links if any of them already selected or unselected in order all have same state
// Usage:
SelectAllLinksIfAnyFileIsUnchecked(true) // select other all hard- or sym- links of a file if any of them already selected
SelectAllLinksIfAnyFileIsUnchecked(false) // unselect all hard- or sym- links of a file if any of them already unselected

//SelectAllReadonly(bool setSelection) to select / unselect all files with Read-only or System attribute set
SelectAllReadonly(true) // select all files with Read-only or System attribute set
SelectAllReadonly(false) // unselect all files with Read-only or System attribute set

// UnselectMinimallyFragmentedFiles() to unselect one minimally fragmented file in each group
// Usage:
UnselectMinimallyFragmentedFiles()

// SelectTheNewestFileInEachGroup(bool setSelection) to select / unselect one newest file in each group
// Usage:
SelectTheNewestFileInEachGroup(true) // select one newest file in each group
SelectTheNewestFileInEachGroup(false) // unselect one newest file in each group

// SelectTheOldestFileInEachGroup(bool setSelection) to select / unselect one oldest file in each group
// Usage:
SelectTheOldestFileInEachGroup(true) // select one oldest file in each group
SelectTheOldestFileInEachGroup(false) // unselect one oldest file in each group

// UnselectFilesProtectedFromModification() to unselects all files the application is not allowed to change
// Usage:
UnselectFilesProtectedFromModification()

// SelectFullyUnselectedGroups() to select all files in groups that do not contain any selected files
// Usage:
SelectFullyUnselectedGroups()

// UnselectFullySelectedGroups() to unselect all files of groups where all files are selected
// Usage:
UnselectFullySelectedGroups()

// InvertSelection() to invert selection
// Usage: 
InvertSelection()

// file selection as hard- or sym- link targets

// SelectFirstFilesAsLinkTargets() to select first files as hard- or sym- link targets
// Usage:
SelectFirstFilesAsLinkTargets()

// SelectLastFilesAsLinkTargets() to select last files as hard- or sym- link targets
// Usage:
SelectLastFilesAsLinkTargets()

// SelectFilesWithTheMostHardLinksAsLinkTargets() to select files with the most hard links (if any) as hard- or sym- link targets
// Usage:
SelectFilesWithTheMostHardLinksAsLinkTargets()

// SelectFilesInFolderAsLinkTargets(string path) to select files in the given folder as hard- or sym- link targets (one file per group)
// Usage:
SelectFilesInFolderAsLinkTargets('c:\test\') // to select files in the folder c:\test\ as hard- or sym- link targets (one per group)

// SelectFilesInFolderOrSubfolderAsLinkTargets(string path) to select files in the given folder and its subfolders as hard- or sym- link targets (one file per group)
// Usage:
SelectFilesInFolderOrSubfolderAsLinkTargets('c:\test\') // to select files in the folder c:\test\ and its subfolders as hard- or sym- link targets (one per group)

// SelectMinimallyFragmentedFilesAsLinkTargets() // to select one minimally fragmented file in each group as hard- or sym- link targets
// Usage:
SelectMinimallyFragmentedFilesAsLinkTargets()

// SelectTheNewestFileInEachGroupAsLinkTargets() to select the newest files as hard- or sym- link targets (one file per group)
// Usage:
SelectTheNewestFileInEachGroupAsLinkTargets()

// SelectReadonlyAndSystemFilesAsLinkTargets() to select files with Read-only or System attribute set as hard- or sym- link targets (one file per group)
// Usage:
SelectReadonlyAndSystemFilesAsLinkTargets()

// SelectFilesProtectedFromModificationAsLinkTargets() to select files the application is not allowed to change as hard- or sym- link targets (one file per group)
// Usage:
SelectFilesProtectedFromModificationAsLinkTargets()


// actions 

// ExcludeSelectedFilesFromTheList() to exclude selected files from the result list
// Usage:
ExcludeSelectedFilesFromTheList() 

// RunReplaceFileWithLinkAction() to run replacing selected files with hard or symbolic links (depending on current mode) to selected link targets 
// Usage:
RunReplaceFileWithLinkAction() to run replacing selected files with hard or symbolic links (depending on current mode) to selected link targets 

// RunDetachFileLinksAction() to run replacing selected hard or symbolic links with files.
// Usage:
RunDetachFileLinksAction()

// RunDeleteFilesAction(bool deleteToRecycle, bool deleteEmptyFolders) to delete selected files, optional delete to recycle bin, optional delete empty folders after deleting files.
// Usage:
RunDeleteFilesAction(false, false) // to delete files.
RunDeleteFilesAction(false, true) // to delete files and delete empty folders after deleting files.
RunDeleteFilesAction(true, false) // to delete files to recycle bin.
RunDeleteFilesAction(true, true) // to delete files to recycle bin and delete empty folders after deleting files.

// RunCompressFilesAction(bool skipIncompressibleFiles, bool useCompactTool = false) to compress selected files using NTFS compression (useCompactTool = false) or Compact OS tool (useCompactTool = true)
// Usage:
RunCompressFilesAction(false, false) to set NTFS compression attribute for all selected files using NTFS compression without compression estimation.
RunCompressFilesAction(false, true) to compress all selected files using Compact OS tool without compression estimation.
RunCompressFilesAction(true, true) to estimate compression and compress selected files using Compact OS tool if the estimated compression rate < 90%.
