using System; using System.Collections.Generic; using System.Drawing; using System.Runtime.InteropServices; using System.Text; namespace YASB { class AutoItX { #region Singleton static readonly AutoItX m_Instance=new AutoItX(); // Explicit static constructor to tell C# compiler // not to mark type as beforefieldinit static AutoItX() { } public static AutoItX Instance { get { return m_Instance; } } #endregion public AutoItX3Lib.AutoItX3Class Au3; public AutoItX() { this.Au3 = new AutoItX3Lib.AutoItX3Class(); // Set coord modes to ClientArea, just like the pixel scanner class this.Au3.Opt("PixelCoordMode", 2); this.Au3.Opt("MouseCoordMode", 2); } public Color PixelGetColorRGB(int x, int y) { return Color.FromArgb(this.Au3.PixelGetColor(x, y)); } [DllImport("C:\\Program Files\\AutoIt3\\AutoItX\\AutoItX3.dll", EntryPoint = "AU3_PixelChecksum")] [DllImport("AutoItX3.dll", EntryPoint = "AU3_PixelChecksum")] public static extern int PixelChecksumInterop(int x1, int y1, int x2, int y2, int step); public uint PixelChecksum(int x1, int y1, int x2, int y2, int step) { return (uint)PixelChecksumInterop(x1, y1, x2, y2, step); } public uint PixelChecksumAdler(int x1, int y1, int x2, int y2, int step) { Pixel.Pixel myScanner = new Pixel.Pixel(Pixel.ScreenOffset.ClientArea); int[] found = myScanner.GetArea(x1, y1, x2, y2, step); return Adler32.HashCore(found); } public int PixelChecksum3(int x1, int y1, int x2, int y2, int step) { Pixel.Pixel myScanner = new Pixel.Pixel(Pixel.ScreenOffset.ClientArea); int[] found = myScanner.GetArea(x1, y1, x2, y2, step); return found.GetHashCode(); } /* public string PixelChecksumMD5(int x1, int y1, int x2, int y2, int step) { Pixel.Pixel myScanner = new Pixel.Pixel(Pixel.ScreenOffset.ClientArea); int[] found = myScanner.GetArea(x1, y1, x2, y2, step); MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] buf = new byte[found.Length]; int x=0; foreach(int f in found) { byte[] t=BitConverter.GetBytes(f); for(int y=0;y<4;y++) buf[y + x] = t[y]; x+=4; } /* for(int i=0;i