File-side plumbing behind the fluent chain: writing a unit of work's data out in a delimited format, resolving where each browser actually downloads to, tokenizing input files, and the path handling the rest of the library leans on.
Most of this is internal. The members exposed here are the ones a workflow has a legitimate reason to call directly, mainly to find out where a download will land before going to fetch it.
More...
|
| static string | SaveToDelimited (UnitOfWork currentUOW, string filename, char delim, bool appendToFile, bool DeleteFileBeforeDownload) |
| | Writes the unit of work's retrieved data to a delimited file, one column per selector.
Column headers come from the unit of work's .WithHeader list. When none were given the selector names are used instead; when fewer were given than there are selectors the remainder are topped up from the selector names; when more were given the extras are dropped and an event says so.
The destination is resolved through CleanUpFileDestination(string, out string, bool), so an existing file may be written to a new name rather than overwritten depending on the file's settings.
|
| static string | GetDefaultDownloadDirectory (IBrowser browser) |
| | Returns the download directory this browser will actually use, read out of its own configuration rather than assumed. Routes to the Chrome, Edge or Firefox reader according to the browser type, and falls back to the Windows Downloads folder for anything else.
|
| static string | GetChromeDefaultDownloadDirectory (string profilePath=null) |
| | Reads Chrome's download.default_directory out of the profile's Preferences file. Falls back to the Windows Downloads folder when the preference was never set explicitly or the file cannot be found.
|
| static string | GetEdgeDefaultDownloadDirectory (string profilePath=null) |
| | Reads Edge's download.default_directory out of the profile's Preferences file. Edge is Chromium, so the preference lives in the same place, only under a different vendor directory. Falls back to the Windows Downloads folder when the preference was never set explicitly or the file cannot be found.
|
| static string | GetFirefoxDefaultDownloadDirectory (string profilePath=null) |
| | Reads Firefox's browser.download.dir out of the profile's prefs.js. Firefox keeps no JSON preferences file, so the default profile is found by parsing profiles.ini and the setting is read from prefs.js. Falls back to the Windows Downloads folder when the preference was never set explicitly.
|
| static string | GetShortPath (string longPath) |
| | Returns the 8.3 short form of a path, for the places that still cannot cope with spaces or a long path. The path has to exist, since Windows derives the short name from the filesystem. Hands back the original path unchanged when there is no short form.
|
| static string | EnsureDirectoryEndsWithBackslash (string directoryPath) |
| | Adds a trailing backslash to a directory path when it does not already have one, so the path can be concatenated without producing a double separator or gluing the directory to the filename.
|
File-side plumbing behind the fluent chain: writing a unit of work's data out in a delimited format, resolving where each browser actually downloads to, tokenizing input files, and the path handling the rest of the library leans on.
Most of this is internal. The members exposed here are the ones a workflow has a legitimate reason to call directly, mainly to find out where a download will land before going to fetch it.
Definition at line 54 of file FileHelper.cs.
◆ EnsureDirectoryEndsWithBackslash()
| string GenerallyPositive.FileHelper.EnsureDirectoryEndsWithBackslash |
( |
string | directoryPath | ) |
|
|
static |
Adds a trailing backslash to a directory path when it does not already have one, so the path can be concatenated without producing a double separator or gluing the directory to the filename.
- Parameters
-
| directoryPath | Directory path to check |
- Returns
- The path, guaranteed to end in a backslash
Definition at line 2208 of file FileHelper.cs.
◆ GetChromeDefaultDownloadDirectory()
| string GenerallyPositive.FileHelper.GetChromeDefaultDownloadDirectory |
( |
string | profilePath = null | ) |
|
|
static |
Reads Chrome's download.default_directory out of the profile's Preferences file. Falls back to the Windows Downloads folder when the preference was never set explicitly or the file cannot be found.
- Parameters
-
| profilePath | Profile directory to read. The Default profile under Local AppData when null |
- Returns
- The configured download directory, or the Windows Downloads folder
Definition at line 959 of file FileHelper.cs.
◆ GetDefaultDownloadDirectory()
| string GenerallyPositive.FileHelper.GetDefaultDownloadDirectory |
( |
IBrowser | browser | ) |
|
|
static |
Returns the download directory this browser will actually use, read out of its own configuration rather than assumed. Routes to the Chrome, Edge or Firefox reader according to the browser type, and falls back to the Windows Downloads folder for anything else.
- Parameters
-
| browser | Browser whose configured download directory is wanted |
- Returns
- The download directory, ending in a backslash for the Windows fallback
Definition at line 940 of file FileHelper.cs.
◆ GetEdgeDefaultDownloadDirectory()
| string GenerallyPositive.FileHelper.GetEdgeDefaultDownloadDirectory |
( |
string | profilePath = null | ) |
|
|
static |
Reads Edge's download.default_directory out of the profile's Preferences file. Edge is Chromium, so the preference lives in the same place, only under a different vendor directory. Falls back to the Windows Downloads folder when the preference was never set explicitly or the file cannot be found.
- Parameters
-
| profilePath | Profile directory to read. The Default profile under Local AppData when null |
- Returns
- The configured download directory, or the Windows Downloads folder
Definition at line 999 of file FileHelper.cs.
◆ GetFirefoxDefaultDownloadDirectory()
| string GenerallyPositive.FileHelper.GetFirefoxDefaultDownloadDirectory |
( |
string | profilePath = null | ) |
|
|
static |
Reads Firefox's browser.download.dir out of the profile's prefs.js. Firefox keeps no JSON preferences file, so the default profile is found by parsing profiles.ini and the setting is read from prefs.js. Falls back to the Windows Downloads folder when the preference was never set explicitly.
- Parameters
-
| profilePath | Profile directory to read. Resolved from profiles.ini when null |
- Returns
- The configured download directory, or the Windows Downloads folder
Definition at line 1040 of file FileHelper.cs.
◆ GetShortPath()
| string GenerallyPositive.FileHelper.GetShortPath |
( |
string | longPath | ) |
|
|
static |
Returns the 8.3 short form of a path, for the places that still cannot cope with spaces or a long path. The path has to exist, since Windows derives the short name from the filesystem. Hands back the original path unchanged when there is no short form.
- Parameters
-
- Returns
- The short path, or longPath when Windows did not supply one
Definition at line 1888 of file FileHelper.cs.
◆ SaveToDelimited()
| string GenerallyPositive.FileHelper.SaveToDelimited |
( |
UnitOfWork | currentUOW, |
|
|
string | filename, |
|
|
char | delim, |
|
|
bool | appendToFile, |
|
|
bool | DeleteFileBeforeDownload ) |
|
static |
Writes the unit of work's retrieved data to a delimited file, one column per selector.
Column headers come from the unit of work's .WithHeader list. When none were given the selector names are used instead; when fewer were given than there are selectors the remainder are topped up from the selector names; when more were given the extras are dropped and an event says so.
The destination is resolved through CleanUpFileDestination(string, out string, bool), so an existing file may be written to a new name rather than overwritten depending on the file's settings.
- Parameters
-
| currentUOW | Unit of work holding the retrieved data, its selectors and any header list |
| filename | Destination file, before any renaming for an existing file |
| delim | Character written between columns |
| appendToFile | True to add to an existing file, false to start a new one |
| DeleteFileBeforeDownload | True to delete the destination first rather than rename around it |
- Returns
- The full path actually written to, which may differ from filename
Definition at line 297 of file FileHelper.cs.
The documentation for this class was generated from the following file: