18using System.Collections.Generic;
24using System.Threading.Tasks;
35 public class GPALFile :
IGPALFile, IGPALFileInternal
42 GPALFileSettings IGPALFileInternal.FileSettings {
get;
set; }
58 ((IGPALFileInternal)
this).FileSettings =
new GPALFileSettings();
59 ((IGPALFileInternal)
this).FileDictionary =
new List<Dictionary<object, dynamic>>();
67 internal GPALFile(
string fileName)
69 ((IGPALFileInternal)
this).FileSettings =
new GPALFileSettings();
70 ((IGPALFileInternal)
this).FileSettings.Filenames.Add(fileName);
71 ((IGPALFileInternal)
this).FileDictionary =
new List<Dictionary<object, dynamic>>();
73 #region <Fluent Interface>
82 ((IGPALFileInternal)
this).FileSettings.OverwriteFile.Add(overwriteFile);
94 ((IGPALFileInternal)
this).FileSettings.FileSortOrder = fileSortOrder;
106 ((IGPALFileInternal)
this).FileSettings.NextFilePattern = nextFilePattern;
116 ((IGPALFileInternal)
this).FileSettings.Delimiter.Add(delimiter);
127 ((IGPALFileInternal)
this).FileSettings.FieldsEnclosedInQuotes.Add(fieldsInQuotes);
137 ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames.Add(firstLineIsColumnNames);
147 ((IGPALFileInternal)
this).FileSettings.IgnoreFirstLineColumnNames.Add(ignoreFirstLine);
158 ((IGPALFileInternal)
this).FileSettings.UseOneHeaderForAllFiles = useHeaderForAllFiles;
182 ((IGPALFileInternal)
this).FileSettings.Browser = browser;
204 fileName = Environment.ExpandEnvironmentVariables(fileName);
207 if (
true ==
FileHelper.IsWebAddress(fileName))
210 string name = Path.GetFileName(
new Uri(fileName).LocalPath);
211 string localPath = Path.Combine(
GPAL.TempDirectory(),
true ==
string.IsNullOrWhiteSpace(name) ?
"download" : name);
213 ((IGPALFileInternal)
this).FileSettings.SourceUrl = fileName;
220 FileHelper.FetchOrDownloadInTab(fileName, localPath, browser);
222 FileHelper.DownloadToFile(localPath, fileName);
224 fileName = localPath;
227 if (
true == fileName.Contains(
'*') ||
true == fileName.Contains(
'?'))
229 string directory = Path.GetDirectoryName(fileName);
230 string filenamePart = Path.GetFileName(fileName);
231 string[] matches = Directory.GetFiles(
false ==
string.IsNullOrEmpty(directory) ? directory :
@".\", filenamePart);
233 if (0 == matches.Length)
235 GPAL.
PublishSimpleEvent(Enums.GPALEventType.WARNING, $
"No files matched the wildcard pattern [{fileName}].",
this, Enums.GPALObjectType.GPALFile);
239 IEnumerable<string> sortedMatches;
241 switch (((IGPALFileInternal)
this).FileSettings.FileSortOrder)
243 case Enums.FileSortOrder.NameDescending:
244 sortedMatches = matches.OrderByDescending(m => m, StringComparer.OrdinalIgnoreCase);
246 case Enums.FileSortOrder.NaturalAscending:
247 sortedMatches = matches.OrderBy(m => m, NaturalFilenameComparer.Instance);
249 case Enums.FileSortOrder.NaturalDescending:
250 sortedMatches = matches.OrderByDescending(m => m, NaturalFilenameComparer.Instance);
252 case Enums.FileSortOrder.DateModifiedAscending:
253 sortedMatches = matches.OrderBy(m => File.GetLastWriteTimeUtc(m));
255 case Enums.FileSortOrder.DateModifiedDescending:
256 sortedMatches = matches.OrderByDescending(m => File.GetLastWriteTimeUtc(m));
258 case Enums.FileSortOrder.DateCreatedAscending:
259 sortedMatches = matches.OrderBy(m => File.GetCreationTimeUtc(m));
261 case Enums.FileSortOrder.DateCreatedDescending:
262 sortedMatches = matches.OrderByDescending(m => File.GetCreationTimeUtc(m));
264 case Enums.FileSortOrder.NameAscending:
266 sortedMatches = matches.OrderBy(m => m, StringComparer.OrdinalIgnoreCase);
270 foreach (
string match
in sortedMatches)
272 ((IGPALFileInternal)
this).FileSettings.Filenames.Add(match);
273 ((IGPALFileInternal)
this).FileSettings.FileCount++;
279 ((IGPALFileInternal)
this).FileSettings.Filenames.Add(fileName);
280 ((IGPALFileInternal)
this).FileSettings.FileCount++;
294 if (((IGPALFileInternal)
this).FileSettings.FileCount > ((IGPALFileInternal)
this).FileSettings.ColumnList.Count())
295 ((IGPALFileInternal)
this).FileSettings.ColumnList.AddRow(
new List<string>());
297 ((IGPALFileInternal)
this).FileSettings.ColumnList[((IGPALFileInternal)
this).FileSettings.ColumnList.Count() - 1].Add(columnName);
299 if (((IGPALFileInternal)
this).FileSettings.FileCount > ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames.Count)
300 ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames.Add(
true);
313 if (((IGPALFileInternal)
this).FileSettings.FileCount > ((IGPALFileInternal)
this).FileSettings.ColumnList.Count())
314 ((IGPALFileInternal)
this).FileSettings.ColumnList.AddRow(
new List<string>());
318 string oldColumns =
string.Join(
", ", ((IGPALFileInternal)
this).FileSettings.ColumnList[((IGPALFileInternal)
this).FileSettings.ColumnList.Count() - 1]);
319 GPAL.
PublishSimpleEvent(Enums.GPALEventType.WARNING, $
"Overwriting existing column names [{oldColumns}] with new names [{columnNames}]");
320 ((IGPALFileInternal)
this).FileSettings.ColumnList.Clear();
323 foreach (
string columnName
in columnNames.Split(
','))
324 ((IGPALFileInternal)
this).FileSettings.ColumnList[((IGPALFileInternal)
this).FileSettings.ColumnList.Count() - 1].Add(columnName.Trim());
328 if (((IGPALFileInternal)
this).FileSettings.FileCount > ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames.Count)
329 ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames.Add(
true);
344 if (((IGPALFileInternal)
this).FileSettings.FileCount > ((IGPALFileInternal)
this).FileSettings.ColumnList.Count())
345 ((IGPALFileInternal)
this).FileSettings.ColumnList.AddRow(
new List<string>());
347 foreach (
string columnName
in columnNames)
348 ((IGPALFileInternal)
this).FileSettings.ColumnList[((IGPALFileInternal)
this).FileSettings.ColumnList.Count() - 1].Add(columnName);
350 if (((IGPALFileInternal)
this).FileSettings.FileCount > ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames.Count)
351 ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames.Add(
true);
355 #endregion <Fluent Interface>
357 #region <Getters/Setters>
366 if (0 < ((IGPALFileInternal)
this).FileSettings.FileCount)
368 ((IGPALFileInternal)
this).FileSettings.NextFileCount = 0;
369 return ((IGPALFileInternal)
this).FileSettings.Filenames[0];
383 if (0 < ((IGPALFileInternal)
this).FileSettings.FileCount)
385 ((IGPALFileInternal)
this).FileSettings.NextFileCount = ((IGPALFileInternal)
this).FileSettings.Filenames.Count - 1;
386 return ((IGPALFileInternal)
this).FileSettings.Filenames[((IGPALFileInternal)
this).FileSettings.Filenames.Count - 1];
404 string fullPath =
null;
405 string newFilename =
null;
406 Enums.NextFilePattern nextPattern = ((IGPALFileInternal)
this).FileSettings.NextFilePattern;
407 int patternCounter = ((IGPALFileInternal)
this).FileSettings.NextPatternCounter;
409 if (0 == ((IGPALFileInternal)
this).FileSettings.OverwriteFile.Count)
411 if (((IGPALFileInternal)
this).FileSettings.NextFileCount < ((IGPALFileInternal)
this).FileSettings.FileCount)
413 fullPath =
FileHelper.CleanUpFileDestination(((IGPALFileInternal)
this).FileSettings.Filenames[((IGPALFileInternal)
this).FileSettings.NextFileCount], out newFilename, DeleteFileBeforeDownload:
false, nextPattern, ref patternCounter);
414 ((IGPALFileInternal)
this).FileSettings.NextPatternCounter = patternCounter;
417 ((IGPALFileInternal)
this).FileSettings.ReturnFilenames.Add(fullPath);
418 ((IGPALFileInternal)
this).FileSettings.NextFileCount++;
423 fullPath =
FileHelper.CleanUpFileDestination(((IGPALFileInternal)
this).FileSettings.Filenames[((IGPALFileInternal)
this).FileSettings.NextFileCount-1], out newFilename, DeleteFileBeforeDownload:
false, nextPattern, ref patternCounter);
424 ((IGPALFileInternal)
this).FileSettings.NextPatternCounter = patternCounter;
425 ((IGPALFileInternal)
this).FileSettings.ReturnFilenames.Add(fullPath);
431 else if (((IGPALFileInternal)
this).FileSettings.NextFileCount < ((IGPALFileInternal)
this).FileSettings.OverwriteFile.Count)
433 if (
true == ((IGPALFileInternal)
this).FileSettings.OverwriteFile[((IGPALFileInternal)
this).FileSettings.NextFileCount])
435 fullPath =
FileHelper.CleanUpFileDestination(((IGPALFileInternal)
this).FileSettings.Filenames[((IGPALFileInternal)
this).FileSettings.NextFileCount++], out newFilename, DeleteFileBeforeDownload:
true);
436 ((IGPALFileInternal)
this).FileSettings.ReturnFilenames.Add(fullPath);
440 else if (((IGPALFileInternal)
this).FileSettings.NextFileCount < ((IGPALFileInternal)
this).FileSettings.FileCount)
442 fullPath =
FileHelper.CleanUpFileDestination(((IGPALFileInternal)
this).FileSettings.Filenames[((IGPALFileInternal)
this).FileSettings.NextFileCount], out newFilename, DeleteFileBeforeDownload:
false, nextPattern, ref patternCounter);
443 ((IGPALFileInternal)
this).FileSettings.NextPatternCounter = patternCounter;
446 ((IGPALFileInternal)
this).FileSettings.ReturnFilenames.Add(fullPath);
447 ((IGPALFileInternal)
this).FileSettings.NextFileCount++;
455 int patternIdx = Math.Min(((IGPALFileInternal)
this).FileSettings.NextFileCount, ((IGPALFileInternal)
this).FileSettings.FileCount - 1);
457 fullPath =
FileHelper.CleanUpFileDestination(((IGPALFileInternal)
this).FileSettings.Filenames[patternIdx], out newFilename, DeleteFileBeforeDownload:
false, nextPattern, ref patternCounter);
458 ((IGPALFileInternal)
this).FileSettings.NextPatternCounter = patternCounter;
459 ((IGPALFileInternal)
this).FileSettings.ReturnFilenames.Add(fullPath);
474 List<string> filenames = ((IGPALFileInternal)
this).FileSettings.Filenames;
476 return 0 == filenames.Count ? string.Empty : filenames[0];
487 return ((IGPALFileInternal)
this).FileSettings.Filenames.Select(filename => Path.GetDirectoryName(filename)).ToList();
497 return ((IGPALFileInternal)
this).FileSettings.Filenames.Select(filename => Path.GetFileName(filename)).ToList();
511 return 0 == filename.Length ? string.Empty : Path.GetDirectoryName(filename);
533 return 0 == filename.Length ? string.Empty : Path.GetFileName(filename);
543 return ((IGPALFileInternal)
this).FileSettings.Filenames;
553 return ((IGPALFileInternal)
this).FileSettings.ReturnFilenames;
565 return ((IGPALFileInternal)
this).FileSettings.SourceUrl;
573 List<IGPALGrid<string>> IGPALFileInternal.TokenList
577 return ((IGPALFileInternal)
this).FileSettings.TokenList;
581 ((IGPALFileInternal)
this).FileSettings.TokenList = value;
587 List<string> IGPALFileInternal.FileData
591 return ((IGPALFileInternal)
this).FileSettings.FileData;
595 ((IGPALFileInternal)
this).FileSettings.FileData = value;
601 List<char?> IGPALFileInternal.Delimiter
605 return ((IGPALFileInternal)
this).FileSettings.Delimiter;
609 ((IGPALFileInternal)
this).FileSettings.Delimiter = value;
616 List<bool> IGPALFileInternal.FieldsEnclosedInQuotes
620 return ((IGPALFileInternal)
this).FileSettings.FieldsEnclosedInQuotes;
624 ((IGPALFileInternal)
this).FileSettings.FieldsEnclosedInQuotes = value;
631 List<bool> IGPALFileInternal.FirstLineIsColumnNames
635 return ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames;
639 ((IGPALFileInternal)
this).FileSettings.FirstLineIsColumnNames = value;
646 List<bool> IGPALFileInternal.IgnoreFirstLineColumnNames
650 return ((IGPALFileInternal)
this).FileSettings.IgnoreFirstLineColumnNames;
654 ((IGPALFileInternal)
this).FileSettings.IgnoreFirstLineColumnNames = value;
661 bool IGPALFileInternal.UseOneHeaderForAllFiles
665 return ((IGPALFileInternal)
this).FileSettings.UseOneHeaderForAllFiles;
669 ((IGPALFileInternal)
this).FileSettings.UseOneHeaderForAllFiles = value;
675 List<Dictionary<object, dynamic>> IGPALFileInternal.FileDictionary
679 return ((IGPALFileInternal)
this).FileSettings.FileDictionary;
683 ((IGPALFileInternal)
this).FileSettings.FileDictionary = value;
689 List<IGPALGrid<string>> IGPALFileInternal.FileGrid
693 return ((IGPALFileInternal)
this).FileSettings.FileGrid;
697 ((IGPALFileInternal)
this).FileSettings.FileGrid = value;
704 bool IGPALFileInternal.AlreadyTokenized
708 return ((IGPALFileInternal)
this).FileSettings.AlreadyTokenized;
713 ((IGPALFileInternal)
this).FileSettings.AlreadyTokenized = value;
723 #endregion <Getters/Setters>
735 string myDestination = destination;
736 bool isDir = IsDirectoryOnly(destination);
738 foreach (
string filename
in ((IGPALFileInternal)
this).FileSettings.Filenames)
742 string directory = Path.GetDirectoryName(filename);
743 string filenamepart = Path.GetFileName(filename);
745 foreach (
string filename2
in Directory.GetFiles(
false ==
string.IsNullOrEmpty(directory) ? directory :
@".\", filenamepart))
748 myDestination = Path.Combine(destination, Path.GetFileName(filename2));
749 File.Copy(filename2, myDestination);
750 GPAL.
PublishSimpleEvent(Enums.GPALEventType.INFO, $
"[{filename2}] copied to [{destination}].",
this, Enums.GPALObjectType.GPALFile);
755 GPAL.
PublishSimpleEvent(Enums.GPALEventType.EXCEPTION, $
"Unable to copy [{filename}] to [{destination}].",
this, Enums.GPALObjectType.GPALFile, ex);
769 string myDestination = destination;
770 bool isDir = IsDirectoryOnly(destination);
772 foreach (
string filename
in ((IGPALFileInternal)
this).FileSettings.Filenames)
776 string directory = Path.GetDirectoryName(filename);
777 string filenamepart = Path.GetFileName(filename);
779 foreach (
string filename2
in Directory.GetFiles(
false ==
string.IsNullOrEmpty(directory) ? directory :
@".\", filenamepart))
782 myDestination = Path.Combine(destination, Path.GetFileName(filename2));
783 File.Move(filename2, myDestination);
784 GPAL.
PublishSimpleEvent(Enums.GPALEventType.INFO, $
"[{filename2}] moved to [{destination}].",
this, Enums.GPALObjectType.GPALFile);
789 GPAL.
PublishSimpleEvent(Enums.GPALEventType.EXCEPTION, $
"Unable to move [{filename}] to [{destination}].",
this, Enums.GPALObjectType.GPALFile, ex);
801 string myDestination = destination;
802 bool isDir = IsDirectoryOnly(destination);
807 foreach (
string filename
in Directory.GetFiles(destination))
809 myDestination = Path.Combine(destination, filename);
810 File.Delete(Path.Combine(myDestination, filename));
811 GPAL.
PublishSimpleEvent(Enums.GPALEventType.INFO, $
"[{myDestination}] deleted.",
this, Enums.GPALObjectType.GPALFile);
815 File.Delete(myDestination);
816 GPAL.
PublishSimpleEvent(Enums.GPALEventType.INFO, $
"[{myDestination}] deleted.",
this, Enums.GPALObjectType.GPALFile);
821 GPAL.
PublishSimpleEvent(Enums.GPALEventType.EXCEPTION, $
"Unable to delete[{myDestination}].",
this, Enums.GPALObjectType.GPALFile, ex);
830 foreach (
string filename
in ((IGPALFileInternal)
this).FileSettings.Filenames)
834 File.Delete(filename);
835 GPAL.
PublishSimpleEvent(Enums.GPALEventType.INFO, $
"[{filename}] deleted.",
this, Enums.GPALObjectType.GPALFile);
839 GPAL.
PublishSimpleEvent(Enums.GPALEventType.EXCEPTION, $
"Unable to delete [{filename}].",
this, Enums.GPALObjectType.GPALFile, ex);
852 internal static bool IsDirectoryOnly(
string path)
859 bool isDirectory =
true == path.EndsWith(Path.DirectorySeparatorChar.ToString())
860 ||
true == path.EndsWith(Path.AltDirectorySeparatorChar.ToString())
861 ||
true == Directory.Exists(path)
862 ||
false == Path.HasExtension(path);
866 string directoryToCreate =
true == isDirectory ? path : Path.GetDirectoryName(path);
868 if (
false ==
string.IsNullOrEmpty(directoryToCreate) &&
false == Directory.Exists(directoryToCreate))
870 Directory.CreateDirectory(directoryToCreate);
882 internal GPALFile Clone()
884 GPALFile clone =
new GPALFile();
885 IGPALFileInternal cloneInternal = (IGPALFileInternal)clone;
886 IGPALFileInternal thisInternal = (IGPALFileInternal)
this;
889 cloneInternal.FileSettings =
new GPALFileSettings
891 Filenames =
new List<string>(thisInternal.FileSettings.Filenames),
892 FileCount = thisInternal.FileSettings.FileCount,
893 NextFileCount = thisInternal.FileSettings.NextFileCount,
894 Delimiter =
new List<char?>(thisInternal.FileSettings.Delimiter),
895 FieldsEnclosedInQuotes =
new List<bool>(thisInternal.FileSettings.FieldsEnclosedInQuotes),
896 FirstLineIsColumnNames =
new List<bool>(thisInternal.FileSettings.FirstLineIsColumnNames),
897 IgnoreFirstLineColumnNames =
new List<bool>(thisInternal.FileSettings.IgnoreFirstLineColumnNames),
898 UseOneHeaderForAllFiles = thisInternal.FileSettings.UseOneHeaderForAllFiles,
899 TokenList = thisInternal.FileSettings.TokenList !=
null ?
new List<IGPALGrid<string>>(thisInternal.FileSettings.TokenList) : null,
900 FileData = thisInternal.FileSettings.FileData != null ? new List<string>(thisInternal.FileSettings.FileData) : null,
901 FileDictionary = thisInternal.FileSettings.FileDictionary != null ? new List<Dictionary<object, dynamic>>(thisInternal.FileSettings.FileDictionary) : null,
902 FileGrid = thisInternal.FileSettings.FileGrid != null ? new List<IGPALGrid<string>>(thisInternal.FileSettings.FileGrid) : null,
903 AlreadyTokenized = thisInternal.FileSettings.AlreadyTokenized
907 cloneInternal.FileDictionary = thisInternal.FileDictionary !=
null ?
new List<Dictionary<object, dynamic>>(thisInternal.FileDictionary) :
null;
912 #region Implicit Converter
919 public static implicit
operator string(GPALFile url) => url.
Filename;
929 public static implicit
operator GPALFile(
string fileName)
931 var file =
new GPALFile();
933 if (
string.IsNullOrWhiteSpace(fileName))
937 "Implicit conversion received null or whitespace filename - " +
938 "creating placeholder GPALFile with no real filename.",
940 GPALObjectType.GPALFile
943 file.WithFileName(
"Placeholder_Empty_" + DateTime.UtcNow.Ticks);
947 string trimmed = fileName.Trim();
950 file.WithFileName(trimmed);
953 string shortName = trimmed.Length > 48
954 ? trimmed.Substring(0, 45) +
"..."
959 $
"Implicit GPALFile created from [{shortName}]."
964 #endregion Implicit Converter
971 internal class NaturalFilenameComparer : IComparer<string>
973 public static readonly NaturalFilenameComparer Instance =
new NaturalFilenameComparer();
975 public int Compare(
string x,
string y)
977 IEnumerable<string> partsX = SplitIntoParts(x);
978 IEnumerable<string> partsY = SplitIntoParts(y);
980 using (var enumX = partsX.GetEnumerator())
981 using (var enumY = partsY.GetEnumerator())
985 bool hasX = enumX.MoveNext();
986 bool hasY = enumY.MoveNext();
988 if (
false == hasX &&
false == hasY)
995 string partX = enumX.Current;
996 string partY = enumY.Current;
998 bool isNumericX =
char.IsDigit(partX[0]);
999 bool isNumericY =
char.IsDigit(partY[0]);
1003 if (
true == isNumericX &&
true == isNumericY)
1006 BigInteger numX = BigInteger.Parse(partX);
1007 BigInteger numY = BigInteger.Parse(partY);
1008 comparison = numX.CompareTo(numY);
1012 comparison =
string.Compare(partX, partY, StringComparison.OrdinalIgnoreCase);
1015 if (0 != comparison)
1021 private static IEnumerable<string> SplitIntoParts(
string value)
1025 while (index < value.Length)
1027 bool isDigit =
char.IsDigit(value[index]);
1030 while (index < value.Length &&
char.IsDigit(value[index]) == isDigit)
1033 yield
return value.Substring(start, index - start);
File-side plumbing behind the fluent chain: writing a unit of work's data out in a delimited format,...
GPAL File object instantied with GPAL.File Used to load tokens into a GPALGrid [rows/columns].
IAllowFileSettings WithColumnsEnclosedInQuotes(bool fieldsInQuotes)
Specifies whether each field (column value) in the file is enclosed in quotes. Applies to flat files ...
void CopyTo(string destination)
Copies each file in Filenames to destination . If destination is a directory (per IsDirectoryOnly(st...
void MoveTo(string destination)
Moves each file in Filenames to destination . If destination is a directory (per IsDirectoryOnly(str...
string DirectoryPart
The folder of the first filename, since most files are singular. Same shortcut Filename is to Filenam...
string First
Returns the first filename in Filenames and resets the Next cursor so that a subsequent call to Next ...
IAllowFileSettings WithNextFilePattern(Enums.NextFilePattern nextFilePattern=Enums.NextFilePattern.CounterPadded)
Sets how Next builds a new, unique filename when it needs one (the target file already exists,...
IAllowFileSettings WithColumnName(string columnName)
.WithColumnName adds columns to the same 'most recent' column list. NOTE: .WithColumnNameS allows You...
List< string > DirectoryParts
The folder of every filename, in the same order as Filenames, so a wildcard that matched across folde...
void Delete()
Deletes every file in Filenames. Errors are reported via GPAL.PublishSimpleEvent rather than thrown.
string Last
Returns the last filename in Filenames and positions the Next cursor at that filename so that a subse...
List< string > ReturnFilenames
Get the list of filenames saved to (returned).
IAllowFileSettings WithFileName(string fileName)
The filename to load input tokens from. An http or https address is fetched to a local file in the w...
IAllowFileSettings WithColumnNames(string columnNames)
Add column names to the column name list using the .WithDelimiter to separate names....
List< string > FileParts
The name and extension of every filename, without its folder, in the same order as Filenames.
GPALFile Next
Advances an internal cursor and returns the next filename to use. If there is exactly one file and Wi...
int Count
The number of filenames in Filenames.
IAllowFileSettings WithOverwriteFile(bool overwriteFile=false)
Sets whether the destination file(s) should be overwritten or a new filename should be generated (use...
IAllowFileSettings WithFileSortOrder(Enums.FileSortOrder fileSortOrder)
Sets the order in which files matched by a wildcard pattern (e.g. *.csv) passed to WithFileName(strin...
IAllowFileSettings WithDelimiter(char delimiter)
THe character delimiting each token in the row (columns).
IAllowFileSettings WithIgnoreFirstLineColumnNames(bool ignoreFirstLine=true)
Specifies that the first line of the file (a column header row) should be ignored/skipped when readin...
void Delete(string destination)
Deletes the file at destination , or if it is a directory (per IsDirectoryOnly(string)),...
IAllowFileSettings WithBrowser(Browser.IBrowser browser)
The browser whose session can reach a url that our own connection cannot, for a file behind a login o...
string FilePart
The name and extension of the first filename, without its folder. Useful for putting the same name in...
GPALFile ToGPALObject()
Returns this GPALFile instance, allowing it to be passed where a generic GPAL object is expected.
List< string > Filenames
Get the list of filenames.
string SourceUrl
The url this file was fetched from, when .WithFileName was given one. Null for a file that was alread...
string Filename
We have only one file, accessing it.
IAllowFileSettings WithUseSameColumnNamesForAllFiles(bool useHeaderForAllFiles)
Specifies that a single column name list has been defined and should be reused for every file in the ...
IAllowFileSettings WithColumnNames(string[] columnNames)
Add column names to the column name list using the .WithDelimiter to separate names....
IAllowFileSettings WithFirstLineIsColumnNames(bool firstLineIsColumnNames)
Specifies that the first line of the file contains column header names.
Everything starts here, all the GPAL controls and global settings using fluent syntax are here....
static void PublishSimpleEvent(GPALEventType gPALEventType, string msg, dynamic gPALObject=null, Enums.GPALObjectType gPALObjectType=GPALObjectType.None, Exception ex=null)
Publish a message to either the information channel or exception channel (if exception passed in) Pub...