Beispiel #1
0
        public static void Main(string[] args)
        {
            SetConfig();
            bool_error();
            checkTimer = new System.Timers.Timer();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var version = Environment.OSVersion.Version;
            var value   = new Version("6.1");

            factor = GetDpi_factor();
            if (version.CompareTo(value) >= 0)
            {
                SetProcessDPIAware();
            }

            ProgramStart();
            if (!createNew)
            {
                ProgramStarted.Set();
                var fmFlags = new FmFlags();
                fmFlags.Show();
                fmFlags.DrawStr("软件已经运行");
                return;
            }

            if (args.Length != 0 && args[0] == "更新")
            {
                new FmSetting
                {
                    Start_set = ""
                }.ShowDialog();
            }

            if (IniHelp.GetValue("更新", "检测更新") == "True" || IniHelp.GetValue("更新", "检测更新") == "发生错误")
            {
                new Thread(CheckUpdate).Start();
                if (IniHelp.GetValue("更新", "更新间隔") == "True")
                {
                    checkTimer.Enabled  = true;
                    checkTimer.Interval = 3600000.0 * Convert.ToInt32(IniHelp.GetValue("更新", "间隔时间"));
                    checkTimer.Elapsed += CheckTimer_Elapsed;
                    checkTimer.Start();
                }
            }
            else
            {
                var fmflags2 = new FmFlags();
                fmflags2.Show();
                fmflags2.DrawStr("天若OCR文字识别");
            }

            Application.Run(new FmMain());
        }
Beispiel #2
0
        public void Set_png()
        {
            string a;

            try
            {
                a = IniHelp.GetValue("配置", "窗体动画");
            }
            catch
            {
                a = "窗体";
            }
            var flag  = a == "少女";
            var flag2 = flag;
            var flag3 = flag2;
            var flag4 = flag3;
            var flag5 = flag4;
            var flag6 = flag5;

            if (flag6)
            {
                timer.Interval = 50;
                fla_1          = 27;
                fla_2          = "";
            }
            else
            {
                var flag7  = a == "罗小黑";
                var flag8  = flag7;
                var flag9  = flag8;
                var flag10 = flag9;
                var flag11 = flag10;
                var flag12 = flag11;
                if (flag12)
                {
                    timer.Interval = 18;
                    fla_1          = 46;
                    fla_2          = "_luo";
                }
                else
                {
                    timer.Interval = 80;
                    fla_1          = 4;
                    fla_2          = "_load";
                }
            }
            bgImg       = null;
            i_c         = 0;
            timer.Tick += timer1_Tick;
            timer.Start();
        }
Beispiel #3
0
 public void cclick()
 {
     try
     {
         if (IniHelp.GetValue("特殊", "ali_account").Trim() != "" && IniHelp.GetValue("特殊", "ali_password").Trim() != "")
         {
             WebBrowserHelper.GetDocumentFromWindow(webBrowser1.Document.Window.Frames["alibaba-login-box"].DomWindow as IHTMLWindow2).getElementById("fm-login-id").setAttribute("value", IniHelp.GetValue("特殊", "ali_account"), 1);
             WebBrowserHelper.GetDocumentFromWindow(webBrowser1.Document.Window.Frames["alibaba-login-box"].DomWindow as IHTMLWindow2).getElementById("fm-login-password").setAttribute("value", IniHelp.GetValue("特殊", "ali_password"), 1);
         }
     }
     catch
     {
     }
 }
