/// <summary> /// Extract to specific file /// </summary> public static void WriteToFile(this IArchiveEntry entry, string destinationFileName, ExtractionOptions options = null) { ExtractionMethods.WriteEntryToFile(entry, destinationFileName, options, (x, fm) => { using (FileStream fs = File.Open(destinationFileName, fm)) { entry.WriteTo(fs); } }); }
/// <summary> /// Extract to specific file /// </summary> public static void WriteEntryToFile(this IReader reader, string destinationFileName, ExtractionOptions options = null) { ExtractionMethods.WriteEntryToFile(reader.Entry, destinationFileName, options, (x, fm) => { using (FileStream fs = File.Open(destinationFileName, fm)) { reader.WriteEntryTo(fs); } }); }
public void ShouldReturnSentenceThatContainsTargetWord() { // Arrange string targetWord = "sentence"; string testParsingData = "Target word is not here. New sentence? It can be anywhere! Is it here? Create new sentence. Searching for target word."; string expectedResult = "New sentence Create new sentence"; var sut = new ExtractionMethods(); // Act var result = sut.Contains(targetWord, testParsingData); // Assert Assert.AreEqual(expectedResult, result); }
public void ShouldReturnTextBetweenTwoTargetWords() { // Arrange string testStartWord = "brown"; string testEndWord = "lazy"; string testParsingData = "Quick brown fox jump over the lazy dog."; string expectedResult = " fox jump over the "; var sut = new ExtractionMethods(); // Act var result = sut.Between(testStartWord, testEndWord, testParsingData); // Assert Assert.AreEqual(expectedResult, result); }
/// <summary> /// Extract to specific directory, retaining filename /// </summary> public static void WriteEntryToDirectory(this IReader reader, string destinationDirectory, ExtractionOptions?options = null) { ExtractionMethods.WriteEntryToDirectory(reader.Entry, destinationDirectory, options, reader.WriteEntryToFile); }
/// <summary> /// Extract to specific directory, retaining filename /// </summary> public static void WriteToDirectory(this IArchiveEntry entry, string destinationDirectory, ExtractionOptions options = null) { ExtractionMethods.WriteEntryToDirectory(entry, destinationDirectory, options, entry.WriteToFile); }