4
4
using System . ComponentModel ;
5
5
using System . Data ;
6
6
using System . Drawing ;
7
+ using System . IO ;
7
8
using System . Linq ;
8
9
using System . Text ;
9
10
using System . Threading . Tasks ;
@@ -20,7 +21,6 @@ public FrmMain()
20
21
{
21
22
InitializeComponent ( ) ;
22
23
InitPhone ( ) ;
23
- lbPhone . SelectedIndex = 0 ;
24
24
}
25
25
26
26
private async void FrmMain_Load ( object sender , EventArgs e )
@@ -32,13 +32,25 @@ private async void FrmMain_Load(object sender, EventArgs e)
32
32
private void InitPhone ( )
33
33
{
34
34
lbPhone . Items . Clear ( ) ;
35
- lbPhone . Items . Add ( "13854236663" ) ;
36
- lbPhone . Items . Add ( "13026525330" ) ;
37
- lbPhone . Items . Add ( "17568914267" ) ;
38
- lbPhone . Items . Add ( "17568934267" ) ;
39
- lbPhone . Items . Add ( "18866488319" ) ;
40
- lbPhone . Items . Add ( "13708967268" ) ;
41
- lbPhone . Items . Add ( "13969776221" ) ;
35
+
36
+ // 方法1 (修改添加手机号需要重新生成exe)
37
+ // lbPhone.Items.Add("");
38
+
39
+ // 方法2 (修改添加手机号只需编辑config.txt文件即可)
40
+ string configDir = Path . Combine ( Environment . CurrentDirectory , "config.txt" ) ;
41
+ if ( File . Exists ( configDir ) )
42
+ {
43
+ var lines = File . ReadAllLines ( configDir ) ;
44
+ foreach ( string line in lines )
45
+ {
46
+ lbPhone . Items . Add ( line ) ;
47
+ }
48
+ }
49
+
50
+
51
+ if ( lbPhone . Items . Count > 0 )
52
+ lbPhone . SelectedIndex = 0 ;
53
+
42
54
}
43
55
44
56
private async void GetCookie ( )
@@ -82,11 +94,14 @@ private void BtnLogin_Click(object sender, EventArgs e)
82
94
83
95
private void BtnFill_Click ( object sender , EventArgs e )
84
96
{
85
- Clipboard . SetText ( lbPhone . Text + "" ) ;
86
- wb . CoreWebView2 . ExecuteScriptAsync (
87
- "var phone = document.querySelector('input[placeholder=\" 请输入手机号\" ]');phone.dispatchEvent(new Event('focus'));phone.value = "
88
- + lbPhone . Text +
89
- ";phone.dispatchEvent(new Event('input'));phone.dispatchEvent(new Event('blur'));var check = document.querySelector('input.policy_tip-checkbox');if(!check.checked);check.click();" ) ;
97
+ if ( ! string . IsNullOrEmpty ( lbPhone . Text ) )
98
+ {
99
+ Clipboard . SetText ( lbPhone . Text + "" ) ;
100
+ wb . CoreWebView2 . ExecuteScriptAsync (
101
+ "var phone = document.querySelector('input[placeholder=\" 请输入手机号\" ]');phone.dispatchEvent(new Event('focus'));phone.value = "
102
+ + lbPhone . Text +
103
+ ";phone.dispatchEvent(new Event('input'));phone.dispatchEvent(new Event('blur'));var check = document.querySelector('input.policy_tip-checkbox');if(!check.checked);check.click();" ) ;
104
+ }
90
105
}
91
106
}
92
107
}
0 commit comments