### RaUI V4.0.2506.2701 - *.[新增]RediskCheck类新增支持对.NET3.5和.NET6-.NET9安装状态的判断。 - *.[新增]RyImage类的LoadPic方法新增Timeout参数设置。 - *.[新增]ChromeTabControl控件新增OnTabAddButtonClick和OnTabCloseButtonClick事件。 - *.[新增]Strings类新增GetEngOrNumPos方法,获取字符串里的英文或数字。 - *.[改进]ChromeTabControl默认风格改进。 - *.[改进]GetTimeStr新增ShowSeconds参数。 - *.[改进]RyImage.LoadPic获取网络图片时,UA改为Edge的UA。 - *.[改进]ListBoxEx从内部控件改为公开控件。 - *.[修复]AddHosts(string list,bool write)函数write为false时,不再写入hosts。 - *.[修复]修复无法在属性界面修改RichTextBox2的WordWrap属性的BUG。 - *.[修复]修复ApkOp读取apk内部版本号时,如果版本号带数字0可能无法读取的BUG。 - *.[修复]修复GetVerByVerStr传入null值会报错的BUG。 - *.[修复]修复ComboBoxEx2控件修改SelectedItem和SelectedIndex属性不会激发SelectedIndexChanged事件的BUG。 - *.[修复]修复ApkOp解压某些apk文件时,可能导致文件被占用的BUG。 - *.[修复]修复TextBoxEx2控件通过代码设置文本,无法触发文本变化事件的BUG。 - *.[修复]修复TextBoxEx2控件使用Tab按键,无法切换输入的BUG。
434 lines
20 KiB
C#
434 lines
20 KiB
C#
using HtmlAgilityPack;
|
||
using IfacesEnumsStructsClasses;
|
||
using Itrycn_Project2;
|
||
using RaUI.UI.LayeredForm;
|
||
using ryCommon;
|
||
using ryCommonDb;
|
||
using ryControls;
|
||
using RyWeb;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Diagnostics;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading;
|
||
using System.Windows.Forms;
|
||
using static System.Net.Mime.MediaTypeNames;
|
||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||
|
||
namespace Itrycn_Project2
|
||
{
|
||
public partial class FrmStart : RySkins.SKinForm
|
||
{
|
||
/// <summary>
|
||
/// 最大日志数量
|
||
/// </summary>
|
||
private int MaxLogsCount { get; set; } = 1000;
|
||
readonly string[] prog_args;
|
||
public FrmStart(string[] args)
|
||
{
|
||
//var img = RyImage.LoadPic("http://pic.2265.com/upload/2024-2/2024261342151467.png");
|
||
InitializeComponent();
|
||
prog_args = args;
|
||
//配置软件信息
|
||
notifyIcon1.Text = Soft_ConstInfo.Soft_Title;
|
||
Text = Soft_ConstInfo.Soft_Title + " V" + RySoft.VersionStr;
|
||
if (!Soft_ConstInfo.ShowTray) { notifyIcon1.Visible = false; }
|
||
if (!Soft_ConstInfo.DonateVisabled) { 捐助ToolStripMenuItem.Text = "关于"; }
|
||
if (Soft_ConstInfo.Soft_Url.Length == 0) { 打开官网ToolStripMenuItem.PerformClick(); }
|
||
notifyIcon1.Icon = Icon;
|
||
OlvLogTime.AspectGetter = delegate (object x) { return ((LogInfo)x).LogTime.ToDateTimeStr(); };
|
||
OlvLogText.AspectGetter = delegate (object x) { return ((LogInfo)x).LogText; };
|
||
LvLogs.FormatRow += delegate (object x, BrightIdeasSoftware.FormatRowEventArgs e) {
|
||
LogInfo item = (LogInfo)e.Model;
|
||
if (item.Color != Color.Black)
|
||
{
|
||
e.Item.ForeColor = item.Color;
|
||
}
|
||
};
|
||
//var href = "http://www.87g.com/youxi/4740.html";
|
||
//var dd = href.StartsWith("@");
|
||
//var kk= GetSection(RyFiles.ReadAllText("E:\\My Datas\\My Codes\\毕方项目\\CSharp\\ryProcessManager\\Bin\\Debug\\11111111.txt"),"//h3 | //h4");
|
||
//HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
|
||
//htmlDoc.LoadHtml("<div class=\"inlink_div\"><h4>您还感兴趣</h4><p class=\"inlink_p\"><span> <a href=\"http://www.87g.com/youxi/4740.html\" class=\"inlink_page\" target=\"_blank\">水果缤纷手游下载</a>:《水果缤纷》作为一款休闲消除类手机游戏,现游戏安卓版本可供玩家试玩。当各种缤纷水果来袭,绝对让你眼花缭乱,还能分得清水果品种去准确消除么?快加入游戏,看看你的眼力!</span><span> <a href=\"http://www.87g.com/youxi/56805.html\" class=\"inlink_page\" target=\"_blank\">烦人的橘子游戏下载</a>:烦人的橘子是一款鬼畜趣味的水果作战游戏,延续了动漫中的怪物的角色形象和场景设计,借鉴了打棒球的游戏玩法,玩家需要抓住时机,将各种表情丑陋甚至看起来贱兮兮的水果一棒子打到指定的位置来闯关,超级魔性!</span></p></div>");
|
||
}
|
||
public static Dictionary<string, string> GetSection(string content_html, string xpath_section)
|
||
{
|
||
Dictionary<string, string> dict_section = new Dictionary<string, string>();
|
||
|
||
var html_item = Section(content_html, xpath_section, out string section_name2);
|
||
if (!dict_section.ContainsKey(section_name2)) { dict_section.Add(section_name2, html_item); }
|
||
string Section(string content, string section_xpath, out string section_name)
|
||
{
|
||
HtmlAgilityPack.HtmlDocument htmlDoc2 = new HtmlAgilityPack.HtmlDocument();
|
||
htmlDoc2.LoadHtml(content);
|
||
HtmlNodeCollection body_anchor = htmlDoc2.DocumentNode.SelectNodes("//body");//筛选出网站的链接
|
||
if (body_anchor != null && body_anchor.Count > 0)
|
||
{
|
||
htmlDoc2.LoadHtml(body_anchor[0].InnerHtml);
|
||
}
|
||
HtmlNode next;
|
||
HtmlNode child = htmlDoc2.DocumentNode.FirstChild;
|
||
string childname;
|
||
string html_text = "";
|
||
section_name = "";
|
||
while (child != null)
|
||
{
|
||
next = child.NextSibling;
|
||
#region 获取节点信息
|
||
//lastName = childname;
|
||
if (child.NodeType == HtmlNodeType.Element)
|
||
{
|
||
childname = child.Name.ToLower();
|
||
//RyFiles.WriteAllText(Application.StartupPath+"\\11111111.txt", content_html);
|
||
HtmlAgilityPack.HtmlDocument htmlDoc_item = new HtmlAgilityPack.HtmlDocument();
|
||
htmlDoc_item.LoadHtml(child.OuterHtml);
|
||
HtmlNodeCollection an_xpath = htmlDoc_item.DocumentNode.SelectNodes(section_xpath);//筛选出网站的链接
|
||
if (an_xpath != null && an_xpath.Count > 0) //如果包含段落,则继续进入查看
|
||
{
|
||
if (an_xpath[0].ParentNode == null || an_xpath[0].ParentNode.NodeType == HtmlNodeType.Document)
|
||
{
|
||
if (section_name.Length == 0) { section_name = "总览"; }
|
||
if (dict_section.ContainsKey(section_name)) { dict_section[section_name] = html_text; }
|
||
else { dict_section.Add(section_name, html_text); }
|
||
section_name = an_xpath[0].InnerText.Trim();
|
||
html_text = "";
|
||
}
|
||
else
|
||
{
|
||
return Section(child.InnerHtml, section_xpath, out section_name);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (child.Name.ToLower() == "br")
|
||
{ html_text += "\r\n"; }
|
||
else if (child.Name.ToLower() == "p")
|
||
{ html_text += "\r\n" + child.OuterHtml; }
|
||
else
|
||
{
|
||
html_text += child.OuterHtml;
|
||
}
|
||
}
|
||
}
|
||
else if (child.NodeType == HtmlNodeType.Text)
|
||
{
|
||
html_text += child.OuterHtml;
|
||
}
|
||
#endregion
|
||
child = next;
|
||
}
|
||
return html_text;
|
||
}
|
||
return dict_section;
|
||
}
|
||
/// <summary>
|
||
/// 添加日志
|
||
/// </summary>
|
||
/// <param name="log"></param>
|
||
public void AddLog(string log)
|
||
{
|
||
AddLog(log, "", Color.Black);
|
||
}
|
||
/// <summary>
|
||
/// 添加日志
|
||
/// </summary>
|
||
/// <param name="log"></param>
|
||
/// <param name="color"></param>
|
||
public void AddLog(string log, Color color)
|
||
{
|
||
AddLog(log, "", color);
|
||
}
|
||
/// <summary>
|
||
/// 添加日志
|
||
/// </summary>
|
||
/// <param name="log"></param>
|
||
/// <param name="tag"></param>
|
||
/// <param name="color"></param>
|
||
public void AddLog(string log, string tag, Color color)
|
||
{
|
||
try
|
||
{
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
var count = LvLogs.GetItemCount();
|
||
if (count > MaxLogsCount)
|
||
{
|
||
LvLogs.RemoveObject(LvLogs.GetModelObject(count-1));
|
||
}
|
||
LvLogs.InsertObjects(0, new LogInfo[] { new LogInfo() { LogTime = DateTime.Now, LogText = log,LogTag=tag, Color = color } });
|
||
OlvLogTime.Text = "时间(" + LvLogs.GetItemCount() + ")";
|
||
}));
|
||
}
|
||
catch { }
|
||
}
|
||
private void 显示主窗体ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
this.WindowState = FormWindowState.Normal;
|
||
var topmost = this.TopMost;
|
||
this.TopMost = true;
|
||
this.Show();
|
||
this.TopMost = topmost;
|
||
}
|
||
|
||
private void 退出软件ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
System.Windows.Forms.Application.Exit();
|
||
}
|
||
private void FrmStart_Shown(object sender, EventArgs e)
|
||
{
|
||
ryCommon.Ini ini = new Ini(Soft_ConstInfo.UserDataFolder + "\\Win.dat");
|
||
ini.WriteIni(Soft_ConstInfo.Soft_Id, "hwnd", Handle.ToInt32());
|
||
if (prog_args.Length >= 1)
|
||
{
|
||
//如果是自启动,并且开启了右下角托盘图标,则隐藏自身。
|
||
if (prog_args[0] == Soft_ConstInfo.Soft_Pram && Soft_ConstInfo.ShowTray)
|
||
this.Hide();
|
||
}
|
||
}
|
||
|
||
private void FrmStart_FormClosing(object sender, FormClosingEventArgs e)
|
||
{
|
||
if (Soft_ConstInfo.ShowTray && Public_Config.HideByCloseBtn && e.CloseReason== CloseReason.UserClosing)
|
||
{
|
||
e.Cancel = true;
|
||
this.Hide();
|
||
notifyIcon1.ShowBalloonTip(3000, Soft_ConstInfo.Soft_Title, "软件已经最小化到此处,请右击托盘图标进行关闭。", ToolTipIcon.Info);
|
||
return;
|
||
}
|
||
if (!Soft_MemInfo.IsCanCloseForm)
|
||
{
|
||
e.Cancel = true;
|
||
RySkins.Msg.ShowMsg("当前还有操作正在运行,请稍后关闭软件。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
}
|
||
protected override void WndProc(ref System.Windows.Forms.Message msg)
|
||
{
|
||
switch (msg.Msg)
|
||
{
|
||
case 17189: //处理消息
|
||
{
|
||
#region 激活窗体
|
||
switch (msg.WParam.ToInt32())
|
||
{
|
||
case 100://
|
||
#region 显示界面
|
||
if ((int)msg.LParam.ToInt32() == 100)
|
||
{
|
||
this.Show();
|
||
this.WindowState = FormWindowState.Normal;
|
||
this.Top = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
||
this.Left = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
|
||
//RyForm.SetActiveWindow(Handle);
|
||
RyForm.BringToTop(Handle);
|
||
显示主窗体ToolStripMenuItem.PerformClick();
|
||
this.BringToFront();
|
||
this.Select();
|
||
this.Focus();
|
||
RyForm.BringToTop(Handle);
|
||
}
|
||
#endregion
|
||
break;
|
||
}
|
||
#endregion
|
||
}
|
||
break;
|
||
default:
|
||
base.WndProc(ref msg);//调用基类函数处理非自定义消息。
|
||
break;
|
||
}
|
||
}
|
||
|
||
private void 捐助ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
if (Soft_ConstInfo.DonateVisabled)
|
||
{
|
||
FrmAbout frm = new FrmAbout();
|
||
frm.ShowDialog();
|
||
frm.Dispose();
|
||
}
|
||
else
|
||
{
|
||
|
||
RySkins.Msg.ShowMsg(Soft_ConstInfo.AboutText.Replace("#softname#", Soft_ConstInfo.Soft_Title).Replace("#ver#", "V" + RySoft.VersionStr), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
}
|
||
|
||
|
||
private void 打开官网ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
ryCommon.RyFiles.OpenUrl(Soft_ConstInfo.Soft_Url);
|
||
}
|
||
|
||
private void FrmStart_Load(object sender, EventArgs e)
|
||
{
|
||
ryComboBox1.SelectedIndex=0;
|
||
//var process = Process.GetProcessesByName("bds");
|
||
//System.Net.ServicePointManager.DefaultConnectionLimit = 50;
|
||
QuickWeb web = new QuickWeb();
|
||
var http = web.UrlEncode("猫咪——安安");
|
||
//web.Referer = "http://k73dx12.tengapk.com/android/dreamhouse.mod.apk";
|
||
//var kk = web.GetSize("http://42.248.92.71:2080/k73dx12.tengapk.com/android/dreamhouse.mod.apk?wsiphost=ipdbme&wsrid_tag=66b17fe7_PS-HYN-01IIQ27_63791-5797-s1t1722908647649&ip_type=0");
|
||
//IDbInterface db = new MySqlDataProvider();
|
||
//var aa= RyImage.LoadPic("C:\\Users\\李凤鑫\\Desktop\\2024115135247764860.png");
|
||
//RyWeb.QuickWeb web = new RyWeb.QuickWeb();
|
||
//var size= web.GetSize("https://oss-admin.blazingcats.com/Product/Package/100_llfz_101_llfzgw_1656930048.apk");
|
||
//size = web.GetSize("https://oss-admin.blazingcats.com/Product/Package/100_llfz_101_llfzgw_1656930048.apk");
|
||
//textBox2.Text = web.Get("https://apkpure.com/cn/animation-throwdown-epic-ccg/com.kongregate.mobile.throwdown.google/download").Html;
|
||
ryCommon.ApkOp apkOp = new ApkOp();
|
||
apkOp.AAPT_Path = "E:\\My Datas\\My Codes\\毕方项目\\CSharp\\ryProcessManager\\Bin\\Debug\\SysDb\\Tools\\ApkLook\\aapt.exe";
|
||
var kk = apkOp.Read_Apk("C:\\Users\\zilin\\Desktop\\Measure X.apk");
|
||
// objectListView1.InsertObjects(0, new LogInfo[] { new LogInfo() });
|
||
//var en= ryCommon.TxtFileEncoder.GetEncoding(@"E:\My Datas\毕方项目\CSharp\ryProcessManager\Bin\Debug\SysDb\applist.lst");
|
||
//var hosts = ryCommon.RyFiles.ReadAllText(@"E:\My Datas\毕方项目\CSharp\ryProcessManager\Bin\Debug\UserDb\Hosts.txt");
|
||
//var result = ryCommon.Hosts.AddHosts(hosts);
|
||
//var kk= ryCommon.ProcessExt.GetPath(24348);
|
||
//var img = RyImage.LoadPic(@"C:\Users\zilin\Desktop\1.jpg");
|
||
//var watermark =new Bitmap(RyImage.LoadPic(@"C:\Users\zilin\Desktop\water.png"));
|
||
//var pos= new List<WatermarkPosition>(new WatermarkPosition[] { WatermarkPosition.FullScreenTile });
|
||
//pictureBox1.Image = img.ReSizeW(300);
|
||
//pictureBox1.Image= img.DrawWatermark(watermark, WatermarkPosition.FullScreenTile, 0,0,20f);
|
||
//ryCommon.PinYin.Convert("李凤鑫");
|
||
Public_Config.LoadSetting();
|
||
//Itrycn_Project.Itrycn_Db.CreateTable();
|
||
//var dbver = Itrycn_Db.GetDbVer();
|
||
//if(dbver==1) //初始版本,并是当前要求的数据库
|
||
//{
|
||
|
||
//}
|
||
//else
|
||
//{
|
||
// MessageBox.Show("不支持当前数据库版本,这可能是以下原因导致的:\r\n1.数据库已损坏;'\r\n2.当前数据库是由新版软件创建的(请更新软件后重试)。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
// Application.Exit();
|
||
// return;
|
||
//}
|
||
//IDbInterface db = new SQLiteDataProvider();
|
||
//if (db.ConnDb(@"E:\My Datas\毕方项目\CSharp\ryProcessManager\Bin\Debug\UserDb\MyDb.dat|ry3H3Db") == 1)
|
||
//{
|
||
//}
|
||
//db.Free();
|
||
LiveUpdate.RyUpdate update = new LiveUpdate.RyUpdate(Soft_ConstInfo.Update_Url);
|
||
update.CheckUpdate();
|
||
//Thread th = new Thread(Start);
|
||
//th.Start();
|
||
//void Start()
|
||
//{
|
||
// while(true)
|
||
// {
|
||
// LvLogs.ClearObjects();
|
||
// AddLog("测试测试");
|
||
// Thread.Sleep(200);
|
||
// }
|
||
//}
|
||
}
|
||
|
||
private void 选项ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
FrmSetting frm = new FrmSetting();
|
||
if(frm.ShowDialog()==DialogResult.OK)
|
||
{
|
||
Public_Config.LoadSetting();
|
||
}
|
||
frm.Dispose();
|
||
}
|
||
/// <summary>
|
||
/// 日志信息
|
||
/// </summary>
|
||
public class LogInfo
|
||
{
|
||
/// <summary>
|
||
/// 日志时间
|
||
/// </summary>
|
||
public DateTime LogTime { get; set; } = DateTime.Now;
|
||
/// <summary>
|
||
/// 日志内容
|
||
/// </summary>
|
||
public string LogText { get; set; }
|
||
/// <summary>
|
||
/// 日志Tag
|
||
/// </summary>
|
||
public string LogTag { get; set; }
|
||
/// <summary>
|
||
/// 日志文字颜色
|
||
/// </summary>
|
||
public Color Color { get; set; } = Color.Black;
|
||
}
|
||
|
||
private void Button1_Click(object sender, EventArgs e)
|
||
{
|
||
LvLogs.ClearObjects();
|
||
AddLog("测试测试");
|
||
}
|
||
|
||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||
{
|
||
//var text = "";
|
||
//try
|
||
//{
|
||
// HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
|
||
// htmlDoc.LoadHtml(textBox2.Text);
|
||
// HtmlNodeCollection anchors = htmlDoc.DocumentNode.SelectNodes(textBox1.Text);
|
||
// if (anchors != null)
|
||
// {
|
||
// for (int i = 0; i < anchors.Count; i++)
|
||
// {
|
||
// if (text != "") { text += "<br><br>"; }
|
||
// if (i % 2 == 0)
|
||
// {
|
||
// text += "<span style='color:green'>" + System.Web.HttpUtility.HtmlEncode(anchors[i].OuterHtml) + "</span>";
|
||
// }
|
||
// else
|
||
// {
|
||
// text += "<span style='color:blue'>" + System.Web.HttpUtility.HtmlEncode(anchors[i].OuterHtml) + "</span>";
|
||
// }
|
||
// }
|
||
// }
|
||
//}
|
||
//catch (Exception ex){
|
||
// text = "<span style='color:red'>" + System.Web.HttpUtility.HtmlEncode(ex.Message) + "</span>";
|
||
//}
|
||
//htmlPanel1.Text = System.Web.HttpUtility.HtmlEncode(textBox1.Text);
|
||
}
|
||
ILayeredForm subForm = null;
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
subForm = new FormTest();
|
||
subForm.Layered(button2);
|
||
subForm.Disposed += (a, b) =>
|
||
{
|
||
subForm = null;
|
||
};
|
||
subForm.Show();
|
||
}
|
||
|
||
private void button3_Click(object sender, EventArgs e)
|
||
{
|
||
Form form=(Form)Activator.CreateInstance(typeof(FrmTest2)); ;
|
||
ShowInCenter(form, this);
|
||
ryCommon.RyForm.BringToTop(form.Handle);
|
||
ryCommon.RyForm.SetActiveWindow(form.Handle);
|
||
try
|
||
{
|
||
if (!form.IsDisposed) form.Show();
|
||
}
|
||
catch { }
|
||
}
|
||
|
||
private void textBoxEx21_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
MessageBox.Show("111");
|
||
}
|
||
}
|
||
|
||
private void textBoxEx21_LongTimeNoChanged(object sender, EventArgs e)
|
||
{
|
||
MessageBox.Show("222");
|
||
}
|
||
}
|
||
}
|