Пример #1
0
        private void RelocateAddon()
        {
            Console.WriteLine("Relocating addon...");
            AddonLocator.ReCalculateAddonPositions();
            var addonLocations = AddonLocator.GetAddonLocations();
            foreach (var hWnd in addonLocations.Keys)
            {
                if (addonLocations[hWnd].Width == 1 || addonLocations[hWnd].Height == 1)
                {
                    Logger.Log("Addon could not be located. Make sure it's loaded and visible.", ConsoleColor.Red);
                }
                else
                {
                    Logger.Log($"Addon successfully located: {addonLocations[hWnd]}", ConsoleColor.Green);
                }
            }

            AddonFolderHandler.LocateAddonFolderPath();
            var addonFolderPath = AddonFolderHandler.GetAddonFolderPath();
            if (!string.IsNullOrEmpty(addonFolderPath))
            {
                Logger.Log($"Successfully found Wow Addon folder at {addonFolderPath}", ConsoleColor.Green);
            }
            else
            {
                Logger.Log("Addon folder could not be found!", ConsoleColor.Red);
                Logger.Log("Make sure the game is running when the app tries to locate the Addon PATH. Run 'addon reload' when the game is running to retry.", ConsoleColor.Red);
            }
        }
Пример #2
0
        public Dictionary <IntPtr, Bitmap> CaptureScreenShots()
        {
            var screenshots    = new Dictionary <IntPtr, Bitmap>();
            var addonLocations = AddonLocator.GetAddonLocations();

            using (var bitmap = new Bitmap(_screenbounds.Width, _screenbounds.Height))
            {
                using (var g = Graphics.FromImage(bitmap))
                {
                    g.CopyFromScreen(Point.Empty, Point.Empty, _screenbounds.Size);
                }

                foreach (var hWnd in addonLocations.Keys)
                {
                    Bitmap clone;

                    if (addonLocations[hWnd] == Rectangle.Empty)
                    {
                        clone = bitmap.Clone(new Rectangle(1, 1, 1, 1), PixelFormat.Format24bppRgb);
                    }
                    else
                    {
                        clone = bitmap.Clone(addonLocations[hWnd], PixelFormat.Format24bppRgb);
                    }

                    screenshots.Add(hWnd, clone);
                }
            }

            return(screenshots);
        }