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()); }
private void 反馈send() { if (txt_问题反馈.Text != "") { var str = "sm=%E5%A4%A9%E8%8B%A5OCR%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB" + StaticValue.current_v + "&nr="; Post_Html("http://cd.ys168.com/f_ht/ajcx/lyd.aspx?cz=lytj&pdgk=1&pdgly=0&pdzd=0&tou=1&yzm=undefined&_dlmc=tianruoyouxin&_dlmm=", str + HttpUtility.UrlEncode(txt_问题反馈.Text)); txt_问题反馈.Text = ""; var fmflags = new FmFlags(); fmflags.Show(); fmflags.DrawStr("感谢您的反馈!"); return; } var fmflags2 = new FmFlags(); fmflags2.Show(); fmflags2.DrawStr("反馈文本不能为空"); }
private void doub_click(object sender, EventArgs e) { var flag = dataGridView1.SelectedCells[0].Value.ToString().Remove(0, 3) != ""; var flag2 = flag; var flag3 = flag2; var flag4 = flag3; var flag5 = flag4; var flag6 = flag5; var flag7 = flag6; var flag8 = flag7; if (flag8) { Clipboard.SetDataObject(dataGridView1.SelectedCells[0].Value.ToString().Remove(0, 3)); var fmflags = new FmFlags(); fmflags.Show(); fmflags.DrawStr("已复制"); } }
public static void CheckUpdate() { var html = WebHelper.GetHtmlContent("https://www.jianshu.com/p/3afe79471cb9"); if (string.IsNullOrEmpty(html)) { return; } var regex = Regex.Match(html, @"(?<=<pre><code>)[\s\S]+?(?=</code>)"); if (regex.Success) { var code = regex.Value.Trim(); var json = JObject.Parse(code); var newVersion = json["version"].Value <string>(); var curVersion = Application.ProductVersion; if (!CheckVersion(newVersion, curVersion)) { var ff = new FmFlags(); ff.Show(); ff.DrawStr("当前已是最新版本"); return; } var flagForm = new FmFlags(); flagForm.Show(); flagForm.DrawStr("有新版本:" + newVersion); var fullUpdate = json["full_update"].Value <bool>(); if (fullUpdate) { MessageBox.Show($"发现新版本:{newVersion},请到百度网盘下载!", "提醒"); Process.Start(json["pan_url"].Value <string>()); } else { Process.Start("Data\\update.exe", " " + json["main_url"].Value <string>() + " " + json["pan_url"].Value <string>() + " " + Path.Combine(Application.ExecutablePath, "天若OCR文字识别.exe")); Environment.Exit(0); } } }