/// <summary> /// Adds files from a specific folder. The folder relative location is used to avoid messing up the folder structure. /// </summary> /// <param name="sourceLocation">The location of the source folder</param> /// <param name="SourceFolderRelativeLocation">The relatice location of the source folder.</param> public void AddFilesFromAFolder(string sourceLocation, string SourceFolderRelativeLocation) { var tempList = PullFiles(Path.Combine(sourceLocation, SourceFolderRelativeLocation)); foreach (string fileEntry in tempList) { ArchiveMemoryStream.CreateEntryFromFile(fileEntry, fileEntry.Replace(sourceLocation + GetFolderCharacter(), ""), CompressionLevel.NoCompression); FileList.Add(fileEntry.Replace(sourceLocation + GetFolderCharacter(), "")); } }
/// <summary> /// Adds files from a specific folder. /// </summary> /// <param name="source">The location of the source folder.</param> public void AddFilesFromAFolder(string source) { var tempList = PullFiles(source); foreach (string fileEntry in tempList) { ArchiveMemoryStream.CreateEntryFromFile(fileEntry, fileEntry.Replace(source + GetFolderCharacter(), ""), CompressionLevel.NoCompression); FileList.Add(fileEntry.Replace(source + GetFolderCharacter(), "")); } }
/// <summary> /// Adds a specified file to the list. This method is better suited for preserving the folder structure. /// </summary> /// <param name="source">The base folder that holds the file.</param> /// <param name="fileRelativeLocation">The relative location of the file.</param> public void AddFileToList(string source, string fileRelativeLocation) { FileList.Add(fileRelativeLocation); ArchiveMemoryStream.CreateEntryFromFile(Path.Combine(source, fileRelativeLocation), fileRelativeLocation, CompressionLevel.NoCompression); }
/// <summary> /// Adds a specified file to the list. This method only works if the file is in the source folder. /// </summary> /// <param name="fileLocation">The location of the file.</param> public void AddFileToList(string fileLocation) { FileList.Add(fileLocation.Replace(SourceLocation + GetFolderCharacter(), "")); ArchiveMemoryStream.CreateEntryFromFile(fileLocation, fileLocation.Replace(SourceLocation + GetFolderCharacter(), ""), CompressionLevel.NoCompression); }