Free cookie consent management tool by TermsFeed Policy Generator

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

#2247 merged r11650, r11651 into stable

Location:
stable
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/HeuristicLab.Problems.Instances.VehicleRouting-3.4.csproj

    r11931 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>
  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/LiLimFormat/LiLimInstanceProvider.cs

    r11334 r11932  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    26 using System.Reflection;
    27 using System.Text.RegularExpressions;
    28 using ICSharpCode.SharpZipLib.Zip;
    2923
    3024namespace HeuristicLab.Problems.Instances.VehicleRouting {
  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/HombergerInstanceProvider.cs

    r11334 r11932  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    26 using System.Reflection;
    27 using System.Text.RegularExpressions;
    28 using ICSharpCode.SharpZipLib.Zip;
    2923
    3024namespace HeuristicLab.Problems.Instances.VehicleRouting {
  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonInstanceProvider.cs

    r11170 r11932  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    26 using System.Reflection;
    27 using System.Text.RegularExpressions;
    28 using ICSharpCode.SharpZipLib.Zip;
    2923
    3024namespace HeuristicLab.Problems.Instances.VehicleRouting {
     
    3731      get { return "Solomon test set"; }
    3832    }
    39    
     33
    4034    public override Uri WebLink {
    4135      get { return new Uri(@"http://web.cba.neu.edu/~msolomon/problems.htm"); }
  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/AugeratInstanceProvider.cs

    r11170 r11932  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    26 using System.Reflection;
    27 using System.Text.RegularExpressions;
    28 using ICSharpCode.SharpZipLib.Zip;
    2923
    3024namespace HeuristicLab.Problems.Instances.VehicleRouting {
     
    3731      get { return "Augerat test set"; }
    3832    }
    39    
     33
    4034    public override Uri WebLink {
    4135      get { return new Uri(@"http://www.branchandcut.org/VRP/data"); }
  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/ChristofidesEilonInstanceProvider.cs

    r11170 r11932  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    26 using System.Reflection;
    27 using System.Text.RegularExpressions;
    28 using ICSharpCode.SharpZipLib.Zip;
    2923
    3024namespace HeuristicLab.Problems.Instances.VehicleRouting {
     
    3731      get { return "Christofides and Eilon test set"; }
    3832    }
    39    
     33
    4034    public override Uri WebLink {
    4135      get { return new Uri(@"http://www.branchandcut.org/VRP/data"); }
  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TaillardFormat/TaillardInstanceProvider.cs

    r11170 r11932  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    26 using System.Reflection;
    27 using System.Text.RegularExpressions;
    28 using ICSharpCode.SharpZipLib.Zip;
    2923
    3024namespace HeuristicLab.Problems.Instances.VehicleRouting {
     
    3731      get { return "Taillard test set"; }
    3832    }
    39    
     33
    4034    public override Uri WebLink {
    4135      get { return new Uri(@"http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html"); }
  • stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs

    r11931 r11932  
    2323using System.Collections.Generic;
    2424using System.IO;
     25using System.IO.Compression;
    2526using System.Linq;
    2627using System.Reflection;
    2728using System.Text.RegularExpressions;
    2829using HeuristicLab.Common;
    29 using ICSharpCode.SharpZipLib.Zip;
    3030
    3131namespace HeuristicLab.Problems.Instances.VehicleRouting {
     
    3737      var solutionsArchiveName = GetResourceName(FileName + @"\.opt\.zip");
    3838      if (!String.IsNullOrEmpty(solutionsArchiveName)) {
    39         using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
    40           foreach (var entry in GetZipContents(solutionsZipFile))
    41             solutions.Add(Path.GetFileNameWithoutExtension(entry) + "." + FileName, entry);
     39        using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
     40          foreach (var entry in solutionsZipFile.Entries)
     41            solutions.Add(Path.GetFileNameWithoutExtension(entry.Name) + "." + FileName, entry.Name);
    4242        }
    4343      }
     
    4545      if (String.IsNullOrEmpty(instanceArchiveName)) yield break;
    4646
    47       using (var instanceStream = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
    48         foreach (var entry in GetZipContents(instanceStream).OrderBy(x => x, new NaturalStringComparer())) {
     47      using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
     48        foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x, new NaturalStringComparer())) {
    4949          string solutionEntry = Path.GetFileNameWithoutExtension(entry) + "." + FileName;
    5050          yield return new VRPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetInstanceDescription(), entry, solutions.ContainsKey(solutionEntry) ? solutions[solutionEntry] : String.Empty);
     
    5656      var descriptor = (VRPDataDescriptor)id;
    5757      var instanceArchiveName = GetResourceName(FileName + @"\.zip");
    58       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     58      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
    5959        var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
    60         var stream = instancesZipFile.GetInputStream(entry);
     60        var stream = entry.Open();
    6161        var instance = LoadData(stream);
    6262        if (string.IsNullOrEmpty(instance.Name)) {
     
    6666        if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) {
    6767          var solutionsArchiveName = GetResourceName(FileName + @"\.opt\.zip");
    68           using (var solutionsZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
     68          using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
    6969            entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier);
    70             stream = solutionsZipFile.GetInputStream(entry);
     70            stream = entry.Open();
    7171            LoadSolution(stream, instance);
    7272          }
     
    130130          LoadSolution(stream, instance);
    131131        }
    132       } catch (Exception) {
     132      }
     133      catch (Exception) {
    133134        // new stream necessary because first try already read from stream
    134135        using (var stream = new FileStream(path, FileMode.Open)) {
     
    149150      return "Embedded instance of plugin version " + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Cast<AssemblyFileVersionAttribute>().First().Version + ".";
    150151    }
    151 
    152     protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {
    153       ZipEntry entry;
    154       while ((entry = zipFile.GetNextEntry()) != null) {
    155         yield return entry.Name;
    156       }
    157     }
    158152    #endregion
    159153  }
Note: See TracChangeset for help on using the changeset viewer.