Changeset 12395 for branches/HiveStatistics/sources/HeuristicLab.Problems.Instances.Scheduling/3.3/JSSPORLIBInstanceProvider.cs
- Timestamp:
- 05/20/15 16:41:14 (9 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.Scheduling/3.3/JSSPORLIBInstanceProvider.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.Scheduling { … … 51 51 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 52 52 53 using (var instanceStream = new Zip InputStream(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)) { 55 55 yield return new JSSPORLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry, null); 56 56 } … … 61 61 var descriptor = (JSSPORLIBDataDescriptor)id; 62 62 var instanceArchiveName = GetResourceName("JSSPORLIB.zip"); 63 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {63 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 64 64 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 65 65 66 using (var stream = instancesZipFile.GetInputStream(entry)) {66 using (var stream = entry.Open()) { 67 67 var parser = new JSSPORLIBParser(); 68 68 parser.Parse(stream); … … 124 124 .SingleOrDefault(x => Regex.Match(x, @".*\.Data\." + fileName).Success); 125 125 } 126 127 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {128 ZipEntry entry;129 while ((entry = zipFile.GetNextEntry()) != null) {130 yield return entry.Name;131 }132 }133 126 } 134 127 }
Note: See TracChangeset
for help on using the changeset viewer.