예제 #1
0
		public void FillContent(DownloadFile file)
		{
			if (file == null) throw new ArgumentNullException("file");

            Content = Encoding.UTF8.GetBytes(string.Format("{{\"file\": \"{0}\", \"temp\": \"{1}\"}}", file.FileName, file.TempFile));
        }
예제 #2
0
		private DownloadFile SaveImage(Image image, int? counter = null)
		{
			if (image == null) throw new ArgumentException("image");

			var filename = ImageTools.CreateFilename(
				_command.FileName, 
				counter.HasValue?counter.Value.ToString():_command.FileCounter,
				_command.IsPackage != null,
				(GlobalDictionaries.SaveAsValues)_command.SaveAs,
				_command.CompressionFormat.ImgFormat);

			var file = Path.GetTempFileName();
			var tempfile = Path.GetFileName(file);	

			var downloadFile = new DownloadFile(filename, tempfile);

			ImageTools.CompressAndSaveImage(image, file, _command.CompressionFormat);
		
			GlobalDictionaries.Scans.Add(downloadFile.TempFile);

			return downloadFile;
		}