Changeset 11932
- Timestamp:
- 02/06/15 10:08:54 (10 years ago)
- Location:
- stable
- Files:
-
- 4 deleted
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 11650-11651
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.Hive.Slave.ConsoleClient/3.3/app.config
r11920 r11932 80 80 <setting name="PluginInfrastructureDll" serializeAs="String"> 81 81 <value>HeuristicLab.PluginInfrastructure-3.3.dll</value> 82 </setting>83 <setting name="SharpZipLibDll" serializeAs="String">84 <value>ICSharpCode.SharpZipLib.dll</value>85 </setting>86 <setting name="SharpZipLibLicense" serializeAs="String">87 <value>ICSharpCode.SharpZipLib License.txt</value>88 82 </setting> 89 83 <setting name="ClientsHiveSlaveCoreDll" serializeAs="String"> -
stable/HeuristicLab.Clients.Hive.Slave.WindowsService/3.3/app.config
r11920 r11932 80 80 <setting name="PluginInfrastructureDll" serializeAs="String"> 81 81 <value>HeuristicLab.PluginInfrastructure-3.3.dll</value> 82 </setting>83 <setting name="SharpZipLibDll" serializeAs="String">84 <value>ICSharpCode.SharpZipLib.dll</value>85 </setting>86 <setting name="SharpZipLibLicense" serializeAs="String">87 <value>ICSharpCode.SharpZipLib License.txt</value>88 82 </setting> 89 83 <setting name="ClientsHiveSlaveCoreDll" serializeAs="String"> -
stable/HeuristicLab.Clients.Hive.Slave/3.3/HeuristicLab.Clients.Hive.Slave-3.3.csproj
r11920 r11932 183 183 <None Include="HeuristicLab.snk" /> 184 184 </ItemGroup> 185 <ItemGroup>186 <Content Include="ICSharpCode.SharpZipLib License.txt">187 <CopyToOutputDirectory>Always</CopyToOutputDirectory>188 </Content>189 </ItemGroup>190 185 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 191 186 <PropertyGroup> -
stable/HeuristicLab.Clients.Hive.Slave/3.3/Manager/PluginManager.cs
r11170 r11932 113 113 string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 114 114 CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.PluginInfrastructureDll); 115 CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.SharpZipLibDll);116 CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.SharpZipLibLicense);117 115 118 116 // copy slave plugins, otherwise its not possible to register the UnhandledException handler to the appdomain -
stable/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs
r11920 r11932 86 86 [global::System.Configuration.UserScopedSettingAttribute()] 87 87 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 88 [global::System.Configuration.DefaultSettingValueAttribute("ICSharpCode.SharpZipLib.dll")]89 public string SharpZipLibDll {90 get {91 return ((string)(this["SharpZipLibDll"]));92 }93 set {94 this["SharpZipLibDll"] = value;95 }96 }97 98 [global::System.Configuration.UserScopedSettingAttribute()]99 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]100 [global::System.Configuration.DefaultSettingValueAttribute("ICSharpCode.SharpZipLib License.txt")]101 public string SharpZipLibLicense {102 get {103 return ((string)(this["SharpZipLibLicense"]));104 }105 set {106 this["SharpZipLibLicense"] = value;107 }108 }109 110 [global::System.Configuration.UserScopedSettingAttribute()]111 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]112 88 [global::System.Configuration.DefaultSettingValueAttribute("HeuristicLab.Clients.Hive.SlaveCore-3.3.dll")] 113 89 public string ClientsHiveSlaveCoreDll { -
stable/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings
r9700 r11932 17 17 <Setting Name="PluginInfrastructureDll" Type="System.String" Scope="User"> 18 18 <Value Profile="(Default)">HeuristicLab.PluginInfrastructure-3.3.dll</Value> 19 </Setting>20 <Setting Name="SharpZipLibDll" Type="System.String" Scope="User">21 <Value Profile="(Default)">ICSharpCode.SharpZipLib.dll</Value>22 </Setting>23 <Setting Name="SharpZipLibLicense" Type="System.String" Scope="User">24 <Value Profile="(Default)">ICSharpCode.SharpZipLib License.txt</Value>25 19 </Setting> 26 20 <Setting Name="ClientsHiveSlaveCoreDll" Type="System.String" Scope="User"> -
stable/HeuristicLab.Clients.Hive.Slave/3.3/app.config
r11920 r11932 80 80 <setting name="PluginInfrastructureDll" serializeAs="String"> 81 81 <value>HeuristicLab.PluginInfrastructure-3.3.dll</value> 82 </setting>83 <setting name="SharpZipLibDll" serializeAs="String">84 <value>ICSharpCode.SharpZipLib.dll</value>85 </setting>86 <setting name="SharpZipLibLicense" serializeAs="String">87 <value>ICSharpCode.SharpZipLib License.txt</value>88 82 </setting> 89 83 <setting name="ClientsHiveSlaveCoreDll" serializeAs="String"> -
stable/HeuristicLab.Core.Views/3.3/Clipboard.cs
r11170 r11932 24 24 using System.Collections.Generic; 25 25 using System.IO; 26 using System.IO.Compression; 26 27 using System.Linq; 27 28 using System.Threading; … … 198 199 i++; 199 200 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); 201 202 OnItemSaved(item, progressBar.Maximum / listView.Items.Count); 202 203 } -
stable/HeuristicLab.Core/3.3/PersistenceContentManager.cs
r11170 r11932 20 20 #endregion 21 21 22 using System.IO.Compression; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Persistence.Default.Xml; … … 32 33 33 34 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); 35 36 } 36 37 } -
stable/HeuristicLab.ExtLibs
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.ExtLibs merged: 11650
- Property svn:mergeinfo changed
-
stable/HeuristicLab.ExtLibs/HeuristicLab.MathJax/1.1/HeuristicLab.MathJax-1.1/HeuristicLab.MathJax-1.1.csproj
r11920 r11932 105 105 </PropertyGroup> 106 106 <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>111 107 <Reference Include="System" /> 112 108 <Reference Include="System.Core"> 113 109 <RequiredTargetFramework>3.5</RequiredTargetFramework> 114 110 </Reference> 111 <Reference Include="System.IO.Compression" /> 112 <Reference Include="System.IO.Compression.FileSystem" /> 115 113 <Reference Include="System.Xml.Linq"> 116 114 <RequiredTargetFramework>3.5</RequiredTargetFramework> -
stable/HeuristicLab.ExtLibs/HeuristicLab.MathJax/1.1/HeuristicLab.MathJax-1.1/Plugin.cs.frame
r11170 r11932 21 21 22 22 using System; 23 using System.Collections.Generic; 23 using System.IO; 24 using System.IO.Compression; 24 25 using System.Linq; 25 using System.Text;26 using System.IO;27 28 26 using HeuristicLab.PluginInfrastructure; 29 27 … … 38 36 base.OnLoad(); 39 37 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); 42 39 } 43 40 } -
stable/HeuristicLab.Persistence
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Persistence merged: 11650
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r11170 r11932 30 30 using HeuristicLab.Persistence.Interfaces; 31 31 using HeuristicLab.Tracing; 32 using ICSharpCode.SharpZipLib.Zip;33 32 34 33 namespace HeuristicLab.Persistence.Default.Xml { … … 286 285 /// <param name="filename">The filename.</param> 287 286 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); 289 288 } 290 289 … … 297 296 /// <param name="filename">The filename.</param> 298 297 /// <param name="compression">ZIP file compression level</param> 299 public static void Serialize(object o, string filename, intcompression) {298 public static void Serialize(object o, string filename, CompressionLevel compression) { 300 299 Serialize(o, filename, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, compression); 301 300 } … … 309 308 /// <param name="config">The configuration.</param> 310 309 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); 312 311 } 313 312 … … 320 319 /// <param name="includeAssemblies">if set to <c>true</c> include needed assemblies.</param> 321 320 /// <param name="compression">The ZIP compression level.</param> 322 public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies, intcompression) {321 public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies, CompressionLevel compression) { 323 322 try { 324 323 string tempfile = Path.GetTempFileName(); … … 328 327 serializer.InterleaveTypeInformation = false; 329 328 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 } 338 336 } 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 } 343 342 } 344 writer.Flush();345 343 if (includeAssemblies) { 346 344 foreach (string name in serializer.RequiredFiles) { … … 350 348 continue; 351 349 } 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 } 360 361 } 361 writer.Flush();362 362 } 363 363 } … … 407 407 Serializer serializer = new Serializer(obj, config); 408 408 Serialize(stream, serializer); 409 } catch (PersistenceException) { 409 } 410 catch (PersistenceException) { 410 411 throw; 411 } catch (Exception e) { 412 } 413 catch (Exception e) { 412 414 throw new PersistenceException("Unexpected exception during Serialization.", e); 413 415 } … … 427 429 Serialize(stream, serializer); 428 430 types = serializer.SerializedTypes; 429 } catch (PersistenceException) { 431 } 432 catch (PersistenceException) { 430 433 throw; 431 } catch (Exception e) { 434 } 435 catch (Exception e) { 432 436 throw new PersistenceException("Unexpected exception during Serialization.", e); 433 437 } -
stable/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs
r11170 r11932 29 29 using HeuristicLab.Persistence.Core.Tokens; 30 30 using HeuristicLab.Persistence.Interfaces; 31 using ICSharpCode.SharpZipLib.Zip;32 31 33 32 namespace HeuristicLab.Persistence.Default.Xml { … … 193 192 TimeSpan start = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime; 194 193 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 } 197 198 } 198 199 } … … 247 248 } 248 249 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 262 267 return result; 263 268 } -
stable/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj
r11920 r11932 116 116 --> 117 117 <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>123 118 <Reference Include="System" /> 124 119 <Reference Include="System.configuration" /> … … 128 123 <Reference Include="System.Data" /> 129 124 <Reference Include="System.Drawing" /> 125 <Reference Include="System.IO.Compression" /> 130 126 <Reference Include="System.Xml" /> 131 127 </ItemGroup> -
stable/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManager.cs
r11170 r11932 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.ServiceModel; 27 28 using HeuristicLab.PluginInfrastructure.Manager; 28 using ICSharpCode.SharpZipLib.Zip;29 29 30 30 namespace HeuristicLab.PluginInfrastructure.Advanced { … … 183 183 184 184 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 } 207 211 } 212 streamWriter.Close(); 208 213 } 209 streamWriter.Close();210 214 } 211 215 } -
stable/HeuristicLab.PluginInfrastructure/3.3/Advanced/UploadPluginsView.cs
r11170 r11932 25 25 using System.Drawing; 26 26 using System.IO; 27 using System.IO.Compression; 27 28 using System.Linq; 28 29 using System.ServiceModel; 29 30 using System.Windows.Forms; 30 31 using HeuristicLab.PluginInfrastructure.Manager; 31 using ICSharpCode.SharpZipLib.Zip;32 32 33 33 namespace HeuristicLab.PluginInfrastructure.Advanced { … … 262 262 private static byte[] CreateZipPackage(IPluginDescription plugin) { 263 263 using (MemoryStream stream = new MemoryStream()) { 264 ZipFile zipFile = new ZipFile(stream); 265 zipFile.BeginUpdate(); 264 ZipArchive zipFile = new ZipArchive(stream, ZipArchiveMode.Create); 266 265 foreach (var file in plugin.Files) { 267 zipFile.Add(file.Name); 268 } 269 zipFile.CommitUpdate(); 266 zipFile.CreateEntry(file.Name); 267 } 270 268 stream.Seek(0, SeekOrigin.Begin); 271 269 return stream.GetBuffer(); -
stable/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj
r11920 r11932 114 114 <Reference Include="System.Drawing" /> 115 115 <Reference Include="System.IdentityModel" /> 116 <Reference Include="System.IO.Compression" /> 116 117 <Reference Include="System.Runtime.Serialization" /> 117 118 <Reference Include="System.ServiceModel" /> 118 119 <Reference Include="System.Windows.Forms" /> 119 120 <Reference Include="System.Xml" /> 120 <Reference Include="ICSharpCode.SharpZipLib">121 <HintPath>ICSharpCode.SharpZipLib.dll</HintPath>122 </Reference>123 121 </ItemGroup> 124 122 <ItemGroup> … … 316 314 </ItemGroup> 317 315 <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>324 316 <EmbeddedResource Include="Advanced\DeploymentService\services.heuristiclab.com.cer" /> 325 317 <None Include="Resources\Error.ico" /> -
stable/HeuristicLab.Problems.Instances.CordeauGQAP/3.3/CordeauGQAPInstanceProvider.cs
r11170 r11932 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 } -
stable/HeuristicLab.Problems.Instances.CordeauGQAP/3.3/HeuristicLab.Problems.Instances.CordeauGQAP-3.3.csproj
r11920 r11932 109 109 </PropertyGroup> 110 110 <ItemGroup> 111 <Reference Include="ICSharpCode.SharpZipLib">112 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>113 <Private>False</Private>114 </Reference>115 111 <Reference Include="System" /> 116 112 <Reference Include="System.Core" /> 117 113 <Reference Include="System.Data" /> 114 <Reference Include="System.IO.Compression" /> 118 115 </ItemGroup> 119 116 <ItemGroup> -
stable/HeuristicLab.Problems.Instances.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis merged: 11650
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ResourceClassificationInstanceProvider.cs
r11170 r11932 23 23 using System.Globalization; 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 29 using HeuristicLab.Problems.DataAnalysis; 29 using ICSharpCode.SharpZipLib.Zip;30 30 31 31 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 38 38 39 39 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 40 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {40 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 41 41 var entry = instancesZipFile.GetEntry(descriptor.ResourceName); 42 42 NumberFormatInfo numberFormat; 43 43 DateTimeFormatInfo dateFormat; 44 44 char separator; 45 using (Stream stream = instancesZipFile.GetInputStream(entry)) {45 using (Stream stream = entry.Open()) { 46 46 TableFileParser.DetermineFileFormat(stream, out numberFormat, out dateFormat, out separator); 47 47 } 48 48 49 49 TableFileParser csvFileParser = new TableFileParser(); 50 using (Stream stream = instancesZipFile.GetInputStream(entry)) {50 using (Stream stream = entry.Open()) { 51 51 csvFileParser.Parse(stream, numberFormat, dateFormat, separator, true); 52 52 } -
stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/UCI/UCIInstanceProvider.cs
r11170 r11932 23 23 using System.Collections.Generic; 24 24 using System.IO; 25 using System.IO.Compression; 25 26 using System.Linq; 26 using ICSharpCode.SharpZipLib.Zip;27 27 28 28 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 56 56 var solutionsArchiveName = GetResourceName(FileName + @"\.zip"); 57 57 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 58 using (var solutionsZipFile = new Zip InputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {58 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 59 59 IList<string> entries = new List<string>(); 60 ZipEntry curEntry; 61 while ((curEntry = solutionsZipFile.GetNextEntry()) != null) { 60 foreach (var curEntry in solutionsZipFile.Entries) { 62 61 entries.Add(curEntry.Name); 63 62 } -
stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj
r11920 r11932 105 105 </PropertyGroup> 106 106 <ItemGroup> 107 <Reference Include="ICSharpCode.SharpZipLib">108 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>109 <Private>False</Private>110 </Reference>111 107 <Reference Include="System" /> 112 108 <Reference Include="System.Core" /> 113 109 <Reference Include="System.Drawing" /> 110 <Reference Include="System.IO.Compression" /> 114 111 <Reference Include="System.Windows.Forms" /> 115 112 <Reference Include="System.Xml.Linq" /> -
stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RealWorld/RealWorldRegressionInstanceProvider.cs
r11170 r11932 23 23 using System.Collections.Generic; 24 24 using System.IO; 25 using System.IO.Compression; 25 26 using System.Linq; 26 using ICSharpCode.SharpZipLib.Zip;27 27 28 28 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 52 52 var solutionsArchiveName = GetResourceName(FileName + @"\.zip"); 53 53 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 54 using (var solutionsZipFile = new Zip InputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {54 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 55 55 IList<string> entries = new List<string>(); 56 ZipEntry curEntry; 57 while ((curEntry = solutionsZipFile.GetNextEntry()) != null) { 56 foreach (var curEntry in solutionsZipFile.Entries) { 58 57 entries.Add(curEntry.Name); 59 58 } -
stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ResourceRegressionInstanceProvider.cs
r11170 r11932 23 23 using System.Globalization; 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 29 using HeuristicLab.Problems.DataAnalysis; 29 using ICSharpCode.SharpZipLib.Zip;30 30 31 31 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 38 38 39 39 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 40 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {40 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 41 41 var entry = instancesZipFile.GetEntry(descriptor.ResourceName); 42 42 NumberFormatInfo numberFormat; 43 43 DateTimeFormatInfo dateFormat; 44 44 char separator; 45 using (Stream stream = instancesZipFile.GetInputStream(entry)) {45 using (Stream stream = entry.Open()) { 46 46 TableFileParser.DetermineFileFormat(stream, out numberFormat, out dateFormat, out separator); 47 47 } 48 48 49 49 TableFileParser csvFileParser = new TableFileParser(); 50 using (Stream stream = instancesZipFile.GetInputStream(entry)) {50 using (Stream stream = entry.Open()) { 51 51 csvFileParser.Parse(stream, numberFormat, dateFormat, separator, true); 52 52 } -
stable/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/ElloumiCTAPInstanceProvider.cs
r11170 r11932 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.ElloumiCTAP { … … 56 56 var solutionsArchiveName = GetResourceName(FileName + @"\.sol\.zip"); 57 57 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 58 using (var solutionsZipFile = new Zip InputStream(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); 61 61 } 62 62 } … … 64 64 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 65 65 66 using (var instanceStream = new Zip InputStream(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)) { 68 68 yield return new ElloumiCTAPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty); 69 69 } … … 74 74 var descriptor = (ElloumiCTAPDataDescriptor)id; 75 75 var instanceArchiveName = GetResourceName(FileName + @"\.dat\.zip"); 76 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {76 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 77 77 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 78 using (var stream = instancesZipFile.GetInputStream(entry)) {78 using (var stream = entry.Open()) { 79 79 var parser = new ElloumiCTAPParser(); 80 80 parser.Parse(stream); … … 86 86 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { 87 87 var solutionsArchiveName = GetResourceName(FileName + @"\.sol\.zip"); 88 using (var solutionsZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {88 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 89 89 entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier); 90 using (var solStream = solutionsZipFile.GetInputStream(entry)) {90 using (var solStream = entry.Open()) { 91 91 ElloumiCTAPSolutionParser slnParser = new ElloumiCTAPSolutionParser(); 92 92 slnParser.Parse(solStream, instance.MemoryRequirements.Length); … … 138 138 .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success).SingleOrDefault(); 139 139 } 140 141 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {142 ZipEntry entry;143 while ((entry = zipFile.GetNextEntry()) != null) {144 yield return entry.Name;145 }146 }147 140 } 148 141 } -
stable/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj
r11920 r11932 109 109 </PropertyGroup> 110 110 <ItemGroup> 111 <Reference Include="ICSharpCode.SharpZipLib">112 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>113 <Private>False</Private>114 </Reference>115 111 <Reference Include="System" /> 116 112 <Reference Include="System.Core" /> 117 113 <Reference Include="System.Data" /> 114 <Reference Include="System.IO.Compression" /> 118 115 </ItemGroup> 119 116 <ItemGroup> -
stable/HeuristicLab.Problems.Instances.QAPLIB/3.3/HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj
r11920 r11932 109 109 </PropertyGroup> 110 110 <ItemGroup> 111 <Reference Include="ICSharpCode.SharpZipLib">112 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>113 <Private>False</Private>114 </Reference>115 111 <Reference Include="System" /> 116 112 <Reference Include="System.Core" /> 117 113 <Reference Include="System.Data" /> 114 <Reference Include="System.IO.Compression" /> 118 115 </ItemGroup> 119 116 <ItemGroup> -
stable/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstanceProvider.cs
r11170 r11932 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.QAPLIB { … … 34 34 protected virtual HashSet<string> ReversedSolutions { 35 35 get { 36 36 return new HashSet<string>(new string[] { 37 37 "bur26a", 38 38 "bur26b", … … 177 177 var solutionsArchiveName = GetResourceName(FileName + @"\.sln\.zip"); 178 178 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 179 using (var solutionsZipFile = new Zip InputStream(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); 182 182 } 183 183 } … … 185 185 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 186 186 187 using (var instanceStream = new Zip InputStream(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)) { 189 189 yield return new QAPLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty); 190 190 } … … 195 195 var descriptor = (QAPLIBDataDescriptor)id; 196 196 var instanceArchiveName = GetResourceName(FileName + @"\.dat\.zip"); 197 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {197 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 198 198 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 199 199 200 using (var stream = instancesZipFile.GetInputStream(entry)) {200 using (var stream = entry.Open()) { 201 201 var parser = new QAPLIBParser(); 202 202 parser.Parse(stream); … … 207 207 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { 208 208 var solutionsArchiveName = GetResourceName(FileName + @"\.sln\.zip"); 209 using (var solutionsZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {209 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 210 210 entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier); 211 using (var solStream = solutionsZipFile.GetInputStream(entry)) {211 using (var solStream = entry.Open()) { 212 212 var slnParser = new QAPLIBSolutionParser(); 213 213 slnParser.Parse(solStream, true); … … 258 258 .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success).SingleOrDefault(); 259 259 } 260 261 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {262 ZipEntry entry;263 while ((entry = zipFile.GetNextEntry()) != null) {264 yield return entry.Name;265 }266 }267 260 } 268 261 } -
stable/HeuristicLab.Problems.Instances.Scheduling/3.3/HeuristicLab.Problems.Instances.Scheduling-3.3.csproj
r11920 r11932 113 113 <Private>False</Private> 114 114 </Reference> 115 <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369">116 <HintPath>..\bin\ICSharpCode.SharpZipLib.dll</HintPath>117 <Private>False</Private>118 </Reference>119 115 <Reference Include="System" /> 120 116 <Reference Include="System.Core" /> 121 117 <Reference Include="System.Data" /> 118 <Reference Include="System.IO.Compression" /> 122 119 </ItemGroup> 123 120 <ItemGroup> -
stable/HeuristicLab.Problems.Instances.Scheduling/3.3/JSSPORLIBInstanceProvider.cs
r11170 r11932 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 } -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj
r11920 r11932 109 109 </PropertyGroup> 110 110 <ItemGroup> 111 <Reference Include="ICSharpCode.SharpZipLib">112 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>113 <Private>False</Private>114 </Reference>115 111 <Reference Include="System" /> 116 112 <Reference Include="System.Core" /> 117 113 <Reference Include="System.Data" /> 114 <Reference Include="System.IO.Compression" /> 118 115 </ItemGroup> 119 116 <ItemGroup> -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBInstanceProvider.cs
r11170 r11932 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.TSPLIB { … … 52 52 var solutionsArchiveName = GetResourceName(FileExtension + @"\.opt\.tour\.zip"); 53 53 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 54 using (var solutionsZipFile = new Zip InputStream(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); 57 57 } 58 58 } … … 60 60 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 61 61 62 using (var instanceStream = new Zip InputStream(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)) { 64 64 yield return new TSPLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetInstanceDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty); 65 65 } … … 70 70 var descriptor = (TSPLIBDataDescriptor)id; 71 71 var instanceArchiveName = GetResourceName(FileExtension + @"\.zip"); 72 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {72 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 73 73 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 74 var stream = instancesZipFile.GetInputStream(entry);74 var stream = entry.Open(); 75 75 var parser = new TSPLIBParser(stream); 76 76 var instance = LoadInstance(parser); … … 78 78 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { 79 79 var solutionsArchiveName = GetResourceName(FileExtension + @"\.opt\.tour\.zip"); 80 using (var solutionsZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {80 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 81 81 entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier); 82 stream = solutionsZipFile.GetInputStream(entry);82 stream = entry.Open(); 83 83 parser = new TSPLIBParser(stream); 84 84 LoadSolution(parser, instance); … … 105 105 return "Embedded instance of plugin version " + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Cast<AssemblyFileVersionAttribute>().First().Version + "."; 106 106 } 107 108 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {109 ZipEntry entry;110 while ((entry = zipFile.GetNextEntry()) != null) {111 yield return entry.Name;112 }113 }114 107 } 115 108 } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/HeuristicLab.Problems.Instances.VehicleRouting-3.4.csproj
r11931 r11932 109 109 </PropertyGroup> 110 110 <ItemGroup> 111 <Reference Include="ICSharpCode.SharpZipLib">112 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>113 <Private>False</Private>114 </Reference>115 111 <Reference Include="System" /> 116 112 <Reference Include="System.Core" /> 117 113 <Reference Include="System.Data" /> 114 <Reference Include="System.IO.Compression" /> 118 115 </ItemGroup> 119 116 <ItemGroup> -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/LiLimFormat/LiLimInstanceProvider.cs
r11334 r11932 21 21 22 22 using 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;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/HombergerInstanceProvider.cs
r11334 r11932 21 21 22 22 using 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;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonInstanceProvider.cs
r11170 r11932 21 21 22 22 using 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;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Solomon test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 get { return new Uri(@"http://web.cba.neu.edu/~msolomon/problems.htm"); } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/AugeratInstanceProvider.cs
r11170 r11932 21 21 22 22 using 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;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Augerat test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 get { return new Uri(@"http://www.branchandcut.org/VRP/data"); } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/ChristofidesEilonInstanceProvider.cs
r11170 r11932 21 21 22 22 using 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;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Christofides and Eilon test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 get { return new Uri(@"http://www.branchandcut.org/VRP/data"); } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TaillardFormat/TaillardInstanceProvider.cs
r11170 r11932 21 21 22 22 using 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;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Taillard test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 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 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 29 using HeuristicLab.Common; 29 using ICSharpCode.SharpZipLib.Zip;30 30 31 31 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 37 var solutionsArchiveName = GetResourceName(FileName + @"\.opt\.zip"); 38 38 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 39 using (var solutionsZipFile = new Zip InputStream(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); 42 42 } 43 43 } … … 45 45 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 46 46 47 using (var instanceStream = new Zip InputStream(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())) { 49 49 string solutionEntry = Path.GetFileNameWithoutExtension(entry) + "." + FileName; 50 50 yield return new VRPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetInstanceDescription(), entry, solutions.ContainsKey(solutionEntry) ? solutions[solutionEntry] : String.Empty); … … 56 56 var descriptor = (VRPDataDescriptor)id; 57 57 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 58 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {58 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) { 59 59 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 60 var stream = instancesZipFile.GetInputStream(entry);60 var stream = entry.Open(); 61 61 var instance = LoadData(stream); 62 62 if (string.IsNullOrEmpty(instance.Name)) { … … 66 66 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { 67 67 var solutionsArchiveName = GetResourceName(FileName + @"\.opt\.zip"); 68 using (var solutionsZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {68 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) { 69 69 entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier); 70 stream = solutionsZipFile.GetInputStream(entry);70 stream = entry.Open(); 71 71 LoadSolution(stream, instance); 72 72 } … … 130 130 LoadSolution(stream, instance); 131 131 } 132 } catch (Exception) { 132 } 133 catch (Exception) { 133 134 // new stream necessary because first try already read from stream 134 135 using (var stream = new FileStream(path, FileMode.Open)) { … … 149 150 return "Embedded instance of plugin version " + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Cast<AssemblyFileVersionAttribute>().First().Version + "."; 150 151 } 151 152 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {153 ZipEntry entry;154 while ((entry = zipFile.GetNextEntry()) != null) {155 yield return entry.Name;156 }157 }158 152 #endregion 159 153 } -
stable/HeuristicLab.Services.Hive.JanitorService/3.3/HeuristicLab.Services.Hive.JanitorService-3.3.csproj
r11920 r11932 141 141 </EmbeddedResource> 142 142 </ItemGroup> 143 <ItemGroup>144 <Content Include="ICSharpCode.SharpZipLib License.txt">145 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>146 </Content>147 </ItemGroup>148 143 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 149 144 <PropertyGroup>
Note: See TracChangeset
for help on using the changeset viewer.