Changeset 12694 for branches/HeuristicLab.Problems.Orienteering/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManager.cs
- Timestamp:
- 07/09/15 13:07:30 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering ¶
- Property svn:mergeinfo changed
-
Property
svn:global-ignores
set to
*.nuget
packages
-
TabularUnified branches/HeuristicLab.Problems.Orienteering/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManager.cs ¶
r11185 r12694 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.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 }
Note: See TracChangeset
for help on using the changeset viewer.