Ignore:
Timestamp:
02/06/15 10:08:54 (5 years ago)
Author:
ascheibe
Message:

#2247 merged r11650, r11651 into stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/ElloumiCTAPInstanceProvider.cs

    r11170 r11932  
    2323using System.Collections.Generic;
    2424using System.IO;
     25using System.IO.Compression;
    2526using System.Linq;
    2627using System.Reflection;
    2728using System.Text.RegularExpressions;
    28 using ICSharpCode.SharpZipLib.Zip;
    2929
    3030namespace HeuristicLab.Problems.Instances.ElloumiCTAP {
     
    5656      var solutionsArchiveName = GetResourceName(FileName + @"\.sol\.zip");
    5757      if (!String.IsNullOrEmpty(solutionsArchiveName)) {
    58         using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
    59           foreach (var entry in GetZipContents(solutionsZipFile))
    60             solutions.Add(Path.GetFileNameWithoutExtension(entry) + ".dat", entry);
     58        using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
     59          foreach (var entry in solutionsZipFile.Entries)
     60            solutions.Add(Path.GetFileNameWithoutExtension(entry.Name) + ".dat", entry.Name);
    6161        }
    6262      }
     
    6464      if (String.IsNullOrEmpty(instanceArchiveName)) yield break;
    6565
    66       using (var instanceStream = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
    67         foreach (var entry in GetZipContents(instanceStream).OrderBy(x => x)) {
     66      using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
     67        foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) {
    6868          yield return new ElloumiCTAPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty);
    6969        }
     
    7474      var descriptor = (ElloumiCTAPDataDescriptor)id;
    7575      var instanceArchiveName = GetResourceName(FileName + @"\.dat\.zip");
    76       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     76      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
    7777        var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
    78         using (var stream = instancesZipFile.GetInputStream(entry)) {
     78        using (var stream = entry.Open()) {
    7979          var parser = new ElloumiCTAPParser();
    8080          parser.Parse(stream);
     
    8686          if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) {
    8787            var solutionsArchiveName = GetResourceName(FileName + @"\.sol\.zip");
    88             using (var solutionsZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
     88            using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
    8989              entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier);
    90               using (var solStream = solutionsZipFile.GetInputStream(entry)) {
     90              using (var solStream = entry.Open()) {
    9191                ElloumiCTAPSolutionParser slnParser = new ElloumiCTAPSolutionParser();
    9292                slnParser.Parse(solStream, instance.MemoryRequirements.Length);
     
    138138              .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success).SingleOrDefault();
    139139    }
    140 
    141     protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {
    142       ZipEntry entry;
    143       while ((entry = zipFile.GetNextEntry()) != null) {
    144         yield return entry.Name;
    145       }
    146     }
    147140  }
    148141}
  • stable/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj

    r11920 r11932  
    109109  </PropertyGroup>
    110110  <ItemGroup>
    111     <Reference Include="ICSharpCode.SharpZipLib">
    112       <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>
    113       <Private>False</Private>
    114     </Reference>
    115111    <Reference Include="System" />
    116112    <Reference Include="System.Core" />
    117113    <Reference Include="System.Data" />
     114    <Reference Include="System.IO.Compression" />
    118115  </ItemGroup>
    119116  <ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.