コード例 #1
0
        private void SimulateReplaceMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            this.simulateReplaceMenu.Hide();
            switch (e.ClickedItem.Text)
            {
            case "模拟衣服替换(&R)...":
                SimulateReplace simulateReplace = new SimulateReplace(this.requestHandler.dict);
                if (simulateReplace.ShowDialog() == DialogResult.OK)
                {
                    List <Dictionary <string, string> > list = simulateReplace.dict;
                    requestHandler.dict = list;

                    simulateReplace.Dispose();
                }
                break;

            case "查找部件ID(&M)...":
                if (monitorIcons.IsDisposed)
                {
                    monitorIcons = new MonitorIcons();
                }
                monitorIcons.Show();
                break;

            default:
                break;
            }
        }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // string ppapiFlashPath = ConfigurationManager.AppSettings["ppapiFlashPath"];
            string ppapiFlashPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "pepflashplayer.dll";

            if (!File.Exists(ppapiFlashPath))
            {
                OpenFileDialog openFile = new OpenFileDialog();
                openFile.Filter = "Flash组件文件pepflashplayer.dll (*.dll)|*.dll";
                openFile.Title  = "没有找到Flash文件,或者首次运行需要指定Flash组件文件,文件名通常是pepflashplayer.dll,必须是64位的";
                DialogResult dresult = openFile.ShowDialog();
                this.Activate();
                if (dresult == DialogResult.OK)
                {
                    ppapiFlashPath = openFile.FileName;
                    Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                    cfa.AppSettings.Settings["ppapiFlashPath"].Value = ppapiFlashPath;
                    cfa.Save();
                    ConfigurationManager.RefreshSection("appSettings");
                }
                else
                {
                    MessageBox.Show("未指定Flash组件文件,登录器无法运行!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    System.Environment.Exit(-101);
                }
            }

            CefSettings settings = new CefSettings();

            settings.CefCommandLineArgs.Add("--disable-web-security");              //关闭同源策略
            settings.CefCommandLineArgs.Add("--ppapi-flash-version", "32.0.0.453"); //PepperFlash\manifest.json中的version
            settings.CefCommandLineArgs.Add("--ppapi-flash-path", ppapiFlashPath);
            settings.CefCommandLineArgs.Add("--disable-application-cache");

            // 必须设置缓存和Cookie否则点击快速进入或者选择服务器时会卡背景logo
            settings.PersistSessionCookies = true;
            settings.CachePath             = System.Environment.GetEnvironmentVariable("TEMP") + @"\CEFHuaClient\Temp\Cache\";
            settings.UserDataPath          = System.Environment.GetEnvironmentVariable("TEMP") + @"\CEFHuaClient\Temp\User Data\";
            // settings.LogFile = System.IO.Path.GetFullPath(@"Temp\LogData\");

            string strFlashSettingPath = System.Environment.GetEnvironmentVariable("TEMP") + @"\CEFHuaClient\Temp\Cache\Pepper Data\Shockwave Flash\WritableRoot\#Security\FlashPlayerTrust";

            if (!Directory.Exists(strFlashSettingPath))
            {
                Directory.CreateDirectory(strFlashSettingPath);
            }
            //flash配置文件路径
            string strFlashSettingFilePath = Path.Combine(strFlashSettingPath, "trust.cfg");

            using (StreamWriter sw = new StreamWriter(strFlashSettingFilePath, true, System.Text.Encoding.UTF8))
            {
                sw.WriteLine(Path.GetPathRoot(strFlashSettingFilePath));
                sw.Close();
            }

            panel            = new Panel();
            panel.AutoScroll = true;
            panel.Dock       = DockStyle.Fill;


            Cef.Initialize(settings);
            browser = new ChromiumWebBrowser("http://hua.61.com/play.shtml");
            browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
            panel.Controls.Add(browser);
            this.Controls.Add(panel);


            captureBtn           = new UISymbolButton();
            captureBtn.Text      = "截图";
            captureBtn.Font      = new Font("Microsoft Yahei", 11);
            captureBtn.Symbol    = 61636;
            captureBtn.Left      = 0;
            captureBtn.Top       = 0;
            captureBtn.Width     = 150;
            captureBtn.Height    = 25;
            captureBtn.RectColor = captureBtn.RectHoverColor = captureBtn.RectPressColor = captureBtn.RectDisableColor = UIColor.White;
            captureBtn.Click    += CaptureBtn_Click;
            captureBtn.MouseUp  += CaptureBtn_MouseUp;
            this.Controls.Add(captureBtn);
            this.Controls.SetChildIndex(captureBtn, 0);

            resolution = new UIComboBox();
            resolution.Items.Add("1366x768");
            resolution.Items.Add("1920x1080");
            resolution.Items.Add("2560x1440");
            resolution.Items.Add("3840x2160");
            resolution.Items.Add("7680x4320");
            resolution.Items.Add("128x72");
            resolution.Items.Add("自定义...");
            resolution.Left                  = 150;
            resolution.Top                   = 0;
            resolution.Width                 = 150;
            resolution.Height                = 25;
            resolution.DropDownStyle         = UIDropDownStyle.DropDownList;
            resolution.SelectedIndex         = 0;
            resolution.SelectedIndexChanged += Resolution_SelectedIndexChanged;
            this.currentComboBoxResolution   = resolution.SelectedItem.ToString();
            this.Controls.Add(resolution);
            this.Controls.SetChildIndex(resolution, 0);

            resetFlashPathBtn           = new UISymbolButton();
            resetFlashPathBtn.Text      = "重置Flash路径";
            resetFlashPathBtn.Font      = new Font("Microsoft Yahei", 11);
            resetFlashPathBtn.Symbol    = 61714;
            resetFlashPathBtn.Left      = 300;
            resetFlashPathBtn.Top       = 0;
            resetFlashPathBtn.Width     = 150;
            resetFlashPathBtn.Height    = 25;
            resetFlashPathBtn.RectColor = resetFlashPathBtn.RectHoverColor = resetFlashPathBtn.RectPressColor = UIColor.White;
            resetFlashPathBtn.Click    += ResetFlashPathBtn_Click;
            this.Controls.Add(resetFlashPathBtn);
            this.Controls.SetChildIndex(resetFlashPathBtn, 0);

            customeCaptureBtn           = new UISymbolButton();
            customeCaptureBtn.Text      = "自定义截图...";
            customeCaptureBtn.Font      = new Font("Microsoft Yahei", 11);
            customeCaptureBtn.Left      = 450;
            customeCaptureBtn.Top       = 0;
            customeCaptureBtn.Width     = 150;
            customeCaptureBtn.Height    = 25;
            customeCaptureBtn.Symbol    = 61918;
            customeCaptureBtn.RectColor = customeCaptureBtn.RectDisableColor = customeCaptureBtn.RectHoverColor = customeCaptureBtn.RectPressColor = UIColor.White;
            customeCaptureBtn.Click    += CustomCaptureBtn_Click;
            this.Controls.Add(customeCaptureBtn);
            this.Controls.SetChildIndex(customeCaptureBtn, 0);

            simulateReplaceBtn           = new UISymbolButton();
            simulateReplaceBtn.Text      = "模拟衣服替换▾";
            simulateReplaceBtn.Font      = new Font("Microsoft Yahei", 11);
            simulateReplaceBtn.Left      = 600;
            simulateReplaceBtn.Top       = 0;
            simulateReplaceBtn.Width     = 150;
            simulateReplaceBtn.Height    = 25;
            simulateReplaceBtn.Symbol    = 57378;
            simulateReplaceBtn.RectColor = simulateReplaceBtn.RectHoverColor = simulateReplaceBtn.RectPressColor = UIColor.White;
            simulateReplaceBtn.Click    += SimulateReplaceBtn_Click;;
            this.Controls.Add(simulateReplaceBtn);
            this.Controls.SetChildIndex(simulateReplaceBtn, 0);

            debugBtn           = new UISymbolButton();
            debugBtn.Text      = "调试";
            debugBtn.Font      = new Font("Microsoft Yahei", 11);
            debugBtn.Left      = 750;
            debugBtn.Top       = 0;
            debugBtn.Width     = 150;
            debugBtn.Height    = 25;
            debugBtn.Symbol    = 61729;
            debugBtn.RectColor = debugBtn.RectHoverColor = debugBtn.RectPressColor = UIColor.White;
            debugBtn.Click    += DebugBtn_Click;
            this.Controls.Add(debugBtn);
            this.Controls.SetChildIndex(debugBtn, 0);

            customeBgBtn           = new UISymbolButton();
            customeBgBtn.Text      = "自定义背景▾";
            customeBgBtn.Font      = new Font("Microsoft Yahei", 11);
            customeBgBtn.Left      = 900;
            customeBgBtn.Top       = 0;
            customeBgBtn.Width     = 150;
            customeBgBtn.Height    = 25;
            customeBgBtn.Symbol    = 61502;
            customeBgBtn.RectColor = customeBgBtn.RectHoverColor = customeBgBtn.RectPressColor = UIColor.White;
            customeBgBtn.Click    += CustomeBgBtn_Click;
            this.Controls.Add(customeBgBtn);
            this.Controls.SetChildIndex(customeBgBtn, 0);

            refreshBtn           = new UISymbolButton();
            refreshBtn.Text      = "刷新 (Alt+F5)";
            refreshBtn.Font      = new Font("Microsoft Yahei", 11);
            refreshBtn.Left      = 1050;
            refreshBtn.Top       = 0;
            refreshBtn.Width     = 150;
            refreshBtn.Height    = 25;
            refreshBtn.Symbol    = 61473;
            refreshBtn.RectColor = refreshBtn.RectHoverColor = refreshBtn.RectPressColor = UIColor.White;
            refreshBtn.Click    += RefreshBtn_Click;;
            this.Controls.Add(refreshBtn);
            this.Controls.SetChildIndex(refreshBtn, 0);

            autoMouseBtn           = new UISymbolButton();
            autoMouseBtn.Text      = "配置鼠标连点...";
            autoMouseBtn.Font      = new Font("Microsoft Yahei", 11);
            autoMouseBtn.Left      = 1200;
            autoMouseBtn.Top       = 0;
            autoMouseBtn.Width     = 150;
            autoMouseBtn.Height    = 25;
            autoMouseBtn.Symbol    = 62021;
            autoMouseBtn.RectColor = autoMouseBtn.RectHoverColor = autoMouseBtn.RectPressColor = UIColor.White;
            autoMouseBtn.Click    += AutoMouseBtn_Click;
            this.Controls.Add(autoMouseBtn);
            this.Controls.SetChildIndex(autoMouseBtn, 0);

            simulateReplaceMenu = new ContextMenuStrip();
            simulateReplaceMenu.Items.Add("模拟衣服替换(&R)...");
            simulateReplaceMenu.Items.Add("查找部件ID(&M)...");
            simulateReplaceMenu.ItemClicked += SimulateReplaceMenu_ItemClicked;

            customeBgMenu       = new ContextMenuStrip();
            noReplaceBg.Checked = true;
            customeBgMenu.Items.Add(noReplaceBg);
            customeBgMenu.Items.Add(whiteBg);
            customeBgMenu.Items.Add(blackBg);
            customeBgMenu.Items.Add(redBg);
            customeBgMenu.Items.Add(greenBg);
            customeBgMenu.Items.Add(blueBg);
            customeBgMenu.Items.Add("此功能必须戴一个背景秀才有效");
            customeBgMenu.ItemClicked += CustomeBgMenu_ItemClicked;

            monitorIcons = new MonitorIcons();


            // browser.DownloadHandler = new IEDownloadHandler();

            browser.LoadingStateChanged += Browser_LoadingStateChanged;
        }