예제 #1
0
        public void Test()
        {
            NoxEmulator emulator = new NoxEmulator();

            emulator.Width  = 1144;
            emulator.Height = 644;

            XmlSerializer serializer = new XmlSerializer(typeof(CairosRunnerConfig), new XmlRootAttribute("RunConfig"));

            // Declare an object variable of the type to be deserialized.
            CairosRunnerConfig runConfig;

            string testConfigXml = @"TestData/TestConfig.xml";

            using (Stream reader = new FileStream(testConfigXml, FileMode.Open))
            {
                // Call the Deserialize method to restore the object's state.
                runConfig = (CairosRunnerConfig)serializer.Deserialize(reader);
            }

            Helper.UpdateRunConfig(emulator, runConfig);

            Assert.IsNotNull(runConfig);

            Assert.AreEqual((int)runConfig.ReplayPoint.X, 369);
            Assert.AreEqual((int)runConfig.ReplayPoint.Y, 343);
        }
예제 #2
0
        public void TestPrintWindow()
        {
            NoxEmulator emulator = new NoxEmulator();

            IntPtr parent     = AbstractEmulator.FindWindow("Qt5QWindowIcon", "Nox");
            IntPtr subWindow  = AbstractEmulator.FindWindowEx(parent, IntPtr.Zero, "Qt5QWindowIcon", "ScreenBoardClassWindow");
            IntPtr mainWindow = AbstractEmulator.FindWindowEx(subWindow, IntPtr.Zero, "Qt5QWindowIcon", "QWidgetClassWindow");
            IntPtr sub        = AbstractEmulator.FindWindowEx(mainWindow, IntPtr.Zero, "subWin", "sub");

            emulator.PrintWindow(parent);
        }
예제 #3
0
        public void NoxEmulatorTestSellRuneInRift()
        {
            NoxEmulator emulator = new NoxEmulator();

            RiftRunnerConfig config = new RiftRunnerConfig();

            config.SellRunePoint = new System.Drawing.PointF(0.417f, 0.750f);

            Helper.UpdateRunConfig(emulator, config);

            emulator.Click(config.SellRunePoint);
        }
예제 #4
0
        public void TestMatchImage()
        {
            NoxEmulator emulator = new NoxEmulator();

            IntPtr parent = AbstractEmulator.FindWindow("Qt5QWindowIcon", "Nox");
            Bitmap source = emulator.PrintWindow(parent);

            Bitmap crop = BitmapUtils.CropImage(source, new Rectangle(800, 550, 400, 200));


            string test1 = @"C:\Users\Administrator\Desktop\1\dungeonEnergy.png";
            string test2 = @"E:\SWRunner\Resources\general\gift_box.png";

            Assert.AreEqual(1, QuizSolver.FindMatchImage(crop, new Bitmap(test2)));
        }
예제 #5
0
        public void TestPrintScreen()
        {
            NoxEmulator emulator  = new NoxEmulator();
            IntPtr      paintHwnd = AbstractEmulator.FindWindow(null, "Untitled - Paint");

            Bitmap src = emulator.PrintWindow(paintHwnd);

            Rectangle cropRect = new Rectangle(100, 100, 80, 80);
            Bitmap    target   = new Bitmap(cropRect.Width, cropRect.Height);

            using (Graphics g = Graphics.FromImage(target))
            {
                g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
                            cropRect,
                            GraphicsUnit.Pixel);
            }
            target.Save("C:\\TestWin32\\test1.png", ImageFormat.Png);

            Helper.GetQuizImages(src);
        }
예제 #6
0
        public void NoxEmulatorTestQuiz()
        {
            NoxEmulator emulator = new NoxEmulator();

            emulator.PrintWindow();
        }
예제 #7
0
        public void TestKeySend()
        {
            NoxEmulator emulator = new NoxEmulator();

            emulator.PressEsc();
        }
예제 #8
0
        public void TestQuiz()
        {
            NoxEmulator emulator = new NoxEmulator();

            QuizSolver.SolveQuiz(emulator);
        }
예제 #9
0
        public void Test()
        {
            NoxEmulator emulator = new NoxEmulator();

            emulator.Click(new Point(1006, 594)); // Settings
        }