Exemplo n.º 1
0
		private string ExtractZip(string sourceZip)
		{
			var fileName = _ioService.GetFileName(sourceZip);
			var sourceFolder = fileName == null ? null : _ioService.CombinePath(_localPath, fileName);

			using (var stopwatch = new NhStopwatch(_context,
				"Extracting source",
				"Extracted source in {0} seconds"))
			{
				try
				{
					ZipFile.ExtractToDirectory(sourceZip, sourceFolder);
				}
				catch
				{
					stopwatch.Reject();
					throw;
				}
			}

			return sourceFolder;
		}
Exemplo n.º 2
0
		private string DownloadBundle(string source, string targetFileName)
		{
			var target = _ioService.CombinePath(_localPath, targetFileName);

			using (var client = new WebClient())
			{
				using (var stopwatch = new NhStopwatch(_context,
					"Downloading source",
					"Downloaded source in {0} seconds"))
				{
					try
					{
						client.DownloadFile(source, target);
					}
					catch
					{
						stopwatch.Reject();
						throw;
					}
				}

				return target;
			}
		}