Exemple #1
0
 /// <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);
         }
     });
 }
Exemple #2
0
 /// <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);
         }
     });
 }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
 }
Exemple #6
0
 /// <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);
 }