2023-11-07 08:36:50 +00:00
using HtmlAgilityPack ;
2025-01-06 03:13:21 +00:00
using IfacesEnumsStructsClasses ;
2023-11-07 08:36:50 +00:00
using Itrycn_Project2 ;
2025-01-06 03:13:21 +00:00
using RaUI.UI.LayeredForm ;
2020-12-10 09:01:23 +00:00
using ryCommon ;
2021-06-12 14:09:28 +00:00
using ryCommonDb ;
2025-01-06 03:13:21 +00:00
using ryControls ;
using RyWeb ;
2020-12-10 09:01:23 +00:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Data ;
2025-01-06 03:13:21 +00:00
using System.Diagnostics ;
2020-12-10 09:01:23 +00:00
using System.Drawing ;
using System.Linq ;
using System.Text ;
2023-11-07 08:36:50 +00:00
using System.Threading ;
2020-12-10 09:01:23 +00:00
using System.Windows.Forms ;
2023-11-07 08:36:50 +00:00
using static System . Net . Mime . MediaTypeNames ;
using static System . Windows . Forms . VisualStyles . VisualStyleElement ;
2020-12-10 09:01:23 +00:00
namespace Itrycn_Project2
{
2021-06-12 14:09:28 +00:00
public partial class FrmStart : RySkins . SKinForm
2020-12-10 09:01:23 +00:00
{
2022-02-09 08:56:35 +00:00
/// <summary>
/// 最大日志数量
/// </summary>
private int MaxLogsCount { get ; set ; } = 1000 ;
2021-06-12 14:09:28 +00:00
readonly string [ ] prog_args ;
2020-12-10 09:01:23 +00:00
public FrmStart ( string [ ] args )
{
2025-01-06 03:13:21 +00:00
//var img = RyImage.LoadPic("http://pic.2265.com/upload/2024-2/2024261342151467.png");
2020-12-10 09:01:23 +00:00
InitializeComponent ( ) ;
prog_args = args ;
//配置软件信息
2021-06-12 14:09:28 +00:00
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 ( ) ; }
2020-12-10 09:01:23 +00:00
notifyIcon1 . Icon = Icon ;
2022-02-09 08:56:35 +00:00
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 ) {
2023-11-07 08:36:50 +00:00
LogInfo item = ( LogInfo ) e . Model ;
if ( item . Color ! = Color . Black )
{
e . Item . ForeColor = item . Color ;
}
2022-02-09 08:56:35 +00:00
} ;
2025-01-06 03:13:21 +00:00
//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 ;
2022-02-09 08:56:35 +00:00
}
/// <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 { }
2020-12-10 09:01:23 +00:00
}
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 )
{
2023-11-07 08:36:50 +00:00
System . Windows . Forms . Application . Exit ( ) ;
2020-12-10 09:01:23 +00:00
}
private void FrmStart_Shown ( object sender , EventArgs e )
{
2021-06-12 14:09:28 +00:00
ryCommon . Ini ini = new Ini ( Soft_ConstInfo . UserDataFolder + "\\Win.dat" ) ;
ini . WriteIni ( Soft_ConstInfo . Soft_Id , "hwnd" , Handle . ToInt32 ( ) ) ;
2020-12-10 09:01:23 +00:00
if ( prog_args . Length > = 1 )
{
//如果是自启动,并且开启了右下角托盘图标,则隐藏自身。
2021-06-12 14:09:28 +00:00
if ( prog_args [ 0 ] = = Soft_ConstInfo . Soft_Pram & & Soft_ConstInfo . ShowTray )
2020-12-10 09:01:23 +00:00
this . Hide ( ) ;
}
}
private void FrmStart_FormClosing ( object sender , FormClosingEventArgs e )
{
2021-06-12 14:09:28 +00:00
if ( Soft_ConstInfo . ShowTray & & Public_Config . HideByCloseBtn & & e . CloseReason = = CloseReason . UserClosing )
2020-12-10 09:01:23 +00:00
{
e . Cancel = true ;
this . Hide ( ) ;
2021-06-12 14:09:28 +00:00
notifyIcon1 . ShowBalloonTip ( 3000 , Soft_ConstInfo . Soft_Title , "软件已经最小化到此处,请右击托盘图标进行关闭。" , ToolTipIcon . Info ) ;
2020-12-10 09:01:23 +00:00
return ;
}
2021-06-12 14:09:28 +00:00
if ( ! Soft_MemInfo . IsCanCloseForm )
2020-12-10 09:01:23 +00:00
{
e . Cancel = true ;
2021-06-12 14:09:28 +00:00
RySkins . Msg . ShowMsg ( "当前还有操作正在运行,请稍后关闭软件。" , "提示" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
2020-12-10 09:01:23 +00:00
}
}
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 )
{
2021-06-12 14:09:28 +00:00
if ( Soft_ConstInfo . DonateVisabled )
2020-12-10 09:01:23 +00:00
{
FrmAbout frm = new FrmAbout ( ) ;
frm . ShowDialog ( ) ;
frm . Dispose ( ) ;
}
else
{
2021-06-12 14:09:28 +00:00
RySkins . Msg . ShowMsg ( Soft_ConstInfo . AboutText . Replace ( "#softname#" , Soft_ConstInfo . Soft_Title ) . Replace ( "#ver#" , "V" + RySoft . VersionStr ) , "提示" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
2020-12-10 09:01:23 +00:00
}
}
private void 打 开 官 网 ToolStripMenuItem_Click ( object sender , EventArgs e )
{
2021-06-12 14:09:28 +00:00
ryCommon . RyFiles . OpenUrl ( Soft_ConstInfo . Soft_Url ) ;
2020-12-10 09:01:23 +00:00
}
2023-11-07 08:36:50 +00:00
2020-12-10 09:01:23 +00:00
private void FrmStart_Load ( object sender , EventArgs e )
{
2025-01-06 03:13:21 +00:00
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;
2025-06-27 02:17:38 +00:00
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" ) ;
2025-01-06 03:13:21 +00:00
// 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");
2023-11-07 08:36:50 +00:00
//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("李凤鑫");
2021-06-15 01:41:34 +00:00
Public_Config . LoadSetting ( ) ;
2021-06-12 14:09:28 +00:00
//Itrycn_Project.Itrycn_Db.CreateTable();
//var dbver = Itrycn_Db.GetDbVer();
//if(dbver==1) //初始版本,并是当前要求的数据库
//{
2020-12-04 09:06:59 +00:00
2021-06-12 14:09:28 +00:00
//}
//else
//{
// MessageBox.Show("不支持当前数据库版本,这可能是以下原因导致的:\r\n1.数据库已损坏;'\r\n2.当前数据库是由新版软件创建的(请更新软件后重试)。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// Application.Exit();
// return;
//}
//IDbInterface db = new SQLiteDataProvider();
2025-01-06 03:13:21 +00:00
//if (db.ConnDb(@"E:\My Datas\毕方项目\CSharp\ryProcessManager\Bin\Debug\UserDb\MyDb.dat|ry3H3Db") == 1)
2021-06-12 14:09:28 +00:00
//{
//}
//db.Free();
LiveUpdate . RyUpdate update = new LiveUpdate . RyUpdate ( Soft_ConstInfo . Update_Url ) ;
update . CheckUpdate ( ) ;
2023-11-07 08:36:50 +00:00
//Thread th = new Thread(Start);
//th.Start();
//void Start()
//{
// while(true)
// {
// LvLogs.ClearObjects();
// AddLog("测试测试");
// Thread.Sleep(200);
// }
//}
2021-02-11 04:04:29 +00:00
}
2021-06-15 01:41:34 +00:00
private void 选 项 ToolStripMenuItem_Click ( object sender , EventArgs e )
{
FrmSetting frm = new FrmSetting ( ) ;
if ( frm . ShowDialog ( ) = = DialogResult . OK )
{
Public_Config . LoadSetting ( ) ;
}
frm . Dispose ( ) ;
}
2022-02-09 08:56:35 +00:00
/// <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 ;
}
2023-11-07 08:36:50 +00:00
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>";
//}
2025-01-06 03:13:21 +00:00
//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" ) ;
2023-11-07 08:36:50 +00:00
}
2020-12-10 09:01:23 +00:00
}
}