示例#1
0
        public virtual IArchiveEntry GetEntry(string entryName)
        {
            if (!CanRead)
            {
                throw new InvalidOperationException(Properties.ExceptionMessages.ArchiveIsWriteOnly);
            }

            entryName = SanitizeEntryName(entryName);

            return(GetEntries().Where(entry => PathUtilities.AreEqual(SanitizeEntryName(entry.Name), entryName))
                   .FirstOrDefault());
        }
示例#2
0
 public void TestAreNotEqualWithUnequalPaths()
 {
     Assert.IsFalse(PathUtilities.AreEqual(@"C:\path\to\", @"C:\path\to\directory\"));
 }
示例#3
0
 public void TestAreEqualWithEqualPathsWithMixedCase()
 {
     Assert.IsTrue(PathUtilities.AreEqual(@"C:\path\TO\directory\", @"C:\path\to\DIRECTORY\"));
 }
示例#4
0
 public void TestAreEqualWithEqualPathsWithMixedDirectorySeparator()
 {
     Assert.IsTrue(PathUtilities.AreEqual(@"C:/path\to/directory\", @"C:/path/to\directory\"));
 }
示例#5
0
 public void TestAreEqualWithSecondPathEmpty()
 {
     Assert.IsFalse(PathUtilities.AreEqual(@"C:\path\to\directory\", string.Empty));
 }
示例#6
0
 public void TestAreEqualWithFirstPathEmpty()
 {
     Assert.IsFalse(PathUtilities.AreEqual(string.Empty, @"C:\path\to\directory\"));
 }
示例#7
0
 public void TestAreEqualWithBothPathsEmpty()
 {
     Assert.IsTrue(PathUtilities.AreEqual(string.Empty, string.Empty));
 }