C#实现12306自动登录和余票查询Word文件下载.docx
- 文档编号:432870
- 上传时间:2023-04-28
- 格式:DOCX
- 页数:116
- 大小:1.34MB
C#实现12306自动登录和余票查询Word文件下载.docx
《C#实现12306自动登录和余票查询Word文件下载.docx》由会员分享,可在线阅读,更多相关《C#实现12306自动登录和余票查询Word文件下载.docx(116页珍藏版)》请在冰点文库上搜索。
(string
Action<
15.
16.
typeof(T));
17.
18.
19.
20.
Delegate
Type
parameterType)
21.
22.
if
(String.IsNullOrEmpty(message))
23.
throw
new
ArgumentException("
'
message'
cannot
be
null
or
empty."
);
24.
25.
26.
(callback
==
null)
27.
ArgumentNullException("
callback"
28.
29.
30.
this.VerifyParameterType(message,
parameterType);
31.
32.
33.
_messageToActionsMap.AddAction(message,
callback.Target,
callback.Method,
34.
35.
36.
37.
[Conditional("
DEBUG"
)]
38.
VerifyParameterType(string
39.
40.
previouslyRegisteredParameterType
=
null;
41.
(_messageToActionsMap.TryGetParameterType(message,
out
previouslyRegisteredParameterType))
42.
43.
(previouslyRegisteredParameterType
!
&
parameterType
44.
45.
(!
previouslyRegisteredParameterType.Equals(parameterType))
46.
InvalidOperationException(string.Format(
47.
"
The
registered
action'
s
parameter
type
is
inconsistent
with
the
previously
actions
for
message
{0}'
.\nExpected:
{1}\nAdding:
{2}"
48.
49.
previouslyRegisteredParameterType.FullName,
50.
parameterType.FullName));
51.
52.
else
53.
54.
//
One,
both,
of
callbackParameterType
are
null.
55.
not
both
null?
56.
57.
TargetParameterCountException(string.Format(
58.
action
has
a
number
parameters
\"
{0}\"
59.
60.
?
0
:
1,
61.
1));
62.
63.
64.
65.
66.
67.
68.
NotifyColleagues(string
object
parameter)
69.
70.
71.
72.
73.
74.
registeredParameterType;
75.
registeredParameterType))
76.
77.
(registeredParameterType
78.
TargetParameterCountException(string.Format("
Cannot
pass
.
Registered
action(s)
expect
no
parameter."
message));
79.
80.
81.
82.
var
_messageToActionsMap.GetActions(message);
83.
(actions
84.
actions.ForEach(action
=>
action.DynamicInvoke(parameter));
85.
86.
87.
88.
message)
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
Must
{0}
this
message.
it."
registeredParameterType.FullName));
99.
100.
101.
102.
103.
104.
action.DynamicInvoke());
105.
106.
107.
108.
109.
private
MessageToActionsMap
110.
111.
internal
MessageToActionsMap()
112.
113.
114.
115.
116.
117.
AddAction(string
target,
MethodInfo
method,
actionType)
118.
119.
(message
120.
message"
121.
122.
123.
(method
124.
method"
125.
126.
127.
lock
(_map)
128.
129.
_map.ContainsKey(message))
130.
_map[message]
List<
WeakAction>
();
131.
132.
133.
_map[message].Add(new
WeakAction(target,
actionType));
134.
135.
136.
137.
138.
Delegate>
GetActions(string
139.
140.
141.
142.
143.
144.
actions;
145.
146.
147.
148.
return
149.
150.
151.
weakActions
_map[message];
152.
(weakActions.Count);
153.
(int
i
weakActions.Count
-
1;
>
-1;
--i)
154.
155.
WeakAction
weakAction
weakActions[i];
156.
(weakAction
157.
continue;
158.
159.
160.
weakAction.CreateAction();
161.
(action
162.
163.
actions.Add(action);
164.
165.
166.
167.
target
dead,
so
get
rid
weak
action.
168.
weakActions.Remove(weakAction);
169.
170.
171.
172.
173.
Delete
list
from
map
it
now
empty.
174.
(weakActions.Count
0)
175.
_map.Remove(message);
176.
177.
178.
179.
Reverse
to
ensure
callbacks
invoked
in
order
they
were
registered.
180.
actions.Reverse();
181.
182.
183.
184.
185.
186.
187.
bool
TryGetParameterType(string
188.
189.
190.
191.
192.
193.
194.
weakActions;
195.
196.
197.
_map.TryGetValue(message,
weakActions)
||
198.
false;
199.
200.
weakActions[0].ParameterType;
201.
true;
202.
203.
204.
205.
readonly
Dictionary<
string,
_map
206.
207.
208.
209.
210.
211.
212.
213.
WeakAction(object
214.
215.
(target
216.
217.
_targetRef
218.
219.
220.
221.
WeakReference(target);
222.
223.
224.
225.
_method
method;
226.
227.
228.
this.ParameterType
parameterType;
229.
230.
231.
(parameterType
232.
233.
_delegateType
typeof(Action);
234.
235.
236.
237.
typeof(Action<
).MakeGenericType(parameterType);
238.
239.
240.
241.
242.
CreateAction()
243.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C# 实现 12306 自动 登录 查询