Changeset 7667 for branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/TrentMcConaghy/TrentMcConaghyInstanceProvider.cs
- Timestamp:
- 03/27/12 16:58:22 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/TrentMcConaghy/TrentMcConaghyInstanceProvider.cs
r7666 r7667 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.IO;25 23 using System.Linq; 26 using ICSharpCode.SharpZipLib.Zip;27 24 28 25 namespace HeuristicLab.Problems.Instances.Regression { … … 48 45 protected override string FileExtension { get { return "TrentMcConaghy"; } } 49 46 50 public override IEnumerable<IDataDescriptor> GetDataDescriptors() {51 var solutionsArchiveName = GetResourceName(FileExtension + @"\.zip");52 if (!String.IsNullOrEmpty(solutionsArchiveName)) {53 using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {54 foreach (var entry in GetZipContents(solutionsZipFile).OrderBy(x => x))55 yield return new ResourceRegressionDataDescriptor(Path.GetFileNameWithoutExtension(entry), Description, entry);56 }57 }58 }59 60 47 public override RegressionData LoadData(IDataDescriptor id) { 61 48 RegressionData regData = base.LoadData(id); … … 66 53 return regData; 67 54 } 68 69 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {70 ZipEntry entry;71 while ((entry = zipFile.GetNextEntry()) != null) {72 yield return entry.Name;73 }74 }75 55 } 76 56 }
Note: See TracChangeset
for help on using the changeset viewer.