private static void ProcessStrip(ComicStrip strip, string folder) { // Check if local year directory exists and create if it doesn't var localDirectory = Path.Combine(folder, strip.Year.ToString()); if (!Directory.Exists(localDirectory)) { Directory.CreateDirectory(localDirectory); } // Initialize file pathes for GIF and PNG format var gifPath = Path.Combine(localDirectory, strip.GetFilename("gif")); var pngPath = Path.Combine(localDirectory, strip.GetFilename("png")); // Check if PNG already exists if (File.Exists(pngPath)) { var length = new FileInfo(pngPath).Length; if (length > 0) { File.Delete(gifPath); return; } } // Download image on computer if (!File.Exists(gifPath)) { strip.Download(gifPath); } // Convert to PNG ComicStrip.ConvertToPng(gifPath); // When successfully converted to PNG, remove GIF image if (File.Exists(pngPath)) { File.Delete(gifPath); } }