本文整理汇总了C#中Ionic.Zip.ZipFile.Select方法的典型用法代码示例。如果您正苦于以下问题:C# ZipFile.Select方法的具体用法?C# ZipFile.Select怎么用?C# ZipFile.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ionic.Zip.ZipFile
的用法示例。
在下文中一共展示了ZipFile.Select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: List
public override IList<ErrorLog> List()
{
try
{
using(var zip = new ZipFile(Path))
return new List<ErrorLog>(zip.Select(ErrorLog).OrderByDescending(e => e.Time));
}
catch(Exception)
{
return new List<ErrorLog>();
}
}
示例2: BytesToZipTest
public void BytesToZipTest()
{
var tempZip = Path.Combine(_confSection.Settings.Paths.Surveys, _surveyDir + ".zip");
using (var zipFileStream = new FileStream(_pathToZipForInstall, FileMode.Open, FileAccess.Read))
_packageManager.BytesToZip(ReadStreamToEnd(zipFileStream), tempZip);
var filesInZipFromBytes = new List<string>();
using (var zip = new ZipFile(tempZip) { UseUnicodeAsNecessary = true })
filesInZipFromBytes.AddRange(zip.Select(file => file.FileName));
CollectionAssert.AreEquivalent(_filesInInstallZip, filesInZipFromBytes);
}
示例3: AssertZipsEqual
private static void AssertZipsEqual(ZipFile expected, ZipFile actual)
{
actual.Count.ShouldEqual(expected.Count, "zip files contain different counts");
var allFiles = actual.Select(s => s.FileName).ToArray();
foreach (var expectedFile in expected)
{
string firstOrDefault = allFiles.Where(w => w.Equals(expectedFile.FileName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
firstOrDefault.ShouldNotBeNull("Could not find file {0} in files \n{1}".FormatWith(
expectedFile.FileName,
string.Join(Environment.NewLine, allFiles)));
//allFiles.Contains(expectedFile.FileName).ShouldBeTrue();
}
//for (int i = 0; i < expected.Count; i++)
//{
// var expectedFile = expected[i];
// var actualFile = actual[i];
//
// actualFile.FileName.ShouldEqual(expectedFile.FileName);
// //actualFile.ToByteArray().ShouldEqual(expectedFile.ToByteArray(), "File [{0}] bytes not same.".FormatWith(actualFile.FileName));
//}
}
示例4: CreateTestEnvironment
public void CreateTestEnvironment()
{
_surveyDir = "TestSurvey" + TestUtils.GetPostfix();
_confSection = DeployerConfigurationSection.Instance;
_packageManager = new PackageManager();
var pathToZipsForTests = _confSection.Settings.Paths.Uploads;
_pathToFolderForDeploy = _confSection.Settings.Paths.Surveys;
_pathToZipForInstall = Path.Combine(pathToZipsForTests, "TestSurvey.zip");
_pathToZipForUpdate = Path.Combine(pathToZipsForTests, "TestSurveyUpd.zip");
_pathToZipForUpdateOnlyBin = Path.Combine(pathToZipsForTests, "TestSurveyUpdOnlyBin.zip");
_pathToZipForUpdateOnlyAppData = Path.Combine(pathToZipsForTests, "TestSurveyUpdOnlyAppData.zip");
_filesInInstallZip = new List<string>();
using (var zip = new ZipFile(_pathToZipForInstall) { UseUnicodeAsNecessary = true })
_filesInInstallZip.AddRange(zip.Select(file => file.FileName));
Directory.CreateDirectory(_pathToFolderForDeploy);
}
示例5: FolderToZipTest
public void FolderToZipTest()
{
var tempZip = Path.Combine(_confSection.Settings.Paths.Surveys, _surveyDir + ".zip");
var pathToSurvey = Path.Combine(_confSection.Settings.Paths.Surveys, _surveyDir);
_packageManager.UnpackZipSilently(_pathToZipForInstall, pathToSurvey);
_packageManager.FolderToZip(pathToSurvey, tempZip);
var filesInNewZip = new List<string>();
using (var zip = new ZipFile(tempZip) { UseUnicodeAsNecessary = true })
filesInNewZip.AddRange(zip.Select(file => file.FileName));
CollectionAssert.AreEquivalent(_filesInInstallZip, filesInNewZip);
}