public SetProcess ( string _processName ) : bool | ||
_processName | string | |
Résultat | bool |
public BotLogic(string[] processNames) { Initialize(); string foundProcess = ""; foreach(string processName in processNames) { if (windowFinder.SetProcess(processName)) foundProcess = processName; } if(foundProcess.Length > 0) { GameOverlay = new Overlay(this, keyCropSettings.X, keyCropSettings.Y, foundProcess); } else if (MessageBox.Show("No process found, is LoveBeat running?", Application.ProductName, MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { using (ProcessPicker p = new ProcessPicker()) { DialogResult dr = p.ShowDialog(); if (dr != DialogResult.OK) return; string processName = p.PickedProcessName; windowFinder.SetProcess(processName); GameOverlay = new Overlay(this, keyCropSettings.X, keyCropSettings.Y, processName); } } }
/* end http://stackoverflow.com/a/1524047 */ public Overlay(BotLogic _owner, int _keyOffsetX, int _keyOffsetY, string process) { InitializeComponent(); owner = _owner; keyOffsetX = _keyOffsetX; keyOffsetY = _keyOffsetY - 50; overlayFont = new Font(FontFamily.GenericMonospace, 10f); creditBrush = new SolidBrush(Color.Aqua); initializeOverlayBrushes(); backgroundBrush = new SolidBrush(Color.Black); windowFinder = new WindowFinder(); windowFinder.SetProcess(process); // todo: add hooks programatically keyboardHook = new globalKeyboardHook(); keyboardHook.KeyDown += KeyboardHook_KeyDown; keyboardHook.HookedKeys.Add(toggleKey); keyboardHook.HookedKeys.Add(toggleVisibleKey); keyboardHook.HookedKeys.Add(toggleKeyModeKey); keyboardHook.HookedKeys.Add(toggleAutoReadyKey); keyboardHook.HookedKeys.Add(dumpKey); keyboardHook.hook(); Byte[] bitmapData = Convert.FromBase64String(CREDIT_IMAGE_B64); using (System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(bitmapData)) { creditImage = (Bitmap)Image.FromStream(streamBitmap); } creditImageEnabled = getColoredBitmap(creditImage, Color.FromArgb(0, 1, 0)); creditImageDisabled = getColoredBitmap(creditImage, Color.FromArgb(1, 0, 0)); this.DoubleBuffered = true; //owner.Start(); }
/* end http://stackoverflow.com/a/1524047 */ public Overlay(BotLogic _owner, int _keyOffsetX, int _keyOffsetY, string process) { InitializeComponent(); owner = _owner; keyOffsetX = _keyOffsetX; keyOffsetY = _keyOffsetY - 50; overlayFont = new Font(FontFamily.GenericMonospace, 10f); creditBrush = new SolidBrush(Color.Aqua); initializeOverlayBrushes(); backgroundBrush = new SolidBrush(Color.Black); windowFinder = new WindowFinder(); windowFinder.SetProcess(process); // todo: add hooks programatically keyboardHook = new globalKeyboardHook(); keyboardHook.KeyDown += KeyboardHook_KeyDown; keyboardHook.HookedKeys.Add(toggleKey); keyboardHook.HookedKeys.Add(toggleVisibleKey); keyboardHook.HookedKeys.Add(toggleKeyModeKey); keyboardHook.HookedKeys.Add(toggleAutoReadyKey); keyboardHook.HookedKeys.Add(dumpKey); keyboardHook.hook(); Byte[] bitmapData = Convert.FromBase64String(CREDIT_IMAGE_B64); using (System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(bitmapData)) { creditImage = (Bitmap)Image.FromStream(streamBitmap); } creditImageEnabled = getColoredBitmap(creditImage, Color.FromArgb(0, 1, 0)); creditImageDisabled = getColoredBitmap(creditImage, Color.FromArgb(1, 0, 0)); this.DoubleBuffered = true; //owner.Start(); }