Beispiel #4
0
        public static void bool_error()
        {
            if (IniHelp.GetValue("配置", "接口") == "发生错误")
            {
                IniHelp.SetValue("配置", "接口", "搜狗");
            }

            if (IniHelp.GetValue("配置", "开机自启") == "发生错误")
            {
                IniHelp.SetValue("配置", "开机自启", "True");
            }

            if (IniHelp.GetValue("配置", "快速翻译") == "发生错误")
            {
                IniHelp.SetValue("配置", "快速翻译", "True");
            }

            if (IniHelp.GetValue("配置", "识别弹窗") == "发生错误")
            {
                IniHelp.SetValue("配置", "识别弹窗", "True");
            }

            if (IniHelp.GetValue("配置", "窗体动画") == "发生错误")
            {
                IniHelp.SetValue("配置", "窗体动画", "窗体");
            }

            if (IniHelp.GetValue("配置", "记录数目") == "发生错误")
            {
                IniHelp.SetValue("配置", "记录数目", "20");
            }

            if (IniHelp.GetValue("配置", "自动保存") == "发生错误")
            {
                IniHelp.SetValue("配置", "自动保存", "True");
            }

            if (IniHelp.GetValue("配置", "翻译接口") == "发生错误")
            {
                IniHelp.SetValue("配置", "翻译接口", "谷歌");
            }

            if (IniHelp.GetValue("配置", "截图位置") == "发生错误")
            {
                IniHelp.SetValue("配置", "截图位置", Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
            }

            if (IniHelp.GetValue("快捷键", "文字识别") == "发生错误")
            {
                IniHelp.SetValue("快捷键", "文字识别", "F4");
            }

            if (IniHelp.GetValue("快捷键", "翻译文本") == "发生错误")
            {
                IniHelp.SetValue("快捷键", "翻译文本", "F9");
            }

            if (IniHelp.GetValue("快捷键", "记录界面") == "发生错误")
            {
                IniHelp.SetValue("快捷键", "记录界面", "请按下快捷键");
            }

            if (IniHelp.GetValue("快捷键", "识别界面") == "发生错误")
            {
                IniHelp.SetValue("快捷键", "识别界面", "请按下快捷键");
            }

            if (IniHelp.GetValue("密钥_百度", "secret_id") == "发生错误")
            {
                IniHelp.SetValue("密钥_百度", "secret_id", "YsZKG1wha34PlDOPYaIrIIKO");
            }

            if (IniHelp.GetValue("密钥_百度", "secret_key") == "发生错误")
            {
                IniHelp.SetValue("密钥_百度", "secret_key", "HPRZtdOHrdnnETVsZM2Nx7vbDkMfxrkD");
            }

            if (IniHelp.GetValue("代理", "代理类型") == "发生错误")
            {
                IniHelp.SetValue("代理", "代理类型", "系统代理");
            }

            if (IniHelp.GetValue("代理", "服务器") == "发生错误")
            {
                IniHelp.SetValue("代理", "服务器", "");
            }

            if (IniHelp.GetValue("代理", "端口") == "发生错误")
            {
                IniHelp.SetValue("代理", "端口", "");
            }

            if (IniHelp.GetValue("代理", "需要密码") == "发生错误")
            {
                IniHelp.SetValue("代理", "需要密码", "False");
            }

            if (IniHelp.GetValue("代理", "服务器账号") == "发生错误")
            {
                IniHelp.SetValue("代理", "服务器账号", "");
            }

            if (IniHelp.GetValue("代理", "服务器密码") == "发生错误")
            {
                IniHelp.SetValue("代理", "服务器密码", "");
            }

            if (IniHelp.GetValue("更新", "检测更新") == "发生错误")
            {
                IniHelp.SetValue("更新", "检测更新", "True");
            }

            if (IniHelp.GetValue("更新", "更新间隔") == "发生错误")
            {
                IniHelp.SetValue("更新", "更新间隔", "True");
            }

            if (IniHelp.GetValue("更新", "间隔时间") == "发生错误")
            {
                IniHelp.SetValue("更新", "间隔时间", "24");
            }

            if (IniHelp.GetValue("截图音效", "自动保存") == "发生错误")
            {
                IniHelp.SetValue("截图音效", "自动保存", "True");
            }

            if (IniHelp.GetValue("截图音效", "音效路径") == "发生错误")
            {
                IniHelp.SetValue("截图音效", "音效路径", "Data\\screenshot.wav");
            }

            if (IniHelp.GetValue("截图音效", "粘贴板") == "发生错误")
            {
                IniHelp.SetValue("截图音效", "粘贴板", "False");
            }

            if (IniHelp.GetValue("工具栏", "合并") == "发生错误")
            {
                IniHelp.SetValue("工具栏", "合并", "False");
            }

            if (IniHelp.GetValue("工具栏", "拆分") == "发生错误")
            {
                IniHelp.SetValue("工具栏", "拆分", "False");
            }

            if (IniHelp.GetValue("工具栏", "检查") == "发生错误")
            {
                IniHelp.SetValue("工具栏", "检查", "False");
            }

            if (IniHelp.GetValue("工具栏", "翻译") == "发生错误")
            {
                IniHelp.SetValue("工具栏", "翻译", "False");
            }

            if (IniHelp.GetValue("工具栏", "分段") == "发生错误")
            {
                IniHelp.SetValue("工具栏", "分段", "False");
            }

            if (IniHelp.GetValue("工具栏", "分栏") == "发生错误")
            {
                IniHelp.SetValue("工具栏", "分栏", "False");
            }

            if (IniHelp.GetValue("工具栏", "顶置") == "发生错误")
            {
                IniHelp.SetValue("工具栏", "顶置", "True");
            }

            if (IniHelp.GetValue("取色器", "类型") == "发生错误")
            {
                IniHelp.SetValue("取色器", "类型", "RGB");
            }

            if (IniHelp.GetValue("特殊", "ali_cookie") == "发生错误")
            {
                IniHelp.SetValue("特殊", "ali_cookie",
                                 "cna=noXhE38FHGkCAXDve7YaZ8Tn; cnz=noXhE4/VhB8CAbZ773ApeV14; isg=BGJi2c2YTeeP6FG7S_Re8kveu-jEs2bNwToQnKz7jlWAfwL5lEO23eh9q3km9N5l; ");
            }

            if (IniHelp.GetValue("特殊", "ali_account") == "发生错误")
            {
                IniHelp.SetValue("特殊", "ali_account", "");
            }

            if (IniHelp.GetValue("特殊", "ali_password") == "发生错误")
            {
                IniHelp.SetValue("特殊", "ali_password", "");
            }
        }
Beispiel #5
0
        public void readIniFile()
        {
            var value = IniHelp.GetValue("配置", "开机自启");

            if (value == "发生错误")
            {
                cbBox_开机.Checked = true;
            }
            try
            {
                cbBox_开机.Checked = Convert.ToBoolean(value);
            }
            catch
            {
                cbBox_开机.Checked = true;
            }
            var value2 = IniHelp.GetValue("配置", "快速翻译");

            if (value2 == "发生错误")
            {
                cbBox_翻译.Checked = true;
            }
            try
            {
                cbBox_翻译.Checked = Convert.ToBoolean(value2);
            }
            catch
            {
                cbBox_翻译.Checked = true;
            }
            var value3 = IniHelp.GetValue("配置", "识别弹窗");

            if (value3 == "发生错误")
            {
                cbBox_弹窗.Checked = true;
            }
            try
            {
                cbBox_弹窗.Checked = Convert.ToBoolean(value3);
            }
            catch
            {
                cbBox_弹窗.Checked = true;
            }
            var value4 = IniHelp.GetValue("配置", "窗体动画");

            cobBox_动画.Text = value4;
            if (value4 == "发生错误")
            {
                cobBox_动画.Text = "窗体";
            }
            var value5 = IniHelp.GetValue("配置", "记录数目");

            numbox_记录.Value = Convert.ToInt32(value5);
            if (value5 == "发生错误")
            {
                numbox_记录.Value = 20m;
            }
            var value6 = IniHelp.GetValue("配置", "自动保存");

            if (value6 == "发生错误")
            {
                cbBox_保存.Checked = false;
            }
            try
            {
                cbBox_保存.Checked = Convert.ToBoolean(value6);
            }
            catch
            {
                cbBox_保存.Checked = false;
            }
            if (cbBox_保存.Checked)
            {
                textBox_path.Enabled = true;
                btn_浏览.Enabled       = true;
            }
            if (!cbBox_保存.Checked)
            {
                textBox_path.Enabled = false;
                btn_浏览.Enabled       = false;
            }
            var value7 = IniHelp.GetValue("配置", "截图位置");

            textBox_path.Text = value7;
            if (value7 == "发生错误")
            {
                textBox_path.Text = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            }
            var value8 = IniHelp.GetValue("快捷键", "文字识别");

            txtBox_文字识别.Text = value8;
            if (value8 == "发生错误")
            {
                txtBox_文字识别.Text = "F4";
            }
            var value9 = IniHelp.GetValue("快捷键", "翻译文本");

            txtBox_翻译文本.Text = value9;
            if (value9 == "发生错误")
            {
                txtBox_翻译文本.Text = "F9";
            }
            var value10 = IniHelp.GetValue("快捷键", "记录界面");

            txtBox_记录界面.Text = value10;
            if (value10 == "发生错误")
            {
                txtBox_记录界面.Text = "请按下快捷键";
            }
            var value11 = IniHelp.GetValue("快捷键", "识别界面");

            txtBox_识别界面.Text = value11;
            if (value11 == "发生错误")
            {
                txtBox_识别界面.Text = "请按下快捷键";
            }
            pictureBox_文字识别.Image = txtBox_文字识别.Text == "请按下快捷键" ? Resources.快捷键_0 : Resources.快捷键_1;
            pictureBox_翻译文本.Image = txtBox_翻译文本.Text == "请按下快捷键" ? Resources.快捷键_0 : Resources.快捷键_1;
            pictureBox_记录界面.Image = txtBox_记录界面.Text == "请按下快捷键" ? Resources.快捷键_0 : Resources.快捷键_1;
            pictureBox_识别界面.Image = txtBox_识别界面.Text == "请按下快捷键" ? Resources.快捷键_0 : Resources.快捷键_1;
            var value12 = IniHelp.GetValue("密钥_百度", "secret_id");

            text_baiduaccount.Text = value12;
            if (value12 == "发生错误")
            {
                text_baiduaccount.Text = "YsZKG1wha34PlDOPYaIrIIKO";
            }
            var value13 = IniHelp.GetValue("密钥_百度", "secret_key");

            text_baidupassword.Text = value13;
            if (value13 == "发生错误")
            {
                text_baidupassword.Text = "HPRZtdOHrdnnETVsZM2Nx7vbDkMfxrkD";
            }
            var value14 = IniHelp.GetValue("代理", "代理类型");

            combox_代理.Text = value14;
            if (value14 == "发生错误")
            {
                combox_代理.Text = "系统代理";
            }
            if (combox_代理.Text == "不使用代理" || combox_代理.Text == "系统代理")
            {
                text_账号.Enabled     = false;
                text_密码.Enabled     = false;
                chbox_代理服务器.Enabled = false;
                text_端口.Enabled     = false;
                text_服务器.Enabled    = false;
            }
            if (combox_代理.Text == "自定义代理")
            {
                text_端口.Enabled  = true;
                text_服务器.Enabled = true;
            }
            var value15 = IniHelp.GetValue("代理", "服务器");

            text_服务器.Text = value15;
            if (value15 == "发生错误")
            {
                text_服务器.Text = "127.0.0.1";
            }
            var value16 = IniHelp.GetValue("代理", "端口");

            text_端口.Text = value16;
            if (value16 == "发生错误")
            {
                text_端口.Text = "1080";
            }
            var value17 = IniHelp.GetValue("代理", "需要密码");

            if (value17 == "发生错误")
            {
                chbox_代理服务器.Checked = false;
            }
            try
            {
                chbox_代理服务器.Checked = Convert.ToBoolean(value17);
            }
            catch
            {
                chbox_代理服务器.Checked = false;
            }
            var value18 = IniHelp.GetValue("代理", "服务器账号");

            text_账号.Text = value18;
            if (value18 == "发生错误")
            {
                text_账号.Text = "";
            }
            var value19 = IniHelp.GetValue("代理", "服务器密码");

            text_密码.Text = value19;
            if (value19 == "发生错误")
            {
                text_密码.Text = "";
            }
            if (chbox_代理服务器.Checked)
            {
                text_账号.Enabled = true;
                text_密码.Enabled = true;
            }
            if (!chbox_代理服务器.Checked)
            {
                text_账号.Enabled = false;
                text_密码.Enabled = false;
            }
            var value20 = IniHelp.GetValue("更新", "检测更新");

            if (value20 == "发生错误")
            {
                check_检查更新.Checked = false;
            }
            try
            {
                check_检查更新.Checked = Convert.ToBoolean(value20);
            }
            catch
            {
                check_检查更新.Checked = false;
            }
            if (check_检查更新.Checked)
            {
                checkBox_更新间隔.Enabled = true;
            }
            if (!check_检查更新.Checked)
            {
                checkBox_更新间隔.Enabled = false;
                numbox_间隔时间.Enabled   = false;
            }
            var value21 = IniHelp.GetValue("更新", "更新间隔");

            if (value21 == "发生错误")
            {
                checkBox_更新间隔.Checked = false;
            }
            try
            {
                checkBox_更新间隔.Checked = Convert.ToBoolean(value21);
            }
            catch
            {
                checkBox_更新间隔.Checked = false;
            }
            if (checkBox_更新间隔.Checked)
            {
                numbox_间隔时间.Enabled = true;
            }
            if (!checkBox_更新间隔.Checked)
            {
                numbox_间隔时间.Enabled = false;
            }
            var value22 = IniHelp.GetValue("更新", "间隔时间");

            numbox_间隔时间.Value = Convert.ToInt32(value22);
            if (value5 == "发生错误")
            {
                numbox_间隔时间.Value = 24m;
            }
            var value23 = IniHelp.GetValue("截图音效", "粘贴板");

            if (value23 == "发生错误")
            {
                chbox_copy.Checked = false;
            }
            try
            {
                chbox_copy.Checked = Convert.ToBoolean(value23);
            }
            catch
            {
                chbox_copy.Checked = false;
            }
            var value24 = IniHelp.GetValue("截图音效", "自动保存");

            if (value24 == "发生错误")
            {
                chbox_save.Checked = true;
            }
            try
            {
                chbox_save.Checked = Convert.ToBoolean(value24);
            }
            catch
            {
                chbox_save.Checked = true;
            }
            var value25 = IniHelp.GetValue("截图音效", "音效路径");

            text_音效path.Text = value25;
            if (value25 == "发生错误")
            {
                text_音效path.Text = "Data\\screenshot.wav";
            }
            var value26 = IniHelp.GetValue("取色器", "类型");

            if (value26 == "发生错误")
            {
                chbox_取色.Checked = false;
            }
            if (value26 == "RGB")
            {
                chbox_取色.Checked = false;
            }
            if (value26 == "HEX")
            {
                chbox_取色.Checked = true;
            }
        }