Пример #1
0
        private void RelocateAddon()
        {
            Console.WriteLine("Relocating addon...");
            AddonLocator.ReCalculateAddonPosition();
            var addonLocation = AddonLocator.GetAddonLocation();

            if (addonLocation.Width == 1 || addonLocation.Height == 1)
            {
                Logger.Log("Addon could not be located. Make sure it's loaded and visible.", ConsoleColor.Red);
            }
            else
            {
                Logger.Log($"Addon successfully located: {addonLocation.ToString()}", 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);
            }
        }
        public Bitmap CaptureScreenShot()
        {
            Bitmap clone;
            var    bounds = Screen.GetBounds(Point.Empty);

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

                var addonLocation = AddonLocator.GetAddonLocation();
                if (addonLocation == Rectangle.Empty)
                {
                    addonLocation = new Rectangle(1, 1, 1, 1);
                }

                clone = bitmap.Clone(addonLocation, PixelFormat.Format24bppRgb);
            }
            return(clone);
        }