当前位置: 首页>>代码示例>>C#>>正文


C# ZipFile.Select方法代码示例

本文整理汇总了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>();
     }
 }
开发者ID:stevenbey,项目名称:elfar,代码行数:12,代码来源:ZipErrorLogProvider.cs

示例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);
        }
开发者ID:wurdum,项目名称:deployer,代码行数:13,代码来源:PackageManagerTests.cs

示例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));
            //}
        }
开发者ID:andywhitfield,项目名称:StatLight,代码行数:23,代码来源:XapRewriterTests.cs

示例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);
        }
开发者ID:wurdum,项目名称:deployer,代码行数:19,代码来源:PackageManagerTests.cs

示例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);
        }
开发者ID:wurdum,项目名称:deployer,代码行数:14,代码来源:PackageManagerTests.cs


注:本文中的Ionic.Zip.ZipFile.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。