Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11650 for trunk/sources


Ignore:
Timestamp:
12/04/14 12:56:57 (10 years ago)
Author:
ascheibe
Message:

#2247 switched persistence, instance providers, plugin infrastructure and MathJax to System.IO.Compression

Location:
trunk/sources
Files:
2 deleted
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs

    r11171 r11650  
    2424using System.Collections.Generic;
    2525using System.IO;
     26using System.IO.Compression;
    2627using System.Linq;
    2728using System.Threading;
     
    198199          i++;
    199200          SetEnabledStateOfContentViews(item, false);
    200           XmlGenerator.Serialize(item, ItemsPath + Path.DirectorySeparatorChar + i.ToString("00000000") + ".hl", 9);
     201          XmlGenerator.Serialize(item, ItemsPath + Path.DirectorySeparatorChar + i.ToString("00000000") + ".hl", CompressionLevel.Optimal);
    201202          OnItemSaved(item, progressBar.Maximum / listView.Items.Count);
    202203        }
  • trunk/sources/HeuristicLab.Core/3.3/PersistenceContentManager.cs

    r11171 r11650  
    2020#endregion
    2121
     22using System.IO.Compression;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Persistence.Default.Xml;
     
    3233
    3334    protected override void SaveContent(IStorableContent content, string filename, bool compressed) {
    34       XmlGenerator.Serialize(content, filename, compressed ? 9 : 0);
     35      XmlGenerator.Serialize(content, filename, compressed ? CompressionLevel.Optimal : CompressionLevel.NoCompression);
    3536    }
    3637  }
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.MathJax/1.1/HeuristicLab.MathJax-1.1/HeuristicLab.MathJax-1.1.csproj

    r11623 r11650  
    105105  </PropertyGroup>
    106106  <ItemGroup>
    107     <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
    108       <HintPath>..\..\..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>
    109       <Private>False</Private>
    110     </Reference>
    111107    <Reference Include="System" />
    112108    <Reference Include="System.Core">
    113109      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    114110    </Reference>
     111    <Reference Include="System.IO.Compression" />
     112    <Reference Include="System.IO.Compression.FileSystem" />
    115113    <Reference Include="System.Xml.Linq">
    116114      <RequiredTargetFramework>3.5</RequiredTargetFramework>
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.MathJax/1.1/HeuristicLab.MathJax-1.1/Plugin.cs.frame

    r11171 r11650  
    2121
    2222using System;
    23 using System.Collections.Generic;
     23using System.IO;
     24using System.IO.Compression;
    2425using System.Linq;
    25 using System.Text;
    26 using System.IO;
    27 
    2826using HeuristicLab.PluginInfrastructure;
    2927
     
    3836      base.OnLoad();
    3937      if (!Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory, "mathjax.js", SearchOption.TopDirectoryOnly).Any()) {
    40         var zip = new ICSharpCode.SharpZipLib.Zip.FastZip();
    41         zip.ExtractZip("mathjax.zip", AppDomain.CurrentDomain.BaseDirectory, "");
     38        ZipFile.ExtractToDirectory("mathjax.zip", AppDomain.CurrentDomain.BaseDirectory);
    4239      }
    4340    }
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs

    r11171 r11650  
    3030using HeuristicLab.Persistence.Interfaces;
    3131using HeuristicLab.Tracing;
    32 using ICSharpCode.SharpZipLib.Zip;
    3332
    3433namespace HeuristicLab.Persistence.Default.Xml {
     
    286285    /// <param name="filename">The filename.</param>
    287286    public static void Serialize(object o, string filename) {
    288       Serialize(o, filename, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, 5);
     287      Serialize(o, filename, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, CompressionLevel.Optimal);
    289288    }
    290289
     
    297296    /// <param name="filename">The filename.</param>
    298297    /// <param name="compression">ZIP file compression level</param>
    299     public static void Serialize(object o, string filename, int compression) {
     298    public static void Serialize(object o, string filename, CompressionLevel compression) {
    300299      Serialize(o, filename, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, compression);
    301300    }
     
    309308    /// <param name="config">The configuration.</param>
    310309    public static void Serialize(object obj, string filename, Configuration config) {
    311       Serialize(obj, filename, config, false, 5);
     310      Serialize(obj, filename, config, false, CompressionLevel.Optimal);
    312311    }
    313312
     
    320319    /// <param name="includeAssemblies">if set to <c>true</c> include needed assemblies.</param>
    321320    /// <param name="compression">The ZIP compression level.</param>
    322     public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies, int compression) {
     321    public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies, CompressionLevel compression) {
    323322      try {
    324323        string tempfile = Path.GetTempFileName();
     
    328327          serializer.InterleaveTypeInformation = false;
    329328          XmlGenerator generator = new XmlGenerator();
    330           using (ZipOutputStream zipStream = new ZipOutputStream(stream)) {
    331             zipStream.IsStreamOwner = false;
    332             zipStream.SetLevel(compression);
    333             zipStream.PutNextEntry(new ZipEntry("data.xml") { DateTime = DateTime.MinValue });
    334             StreamWriter writer = new StreamWriter(zipStream);
    335             foreach (ISerializationToken token in serializer) {
    336               string line = generator.Format(token);
    337               writer.Write(line);
     329          using (ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Create)) {
     330            ZipArchiveEntry entry = zipArchive.CreateEntry("data.xml", compression);
     331            using (StreamWriter writer = new StreamWriter(entry.Open())) {
     332              foreach (ISerializationToken token in serializer) {
     333                string line = generator.Format(token);
     334                writer.Write(line);
     335              }
    338336            }
    339             writer.Flush();
    340             zipStream.PutNextEntry(new ZipEntry("typecache.xml") { DateTime = DateTime.MinValue });
    341             foreach (string line in generator.Format(serializer.TypeCache)) {
    342               writer.Write(line);
     337            entry = zipArchive.CreateEntry("typecache.xml", compression);
     338            using (StreamWriter writer = new StreamWriter(entry.Open())) {
     339              foreach (string line in generator.Format(serializer.TypeCache)) {
     340                writer.Write(line);
     341              }
    343342            }
    344             writer.Flush();
    345343            if (includeAssemblies) {
    346344              foreach (string name in serializer.RequiredFiles) {
     
    350348                  continue;
    351349                }
    352                 zipStream.PutNextEntry(new ZipEntry(Path.GetFileName(uri.PathAndQuery)));
    353                 FileStream reader = File.OpenRead(uri.PathAndQuery);
    354                 byte[] buffer = new byte[1024 * 1024];
    355                 while (true) {
    356                   int bytesRead = reader.Read(buffer, 0, 1024 * 1024);
    357                   if (bytesRead == 0)
    358                     break;
    359                   zipStream.Write(buffer, 0, bytesRead);
     350                entry = zipArchive.CreateEntry(Path.GetFileName(uri.PathAndQuery), compression);
     351                using (BinaryWriter bw = new BinaryWriter(entry.Open())) {
     352                  using (FileStream reader = File.OpenRead(uri.PathAndQuery)) {
     353                    byte[] buffer = new byte[1024 * 1024];
     354                    while (true) {
     355                      int bytesRead = reader.Read(buffer, 0, 1024 * 1024);
     356                      if (bytesRead == 0)
     357                        break;
     358                      bw.Write(buffer, 0, bytesRead);
     359                    }
     360                  }
    360361                }
    361                 writer.Flush();
    362362              }
    363363            }
     
    407407        Serializer serializer = new Serializer(obj, config);
    408408        Serialize(stream, serializer);
    409       } catch (PersistenceException) {
     409      }
     410      catch (PersistenceException) {
    410411        throw;
    411       } catch (Exception e) {
     412      }
     413      catch (Exception e) {
    412414        throw new PersistenceException("Unexpected exception during Serialization.", e);
    413415      }
     
    427429        Serialize(stream, serializer);
    428430        types = serializer.SerializedTypes;
    429       } catch (PersistenceException) {
     431      }
     432      catch (PersistenceException) {
    430433        throw;
    431       } catch (Exception e) {
     434      }
     435      catch (Exception e) {
    432436        throw new PersistenceException("Unexpected exception during Serialization.", e);
    433437      }
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs

    r11171 r11650  
    2929using HeuristicLab.Persistence.Core.Tokens;
    3030using HeuristicLab.Persistence.Interfaces;
    31 using ICSharpCode.SharpZipLib.Zip;
    3231
    3332namespace HeuristicLab.Persistence.Default.Xml {
     
    193192      TimeSpan start = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;
    194193      try {
    195         using (ZipFile file = new ZipFile(filename)) {
    196           return Deserialize(file);
     194        using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) {
     195          using (ZipArchive zip = new ZipArchive(fs)) {
     196            return Deserialize(zip);
     197          }
    197198        }
    198199      }
     
    247248    }
    248249
    249     private static object Deserialize(ZipFile zipFile) {
    250       try {
    251         ZipEntry typecache = zipFile.GetEntry("typecache.xml");
    252         if (typecache == null)
    253           throw new PersistenceException("file does not contain typecache.xml");
    254         Deserializer deSerializer = new Deserializer(ParseTypeCache(new StreamReader(zipFile.GetInputStream(typecache))));
    255         ZipEntry data = zipFile.GetEntry("data.xml");
    256         if (data == null)
    257           throw new PersistenceException("file does not contain data.xml");
    258         XmlParser parser = new XmlParser(
    259           new StreamReader(zipFile.GetInputStream(data)));
    260         object result = deSerializer.Deserialize(parser);
    261         zipFile.Close();
     250    private static object Deserialize(ZipArchive zipFile) {
     251      try {
     252        ZipArchiveEntry typecache = zipFile.GetEntry("typecache.xml");
     253        if (typecache == null) throw new PersistenceException("file does not contain typecache.xml");
     254        Deserializer deSerializer;
     255        using (StreamReader sr = new StreamReader(typecache.Open())) {
     256          deSerializer = new Deserializer(ParseTypeCache(sr));
     257        }
     258
     259        ZipArchiveEntry data = zipFile.GetEntry("data.xml");
     260        if (data == null) throw new PersistenceException("file does not contain data.xml");
     261        object result;
     262        using (StreamReader sr = new StreamReader(data.Open())) {
     263          XmlParser parser = new XmlParser(sr);
     264          result = deSerializer.Deserialize(parser);
     265        }
     266
    262267        return result;
    263268      }
  • trunk/sources/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj

    r11623 r11650  
    116116  -->
    117117  <ItemGroup>
    118     <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
    119       <SpecificVersion>False</SpecificVersion>
    120       <HintPath>..\..\bin\ICSharpCode.SharpZipLib.dll</HintPath>
    121       <Private>False</Private>
    122     </Reference>
    123118    <Reference Include="System" />
    124119    <Reference Include="System.configuration" />
     
    128123    <Reference Include="System.Data" />
    129124    <Reference Include="System.Drawing" />
     125    <Reference Include="System.IO.Compression" />
    130126    <Reference Include="System.Xml" />
    131127  </ItemGroup>
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManager.cs

    r11171 r11650  
    2323using System.Collections.Generic;
    2424using System.IO;
     25using System.IO.Compression;
    2526using System.Linq;
    2627using System.ServiceModel;
    2728using HeuristicLab.PluginInfrastructure.Manager;
    28 using ICSharpCode.SharpZipLib.Zip;
    2929
    3030namespace HeuristicLab.PluginInfrastructure.Advanced {
     
    183183
    184184    private void Unpack(byte[] zippedPackage) {
    185       using (ZipInputStream s = new ZipInputStream(new MemoryStream(zippedPackage))) {
    186         ZipEntry theEntry;
    187         while ((theEntry = s.GetNextEntry()) != null) {
    188           string directoryName = pluginDir;
    189           string fileName = Path.GetFileName(theEntry.Name);
    190           // create directory
    191           if (!string.IsNullOrEmpty(directoryName)) {
    192             Directory.CreateDirectory(directoryName);
    193           }
    194           if (!string.IsNullOrEmpty(fileName)) {
    195             string fullPath = Path.Combine(directoryName, fileName);
    196             string fullDirPath = Path.GetDirectoryName(fullPath);
    197             if (!Directory.Exists(fullDirPath)) Directory.CreateDirectory(fullDirPath);
    198             using (FileStream streamWriter = File.Create(fullPath)) {
    199               int size = 2048;
    200               byte[] data = new byte[2048];
    201               while (true) {
    202                 size = s.Read(data, 0, data.Length);
    203                 if (size > 0) {
    204                   streamWriter.Write(data, 0, size);
    205                 } else {
    206                   break;
     185      using (MemoryStream memStream = new MemoryStream(zippedPackage)) {
     186        using (ZipArchive zip = new ZipArchive(memStream, ZipArchiveMode.Read)) {
     187          foreach (var theEntry in zip.Entries) {
     188            string directoryName = pluginDir;
     189            string fileName = Path.GetFileName(theEntry.Name);
     190            // create directory
     191            if (!string.IsNullOrEmpty(directoryName)) {
     192              Directory.CreateDirectory(directoryName);
     193            }
     194            if (!string.IsNullOrEmpty(fileName)) {
     195              string fullPath = Path.Combine(directoryName, fileName);
     196              string fullDirPath = Path.GetDirectoryName(fullPath);
     197              if (!Directory.Exists(fullDirPath)) Directory.CreateDirectory(fullDirPath);
     198              using (FileStream streamWriter = File.Create(fullPath)) {
     199                int size = 2048;
     200                byte[] data = new byte[2048];
     201
     202                using (BinaryReader reader = new BinaryReader(theEntry.Open())) {
     203                  while (true) {
     204                    size = reader.Read(data, 0, data.Length);
     205                    if (size > 0) {
     206                      streamWriter.Write(data, 0, size);
     207                    } else {
     208                      break;
     209                    }
     210                  }
    207211                }
     212                streamWriter.Close();
    208213              }
    209               streamWriter.Close();
    210214            }
    211215          }
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/UploadPluginsView.cs

    r11171 r11650  
    2525using System.Drawing;
    2626using System.IO;
     27using System.IO.Compression;
    2728using System.Linq;
    2829using System.ServiceModel;
    2930using System.Windows.Forms;
    3031using HeuristicLab.PluginInfrastructure.Manager;
    31 using ICSharpCode.SharpZipLib.Zip;
    3232
    3333namespace HeuristicLab.PluginInfrastructure.Advanced {
     
    262262    private static byte[] CreateZipPackage(IPluginDescription plugin) {
    263263      using (MemoryStream stream = new MemoryStream()) {
    264         ZipFile zipFile = new ZipFile(stream);
    265         zipFile.BeginUpdate();
     264        ZipArchive zipFile = new ZipArchive(stream, ZipArchiveMode.Create);
    266265        foreach (var file in plugin.Files) {
    267           zipFile.Add(file.Name);
    268         }
    269         zipFile.CommitUpdate();
     266          zipFile.CreateEntry(file.Name);
     267        }
    270268        stream.Seek(0, SeekOrigin.Begin);
    271269        return stream.GetBuffer();
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r11623 r11650  
    114114    <Reference Include="System.Drawing" />
    115115    <Reference Include="System.IdentityModel" />
     116    <Reference Include="System.IO.Compression" />
    116117    <Reference Include="System.Runtime.Serialization" />
    117118    <Reference Include="System.ServiceModel" />
    118119    <Reference Include="System.Windows.Forms" />
    119120    <Reference Include="System.Xml" />
    120     <Reference Include="ICSharpCode.SharpZipLib">
    121       <HintPath>ICSharpCode.SharpZipLib.dll</HintPath>
    122     </Reference>
    123121  </ItemGroup>
    124122  <ItemGroup>
     
    316314  </ItemGroup>
    317315  <ItemGroup>
    318     <Content Include="ICSharpCode.SharpZipLib License.txt">
    319       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    320     </Content>
    321     <Content Include="ICSharpCode.SharpZipLib.dll">
    322       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    323     </Content>
    324316    <EmbeddedResource Include="Advanced\DeploymentService\services.heuristiclab.com.cer" />
    325317    <None Include="Resources\Error.ico" />
  • trunk/sources/HeuristicLab.Problems.Instances.CordeauGQAP/3.3/CordeauGQAPInstanceProvider.cs

    r11171 r11650  
    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.CordeauGQAP {
     
    5656      if (String.IsNullOrEmpty(instanceArchiveName)) yield break;
    5757
    58       using (var instanceStream = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
    59         foreach (var entry in GetZipContents(instanceStream).OrderBy(x => x)) {
     58      using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
     59        foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) {
    6060          yield return new CordeauGQAPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry);
    6161        }
     
    6666      var descriptor = (CordeauGQAPDataDescriptor)id;
    6767      var instanceArchiveName = GetResourceName(FileName + @"\.zip");
    68       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     68      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
    6969        var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
    70         using (var stream = instancesZipFile.GetInputStream(entry)) {
     70        using (var stream = entry.Open()) {
    7171          var parser = new CordeauGQAPParser();
    7272          parser.Parse(stream);
     
    117117              .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success).SingleOrDefault();
    118118    }
    119 
    120     protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {
    121       ZipEntry entry;
    122       while ((entry = zipFile.GetNextEntry()) != null) {
    123         yield return entry.Name;
    124       }
    125     }
    126119  }
    127120}
  • trunk/sources/HeuristicLab.Problems.Instances.CordeauGQAP/3.3/HeuristicLab.Problems.Instances.CordeauGQAP-3.3.csproj

    r11623 r11650  
    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>
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ResourceClassificationInstanceProvider.cs

    r11171 r11650  
    2323using System.Globalization;
    2424using System.IO;
     25using System.IO.Compression;
    2526using System.Linq;
    2627using System.Reflection;
    2728using System.Text.RegularExpressions;
    2829using HeuristicLab.Problems.DataAnalysis;
    29 using ICSharpCode.SharpZipLib.Zip;
    3030
    3131namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    3838
    3939      var instanceArchiveName = GetResourceName(FileName + @"\.zip");
    40       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     40      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
    4141        var entry = instancesZipFile.GetEntry(descriptor.ResourceName);
    4242        NumberFormatInfo numberFormat;
    4343        DateTimeFormatInfo dateFormat;
    4444        char separator;
    45         using (Stream stream = instancesZipFile.GetInputStream(entry)) {
     45        using (Stream stream = entry.Open()) {
    4646          TableFileParser.DetermineFileFormat(stream, out numberFormat, out dateFormat, out separator);
    4747        }
    4848
    4949        TableFileParser csvFileParser = new TableFileParser();
    50         using (Stream stream = instancesZipFile.GetInputStream(entry)) {
     50        using (Stream stream = entry.Open()) {
    5151          csvFileParser.Parse(stream, numberFormat, dateFormat, separator, true);
    5252        }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/UCI/UCIInstanceProvider.cs

    r11171 r11650  
    2323using System.Collections.Generic;
    2424using System.IO;
     25using System.IO.Compression;
    2526using System.Linq;
    26 using ICSharpCode.SharpZipLib.Zip;
    2727
    2828namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    5656      var solutionsArchiveName = GetResourceName(FileName + @"\.zip");
    5757      if (!String.IsNullOrEmpty(solutionsArchiveName)) {
    58         using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
     58        using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
    5959          IList<string> entries = new List<string>();
    60           ZipEntry curEntry;
    61           while ((curEntry = solutionsZipFile.GetNextEntry()) != null) {
     60          foreach (var curEntry in solutionsZipFile.Entries) {
    6261            entries.Add(curEntry.Name);
    6362          }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj

    r11623 r11650  
    105105  </PropertyGroup>
    106106  <ItemGroup>
    107     <Reference Include="ICSharpCode.SharpZipLib">
    108       <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>
    109       <Private>False</Private>
    110     </Reference>
    111107    <Reference Include="System" />
    112108    <Reference Include="System.Core" />
    113109    <Reference Include="System.Drawing" />
     110    <Reference Include="System.IO.Compression" />
    114111    <Reference Include="System.Windows.Forms" />
    115112    <Reference Include="System.Xml.Linq" />
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RealWorld/RealWorldRegressionInstanceProvider.cs

    r11171 r11650  
    2323using System.Collections.Generic;
    2424using System.IO;
     25using System.IO.Compression;
    2526using System.Linq;
    26 using ICSharpCode.SharpZipLib.Zip;
    2727
    2828namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    5252      var solutionsArchiveName = GetResourceName(FileName + @"\.zip");
    5353      if (!String.IsNullOrEmpty(solutionsArchiveName)) {
    54         using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
     54        using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
    5555          IList<string> entries = new List<string>();
    56           ZipEntry curEntry;
    57           while ((curEntry = solutionsZipFile.GetNextEntry()) != null) {
     56          foreach (var curEntry in solutionsZipFile.Entries) {
    5857            entries.Add(curEntry.Name);
    5958          }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ResourceRegressionInstanceProvider.cs

    r11171 r11650  
    2323using System.Globalization;
    2424using System.IO;
     25using System.IO.Compression;
    2526using System.Linq;
    2627using System.Reflection;
    2728using System.Text.RegularExpressions;
    2829using HeuristicLab.Problems.DataAnalysis;
    29 using ICSharpCode.SharpZipLib.Zip;
    3030
    3131namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    3838
    3939      var instanceArchiveName = GetResourceName(FileName + @"\.zip");
    40       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     40      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
    4141        var entry = instancesZipFile.GetEntry(descriptor.ResourceName);
    4242        NumberFormatInfo numberFormat;
    4343        DateTimeFormatInfo dateFormat;
    4444        char separator;
    45         using (Stream stream = instancesZipFile.GetInputStream(entry)) {
     45        using (Stream stream = entry.Open()) {
    4646          TableFileParser.DetermineFileFormat(stream, out numberFormat, out dateFormat, out separator);
    4747        }
    4848
    4949        TableFileParser csvFileParser = new TableFileParser();
    50         using (Stream stream = instancesZipFile.GetInputStream(entry)) {
     50        using (Stream stream = entry.Open()) {
    5151          csvFileParser.Parse(stream, numberFormat, dateFormat, separator, true);
    5252        }
  • trunk/sources/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/ElloumiCTAPInstanceProvider.cs

    r11171 r11650  
    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}
  • trunk/sources/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj

    r11623 r11650  
    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>
  • trunk/sources/HeuristicLab.Problems.Instances.QAPLIB/3.3/HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj

    r11623 r11650  
    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>
  • trunk/sources/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstanceProvider.cs

    r11171 r11650  
    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.QAPLIB {
     
    3434    protected virtual HashSet<string> ReversedSolutions {
    3535      get {
    36             return new HashSet<string>(new string[] {
     36        return new HashSet<string>(new string[] {
    3737              "bur26a",
    3838              "bur26b",
     
    177177      var solutionsArchiveName = GetResourceName(FileName + @"\.sln\.zip");
    178178      if (!String.IsNullOrEmpty(solutionsArchiveName)) {
    179         using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
    180           foreach (var entry in GetZipContents(solutionsZipFile))
    181             solutions.Add(Path.GetFileNameWithoutExtension(entry) + ".dat", entry);
     179        using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
     180          foreach (var entry in solutionsZipFile.Entries)
     181            solutions.Add(Path.GetFileNameWithoutExtension(entry.Name) + ".dat", entry.Name);
    182182        }
    183183      }
     
    185185      if (String.IsNullOrEmpty(instanceArchiveName)) yield break;
    186186
    187       using (var instanceStream = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
    188         foreach (var entry in GetZipContents(instanceStream).OrderBy(x => x)) {
     187      using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
     188        foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) {
    189189          yield return new QAPLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty);
    190190        }
     
    195195      var descriptor = (QAPLIBDataDescriptor)id;
    196196      var instanceArchiveName = GetResourceName(FileName + @"\.dat\.zip");
    197       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     197      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
    198198        var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
    199199
    200         using (var stream = instancesZipFile.GetInputStream(entry)) {
     200        using (var stream = entry.Open()) {
    201201          var parser = new QAPLIBParser();
    202202          parser.Parse(stream);
     
    207207          if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) {
    208208            var solutionsArchiveName = GetResourceName(FileName + @"\.sln\.zip");
    209             using (var solutionsZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
     209            using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
    210210              entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier);
    211               using (var solStream = solutionsZipFile.GetInputStream(entry)) {
     211              using (var solStream = entry.Open()) {
    212212                var slnParser = new QAPLIBSolutionParser();
    213213                slnParser.Parse(solStream, true);
     
    258258              .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success).SingleOrDefault();
    259259    }
    260 
    261     protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {
    262       ZipEntry entry;
    263       while ((entry = zipFile.GetNextEntry()) != null) {
    264         yield return entry.Name;
    265       }
    266     }
    267260  }
    268261}
  • trunk/sources/HeuristicLab.Problems.Instances.Scheduling/3.3/HeuristicLab.Problems.Instances.Scheduling-3.3.csproj

    r11623 r11650  
    113113      <Private>False</Private>
    114114    </Reference>
    115     <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369">
    116       <HintPath>..\bin\ICSharpCode.SharpZipLib.dll</HintPath>
    117       <Private>False</Private>
    118     </Reference>
    119115    <Reference Include="System" />
    120116    <Reference Include="System.Core" />
    121117    <Reference Include="System.Data" />
     118    <Reference Include="System.IO.Compression" />
    122119  </ItemGroup>
    123120  <ItemGroup>
  • trunk/sources/HeuristicLab.Problems.Instances.Scheduling/3.3/JSSPORLIBInstanceProvider.cs

    r11171 r11650  
    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.Scheduling {
     
    5151      if (String.IsNullOrEmpty(instanceArchiveName)) yield break;
    5252
    53       using (var instanceStream = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
    54         foreach (var entry in GetZipContents(instanceStream).OrderBy(x => x)) {
     53      using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
     54        foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) {
    5555          yield return new JSSPORLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry, null);
    5656        }
     
    6161      var descriptor = (JSSPORLIBDataDescriptor)id;
    6262      var instanceArchiveName = GetResourceName("JSSPORLIB.zip");
    63       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     63      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
    6464        var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
    6565
    66         using (var stream = instancesZipFile.GetInputStream(entry)) {
     66        using (var stream = entry.Open()) {
    6767          var parser = new JSSPORLIBParser();
    6868          parser.Parse(stream);
     
    124124        .SingleOrDefault(x => Regex.Match(x, @".*\.Data\." + fileName).Success);
    125125    }
    126 
    127     protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {
    128       ZipEntry entry;
    129       while ((entry = zipFile.GetNextEntry()) != null) {
    130         yield return entry.Name;
    131       }
    132     }
    133126  }
    134127}
  • trunk/sources/HeuristicLab.Problems.Instances.TSPLIB/3.3/HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj

    r11623 r11650  
    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>
  • trunk/sources/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBInstanceProvider.cs

    r11171 r11650  
    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.TSPLIB {
     
    5252      var solutionsArchiveName = GetResourceName(FileExtension + @"\.opt\.tour\.zip");
    5353      if (!String.IsNullOrEmpty(solutionsArchiveName)) {
    54         using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
    55           foreach (var entry in GetZipContents(solutionsZipFile))
    56             solutions.Add(entry.Substring(0, entry.Length - ".opt.tour".Length) + "." + FileExtension, entry);
     54        using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
     55          foreach (var entry in solutionsZipFile.Entries)
     56            solutions.Add(entry.Name.Substring(0, entry.Name.Length - ".opt.tour".Length) + "." + FileExtension, entry.Name);
    5757        }
    5858      }
     
    6060      if (String.IsNullOrEmpty(instanceArchiveName)) yield break;
    6161
    62       using (var instanceStream = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
    63         foreach (var entry in GetZipContents(instanceStream).OrderBy(x => x)) {
     62      using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
     63        foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) {
    6464          yield return new TSPLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetInstanceDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty);
    6565        }
     
    7070      var descriptor = (TSPLIBDataDescriptor)id;
    7171      var instanceArchiveName = GetResourceName(FileExtension + @"\.zip");
    72       using (var instancesZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {
     72      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
    7373        var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
    74         var stream = instancesZipFile.GetInputStream(entry);
     74        var stream = entry.Open();
    7575        var parser = new TSPLIBParser(stream);
    7676        var instance = LoadInstance(parser);
     
    7878        if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) {
    7979          var solutionsArchiveName = GetResourceName(FileExtension + @"\.opt\.tour\.zip");
    80           using (var solutionsZipFile = new ZipFile(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
     80          using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) {
    8181            entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier);
    82             stream = solutionsZipFile.GetInputStream(entry);
     82            stream = entry.Open();
    8383            parser = new TSPLIBParser(stream);
    8484            LoadSolution(parser, instance);
     
    105105      return "Embedded instance of plugin version " + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Cast<AssemblyFileVersionAttribute>().First().Version + ".";
    106106    }
    107 
    108     protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {
    109       ZipEntry entry;
    110       while ((entry = zipFile.GetNextEntry()) != null) {
    111         yield return entry.Name;
    112       }
    113     }
    114107  }
    115108}
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/HeuristicLab.Problems.Instances.VehicleRouting-3.4.csproj

    r11623 r11650  
    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>
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/LiLimFormat/LiLimInstanceProvider.cs

    r11280 r11650  
    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 {
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/HombergerInstanceProvider.cs

    r11280 r11650  
    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 {
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonInstanceProvider.cs

    r11171 r11650  
    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"); }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/AugeratInstanceProvider.cs

    r11171 r11650  
    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"); }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/ChristofidesEilonInstanceProvider.cs

    r11171 r11650  
    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"); }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TaillardFormat/TaillardInstanceProvider.cs

    r11171 r11650  
    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"); }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs

    r11478 r11650  
    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.