Changeset 12395 for branches/HiveStatistics/sources/HeuristicLab.Problems.Instances.CordeauGQAP/3.3/CordeauGQAPInstanceProvider.cs
- Timestamp:
- 05/20/15 16:41:14 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.Instances.CordeauGQAP/3.3/CordeauGQAPInstanceProvider.cs
r11205 r12395 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using System.IO; 25 using System.IO.Compression; 25 26 using System.Linq; 26 27 using System.Reflection; 27 28 using System.Text.RegularExpressions; 28 using ICSharpCode.SharpZipLib.Zip;29 29 30 30 namespace HeuristicLab.Problems.Instances.CordeauGQAP { … … 56 56 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 57 57 58 using (var instanceStream = new Zip InputStream(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)) { 60 60 yield return new CordeauGQAPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry); 61 61 } … … 66 66 var descriptor = (CordeauGQAPDataDescriptor)id; 67 67 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 68 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {68 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 69 69 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 70 using (var stream = instancesZipFile.GetInputStream(entry)) {70 using (var stream = entry.Open()) { 71 71 var parser = new CordeauGQAPParser(); 72 72 parser.Parse(stream); … … 117 117 .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success).SingleOrDefault(); 118 118 } 119 120 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {121 ZipEntry entry;122 while ((entry = zipFile.GetNextEntry()) != null) {123 yield return entry.Name;124 }125 }126 119 } 127 120 }
Note: See TracChangeset
for help on using the changeset viewer.