-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathProgram.cs
148 lines (138 loc) · 4.14 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using dotnetCampus.Configurations;
using dotnetCampus.Configurations.Core;
namespace PayListener
{
internal static class Program
{
public readonly static IAppConfigurator Configurator = ConfigurationFactory.FromFile(@".\config.coin").CreateAppConfigurator();
public static StateConfiguration config = Configurator.Of<StateConfiguration>();
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
public static System.Data.DataTable wechat_DataTable = new System.Data.DataTable();
public static System.Data.DataTable alipay_DataTable = new System.Data.DataTable();
}
internal static class Shell
{
/// <summary>
/// 输出信息
/// </summary>
/// <param name="format"></param>
/// <param name="args"></param>
public static void WriteLine(string message, ConsoleColor GetConsoleColor)
{
try
{
Console.ForegroundColor = GetConsoleColor;
Console.WriteLine(@"[{0}]{1}", DateTimeOffset.Now, message);
}
catch (Exception)
{
return;
}
}
/// <summary>
/// 输出信息
/// </summary>
/// <param name="format"></param>
/// <param name="args"></param>
public static void WriteLine(string format, params object[] args)
{
try
{
WriteLine(string.Format(format, args));
}
catch (Exception)
{
return;
}
}
/// <summary>
/// 输出信息
/// </summary>
/// <param name="output"></param>
public static void WriteLine(string output)
{
try
{
Console.ForegroundColor = GetConsoleColor(output);
Console.WriteLine(@"[{0}]{1}", DateTimeOffset.Now, output);
}
catch (Exception)
{
return;
}
}
/// <summary>
/// 根据输出文本选择控制台文字颜色
/// </summary>
/// <param name="output"></param>
/// <returns></returns>
private static ConsoleColor GetConsoleColor(string output)
{
if (output.StartsWith("警告")) return ConsoleColor.Yellow;
if (output.StartsWith("错误")) return ConsoleColor.Red;
if (output.StartsWith("注意")) return ConsoleColor.Green;
return ConsoleColor.Gray;
}
}
internal class StateConfiguration : Configuration
{
/// <summary>
/// 获取/设置回调地址。
/// </summary>
internal string CallbackHost
{
get => GetString();
set => SetValue(value);
}
/// <summary>
/// 获取/设置通信密钥。
/// </summary>
internal string CallbackKey
{
get => GetString();
set => SetValue(value);
}
/// <summary>
/// 获取/设置通信密钥。
/// </summary>
internal bool Callbackssl
{
get => GetBoolean() ?? false;
set => SetValue(value);
}
/// <summary>
/// 获取/设置微信安装目录
/// </summary>
internal string WeChatFolder
{
get => GetString();
set => SetValue(value);
}
/// <summary>
/// 获取/设置支付宝检查延间隔(秒)
/// </summary>
internal int AlipayInterval
{
get => GetInt32() ?? 10;
set => SetValue(value);
}
/// <summary>
/// 调试模式
/// </summary>
internal bool DebugMode
{
get => GetBoolean() ?? false;
set => SetValue(value);
}
}
}