/// <summary> /// Verschieben der Faxdatei /// </summary> public static string Start(string sourceFile, string destinationFile) { //Check if input okey and exist if (string.IsNullOrEmpty(sourceFile) || string.IsNullOrEmpty(destinationFile) || !WaitFileReady.Check(sourceFile)) { return(null); } //Check if new file already exist and delete if (File.Exists(destinationFile)) { if (WaitFileReady.Check(destinationFile)) { File.Delete(destinationFile); } else { return(null); } } //Move and wait until ok File.Move(sourceFile, destinationFile); if (!WaitFileReady.Check(destinationFile)) { return(null); } return(destinationFile); }
public static List <Bitmap> TiffToBitmapList(string path) { var bitmapList = new List <Bitmap>(); if (!WaitFileReady.Check(path)) { return(null); } using (var fileStream = new FileStream(path, FileMode.Open)) { var tifImage = Image.FromStream(fileStream); var tifGuid = tifImage.FrameDimensionsList[0]; var tifDimension = new FrameDimension(tifGuid); var countPages = tifImage.GetFrameCount(tifDimension); for (var i = 0; i < countPages; i++) { using (var memoryStream = new MemoryStream()) { tifImage.SelectActiveFrame(tifDimension, i); tifImage.Save(memoryStream, ImageFormat.Bmp); var bitmap = new Bitmap(memoryStream); bitmapList.Add(bitmap); } } } return(bitmapList); }
public static void SaveTiffAsImage(string sourcePath, string targetPath) { var bitmap = TiffToBitmap(sourcePath); bitmap.Save(targetPath); WaitFileReady.Check(targetPath); }