OSDN Git Service

Output the image on failure to detect
authorKazuhiro <fujieda@users.osdn.me>
Thu, 26 Nov 2015 13:15:52 +0000 (22:15 +0900)
committerKazuhiro <fujieda@users.osdn.me>
Thu, 26 Nov 2015 13:15:52 +0000 (22:15 +0900)
BurageSnap/Capture.cs

index dcf8252..1ee380e 100644 (file)
@@ -18,6 +18,7 @@
 using System;
 using System.Drawing;
 using System.Drawing.Imaging;
+using System.IO;
 using System.Runtime.InteropServices;
 using System.Text;
 
@@ -46,7 +47,11 @@ namespace BurageSnap
             {
                 _rectangle = DetectGameScreen(bmp);
                 if (_rectangle.IsEmpty)
+                {
+                    using (var file = File.Create("debug.png"))
+                        bmp.Save(file, ImageFormat.Png);
                     return null;
+                }
                 return bmp.Clone(_rectangle, bmp.PixelFormat);
             }
         }