版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、编译器处理while,for结构的小发现在做一个日报自动报表发送项目时,因为项目是Windows服务,而且报表是每天自动发送,所以里面有这么一个函数public void AutoReportSend()while(true)try/采集时间没到,则结束。直到采集时间才开始采集作业if(DateTime.Now SystemConfiguration.GetInstance().GatherTime)Thread.Sleep(TimeSpan)(SystemConfiguration.GetInstance().GatherTime-DateTime.Now);log.Info(邮件发送开始!
2、);ReportDataProcess model=new ReportDataProcess();model.GenerateReport();EmailUtil emailUtil=new EmailUtil();string .ToString();string .ToString();emailUtil.IsBodyHtml=true;emailUtil.EmailTitle=DateTime.Now.ToString(yyyy)+年+DateTime.Now.Month.ToString()+月+DateTime.Now.Day.ToString()+日+ConfigurationS
3、ettings.AppSettingsEmailTitle.ToString();emailUtil.EmSubject=ConfigurationSettings.AppSettingsEmSubject.ToString();emailUtil.SendEmilPerson=ConfigurationSettings.AppSettingsSendEmil.ToString();emailUtil.ToEmail=ConfigurationSettings.AppSettingsToEmail.ToString();emailUtil.FromEmail=ConfigurationSett
4、ings.AppSettingsSendEmil.ToString();emailUtil.SendEmailAcount=ConfigurationSettings.AppSettingsSendEmailAcount.ToString();emailUtil.SendEmailPsd=ConfigurationSettings.AppSettingsSendEmialPswd.ToString();emailUtil.SetEmailAttactment();emailUtil.SmtpHost=ConfigurationSettings.AppSettingsSmtpHost.ToStr
5、ing();emailUtil.SmtpServePort=ConfigurationSettings.AppSettingsSmtpServePort.ToString();emailUtil.EmailContent=ConfigurationSettings.AppSettingsEmailContent.ToString();emailUtil.SendEmail();log.Info(邮件发送成功!);DateTime dtNow=DateTime.Now;DateTime dtNext=Convert.ToDateTime(DateTime.Now.ToString(yyyy-MM
6、-dd)+SystemConfiguration.GetInstance().GatherHour+:+SystemConfiguration.GetInstance().GatherMinute);Thread.Sleep(TimeSpan)(dtNext.AddDays(1)-dtNow);catch(Exception exc)log.Error(exc.ToString();/发送报错短信SendMessage.MessageSending(函数AutoReportSend出错,具体情况请检查日志);Thread.Sleep(600000);偶然情况下让我发现了一个让我觉得比较有趣的问
7、题:我用.NET Reflector工具查看项目的exe文件时候,发现里面的这段代码变成了下面的样子代码publicvoid AutoReportSend()Label_0000:tryif(DateTime.Now SystemConfiguration.GetInstance().GatherTime)Thread.Sleep(TimeSpan)(SystemConfiguration.GetInstance().GatherTime-DateTime.Now);log.Info(邮件发送开始!);new ReportDataProcess().GenerateReport();Email
8、Util emailUtil=new EmailUtil();string .ToString();string .ToString();emailUtil.set_IsBodyHtml(true);emailUtil.set_EmailTitle(DateTime.Now.ToString(yyyy)+年+DateTime.Now.Month.ToString()+月+DateTime.Now.Day.ToString()+日+ConfigurationSettings.AppSettingsEmailTitle.ToString();emailUtil.set_EmSubject(Conf
9、igurationSettings.AppSettingsEmSubject.ToString();emailUtil.set_SendEmilPerson(ConfigurationSettings.AppSettingsSendEmil.ToString();emailUtil.set_ToEmail(ConfigurationSettings.AppSettingsToEmail.ToString();emailUtil.set_FromEmail(ConfigurationSettings.AppSettingsSendEmil.ToString();emailUtil.set_Sen
10、dEmailAcount(ConfigurationSettings.AppSettingsSendEmailAcount.ToString();emailUtil.set_SendEmailPsd(ConfigurationSettings.AppSettingsSendEmialPswd.ToString();emailUtil.SetEmailAttactment();emailUtil.set_SmtpHost(ConfigurationSettings.AppSettingsSmtpHost.ToString();emailUtil.set_SmtpServePort(Configu
11、rationSettings.AppSettingsSmtpServePort.ToString();emailUtil.set_EmailContent(ConfigurationSettings.AppSettingsEmailContent.ToString();emailUtil.SendEmail();log.Info(邮件发送成功!);DateTime dtNow=DateTime.Now;Thread.Sleep(TimeSpan)(Convert.ToDateTime(DateTime.Now.ToString(yyyy-MM-dd)+SystemConfiguration.G
12、etInstance().GatherHour+:+SystemConfiguration.GetInstance().GatherMinute).AddDays(1.0)-dtNow);goto Label_0000;catch(Exception exc)log.Error(exc.ToString();SendMessage.MessageSending(函数AutoReportSend出错,具体情况请检查日志);Thread.Sleep(0x927c0);goto Label_0000;反编译的IL代码如下:代码1.methodpublic hidebysig instancevoid
13、 AutoReportSend()cil managed 23.maxstack5 4.locals init(50classGSP.Bll.ThreeCountryGSP.Bll.ThreeCountry.ReportDataProcess model,61classGSP.CommonGSP.Common.Utils.EmailUtil emailUtil,72string ,83string ,94valuetypemscorlibSystem.DateTime dtNow,105valuetypemscorlibSystem.DateTime dtNext,116classmscorl
14、ibSystem.Exception exc,127string CSmessagemessage00,138valuetypemscorlibSystem.DateTime CSmessagemessage01,149valuetypemscorlibSystem.DateTime CSmessagemessage02,1510int32 CSmessagemessage03,1611valuetypemscorlibSystem.DateTime CSmessagemessage04,1712int32 CSmessagemessage05,1813string CSmessagemess
15、age06,1914valuetypemscorlibSystem.DateTime CSmessagemessage07)20 L_0000:call valuetypemscorlibSystem.DateTimemscorlibSystem.DateTime:get_Now()21 L_0005:callclass ExcelAutoReport.SystemConfiguration ExcelAutoReport.SystemConfiguration:GetInstance()22 L_000a:callvirt instance valuetypemscorlibSystem.D
16、ateTime ExcelAutoReport.SystemConfiguration:get_GatherTime()23 L_000f:callboolmscorlibSystem.DateTime:op_LessThan(valuetypemscorlibSystem.DateTime,valuetypemscorlibSystem.DateTime)24 L_0014:brfalse.s L_002f 25 L_0016:callclass ExcelAutoReport.SystemConfiguration ExcelAutoReport.SystemConfiguration:G
17、etInstance()26 L_001b:callvirt instance valuetypemscorlibSystem.DateTime ExcelAutoReport.SystemConfiguration:get_GatherTime()27 L_0020:call valuetypemscorlibSystem.DateTimemscorlibSystem.DateTime:get_Now()28 L_0025:call valuetypemscorlibSystem.TimeSpanmscorlibSystem.DateTime:op_Subtraction(valuetype
18、mscorlibSystem.DateTime,valuetypemscorlibSystem.DateTime)29 L_002a:callvoidmscorlibSystem.Threading.Thread:Sleep(valuetypemscorlibSystem.TimeSpan)30 L_002f:l dsfldclasslog4netlog4net.ILog ExcelAutoReport.SftxExcelAutoReport:log 31 L_0034:ldstru90aeu4ef6u53d1u9001u5f00u59cbuff0132 L_0039:callvirt ins
19、tancevoidlog4netlog4net.ILog:Info(object)33 L_003e:newobj instancevoidGSP.Bll.ThreeCountryGSP.Bll.ThreeCountry.ReportDataProcess:.ctor()34 L_0043:stloc.0 35 L_0044:ldloc.0 36 L_0045:callvirt instancevoidGSP.Bll.ThreeCountryGSP.Bll.ThreeCountry.ReportDataProcess:GenerateReport()37 L_004a:newobj insta
20、ncevoidGSP.CommonGSP.Common.Utils.EmailUtil:.ctor()38 L_004f:stloc.1 39 L_0050:callclassSystemSystem.Collections.Specialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()40 L_0055:ldstr41 L_005a:callvirt instancestringSystemSystem.Collections.Specialized.NameV
21、alueCollection:get_Item(string)42 L_005f:callvirt instancestringmscorlibSystem.Object:ToString()43 L_0064:stloc.2 44 L_0065:callclassSystemS ystem.Collections.Specialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()45 L_006a:ldstr46 L_006f:callvirt instancest
22、ringSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)47 L_0074:callvirt instancestringmscorlibSystem.Object:ToString()48 L_0079:stloc.3 49 L_007a:ldloc.1 50 L_007b:ldc.i4.1 51 L_007c:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_IsBodyHtml(bool)52 L_0081:ldloc
23、.1 53 L_0082:ldc.i4.7 54 L_0083:newarrstring 55 L_0088:stloc.s CSmessagemessage00 56 L_008a:ldloc.s CSmessagemessage00 57 L_008c:ldc.i4.0 58 L_008d:call valuetypemscorlibSystem.DateTimemscorlibSystem.DateTime:get_Now()59 L_0092:stloc.s CSmessagemessage01 60 L_0094:ldloca.s CSmessagemessage01 61 L_00
24、96:ldstryyyy62 L_009b:call instancestringmscorlibSystem.DateTime:ToString(string)63 L_00a0:stelem.ref 64 L_00a1:ldloc.s CSmessagemessage00 65 L_ 00a3:ldc.i4.1 66 L_00a4:ldstru5e7467 L_00a9:stelem.ref 68 L_00aa:ldloc.s CSmessagemessage00 69 L_00ac:ldc.i4.2 70 L_00ad:call valuetypemscorlibSystem.DateT
25、imemscorlibSystem.DateTime:get_Now()71 L_00b2:stloc.s CSmessagemessage02 72 L_00b4:ldloca.s CSmessagemessage02 73 L_00b6:call instance int32mscorlibSystem.DateTime:get_Month()74 L_00bb:stloc.s CSmessagemessage03 75 L_00bd:ldloca.s CSmessagemessage03 76 L_00bf:call instancestringmscorlibSystem.Int32:
26、ToString()77 L_00c4:stelem.ref 78 L_00c5:ldloc.s CSmessagemessage00 79 L_00c7:ldc.i4.3 80 L_00c8:ldstru670881 L_00cd:stelem.ref 82 L_00ce:ldloc.s CSmessagemessage00 83 L_00d0:ldc.i4.4 84 L_00d1:call valuetypemscorlibSystem.DateTimemscorlibSystem.DateTime:get_Now()85 L_00d6:stloc.s CSmessagemessage04
27、 86 L_00d8:ldloca.s CSmessagemessage04 87 L_00da:call instance int32mscorlibSystem.DateTime:get_Day()88 L_00df:stloc.s CSmessagemessage05 89 L_00e1:ldloca.s CSmessagemessage05 90 L_00e 3:call instancestringmscorlibSystem.Int32:ToString()91 L_00e8:stelem.ref 92 L_00e9:ldloc.s CSmessagemessage00 93 L_
28、00eb:ldc.i4.5 94 L_00ec:ldstru65e595 L_00f1:stelem.ref 96 L_00f2:ldloc.s CSmessagemessage00 97 L_00f4:ldc.i4.6 98 L_00f5:callclassSystemSystem.Collections.Specialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()99 L_00fa:ldstrEmailTitle100 L_00ff:callvirt ins
29、tancestringSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)101 L_0104:callvirt instancestringmscorlibSystem.Object:ToString()102 L_0109:stelem.ref 103 L_010a:ldloc.s CSmessagemessage00 104 L_010c:callstringmscorlibSystem.String:Concat(string)105 L_0111:callvirt instancevoidG
30、SP.CommonGSP.Common.Utils.EmailUtil:set_EmailTitle(string)106 L_0116:ldloc.1 107 L_0117:callclassSystemSystem.Collections.Specialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()108 L_011c:ldstrEmSubject109 L_0121:callvirt instancestringSystemSystem.Collectio
31、ns.Specialized.NameValueCollection:get_Item(string)110 L_0126:callvirt instancestringmscorlibSystem.Object:ToString()111 L_012b:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_EmSubject(string)112 L_0130:ldloc.1 113 L_0131:callclassSystemSystem.Collections.Specialized.NameValueCollecti
32、onSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()114 L_0136:ldstrSendEmil115 L_013b:callvirt instancestringSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)116 L_0140:callvirt instancestringmscorlibSystem.Object:ToString()117 L_0145:callvirt instancevoidGSP
33、.CommonGSP.Common.Utils.EmailUtil:set_SendEmilPerson(string)118 L_014a:ldloc.1 119 L_014b:callclassSystemSystem.Collections.Specialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()120 L_0150:ldstrToEmail121 L_0155:callvirt instancestringSystemSystem.Collectio
34、ns.Specialized.NameValueCollection:get_Item(string)122 L_015a:callvirt instancestringmscorlibSystem.Object:ToString()123 L_015f:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_ToEmail(string)124 L_0164:ldloc.1 125 L_0165:callclassSystemSystem.Collections.Specialized.NameValueCollection
35、SystemSystem.Configuration.ConfigurationSettings:get_AppSettings()126 L_016a:ldstrSendEmil127 L_016f:callvirt instancestringSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)128 L_0174:callvirt instancestringmscorlibSystem.Object:ToString()129 L_0179:callvirt instancevoidGSP.C
36、ommonGSP.Common.Utils.EmailUtil:set_FromEmail(string)130 L_017e:ldloc.1 131 L_017f:callclassSystemSystem.Collections.Specialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()132 L_0184:ldstrSend EmailAcount133 L_0189:callvirt instancestringSystemSystem.Collect
37、ions.Specialized.NameValueCollection:get_Item(string)134 L_018e:callvirt instancestringmscorlibSystem.Object:ToString()135 L_0193:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_SendEmailAcount(string)136 L_0198:ldloc.1 137 L_0199:callclassSystemSystem.Collections.Specialized.NameValue
38、CollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()138 L_019e:ldstrSendEmialPswd139 L_01a3:callvirt instancestringSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)140 L_01a8:callvirt instancestringmscorlibSystem.Object:ToString()141 L_01ad:callvirt in
39、stancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_SendEmailPsd(string)142 L_01b2:ldloc.1 143 L_01b3:ldloc.3 144 L_01b4:ldloc.2 145 L_01b5:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:SetEmailAttactment(string,string)146 L_01ba:ldloc.1 147 L_01bb:callclassSystemSystem.Collections.Specia
40、lized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()148 L_01c0:ldstrSmtpHost149 L_01c5:callvirt instancestringSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)150 L_01ca:callvirt instancestringmscorlibSystem.Object:ToString()151 L_01cf:c
41、allvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_SmtpHost(string)152 L_01d4:ldloc.1 153 L_01d5:callclassSystemSystem.Collections.Specialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()154 L_01da:ldstrSmtpServePort155 L_01df:callvirt instancestrin
42、gSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)156 L_01e4:callvirt instancestringmscorlibSystem.Object:ToString()157 L_01e9:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_SmtpServePort(string)158 L_01ee:ldloc.1 159 L_01ef:callclassSystemSystem.Collections.Sp
43、ecialized.NameValueCollectionSystemSystem.Configuration.ConfigurationSettings:get_AppSettings()160 L_01f4:ldstrEmailContent161 L_01f9:callvirt instancestringSystemSystem.Collections.Specialized.NameValueCollection:get_Item(string)162 L_01fe:callvirt instancestringmscorlibSystem.Object:ToString()163
44、L_0203:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:set_EmailContent(string)164 L_0208:ldloc.1 165 L_0209:callvirt instancevoidGSP.CommonGSP.Common.Utils.EmailUtil:SendEmail()166 L_020e:ldsfldclasslog4netlog4net.ILog ExcelAutoReport.SftxExcelAutoReport:log 167 L_0213:ldstru90aeu4ef6u53d
45、1u9001u6210u529fuff01168 L_0218:callvirt instancevoidlog4netlog4net.ILog:Info(object)169 L_021d:call valuetypemscorlibSystem.DateTimemscorlibSystem.DateTime:get_Now()170 L_0222:stloc.s dtNow 171 L_0224:ldc.i4.5 172 L_0225:newarrstring 173 L_022a:stloc.s CSmessagemessage06 174 L_022c:ldloc.s CSmessag
46、emessage06 175 L_022e:ldc.i4.0 176 L_022f:call valuetypemscorlibSystem.DateTimemscorlibSystem.DateTime:get_Now()177 L_0234:stloc.s CSmessagemessage07 178 L_0236:ldloca.s CSmessagemessage07 179 L_0238:ldstryyyy-MM-dd180 L_023d:call instancestringmscorlibSystem.DateTime:ToString(string)181 L_0242:stel
47、em.ref 182 L_0243:ldloc.s CSmessagemessage06 183 L_0245:ldc.i4.1 184 L_0246:ldstr185 L_024b:stelem.ref 186 L_024c:ldloc.s CSmessagemessage06 187 L_024e:ldc.i4.2 188 L_024f:callclass ExcelAutoReport.SystemConfiguration ExcelAutoReport.SystemConfiguration:GetInstance()189 L_0254:callvirt instancestrin
48、g ExcelAutoReport.SystemConfiguration:get_GatherHour()190 L_0259:stelem.ref 191 L_025a:ldloc.s CSmessagemessage06 192 L_025c:ldc.i4.3 193 L_025d:ldstr:194 L_0262:stelem.ref 195 L_0263:ldloc.s CSmessagemessage06 196 L_0265:ldc.i4.4 197 L_0266:callclass ExcelAutoReport.SystemConfiguration ExcelAutoRep
49、ort.SystemConfiguratio n:GetInstance()198 L_026b:callvirt instancestring ExcelAutoReport.SystemConfiguration:get_GatherMinute()199 L_0270:stelem.ref 200 L_0271:ldloc.s CSmessagemessage06 201 L_0273:callstringmscorlibSystem.String:Concat(string)202 L_0278:call valuetypemscorlibSystem.DateTimemscorlib
50、System.Convert:ToDateTime(string)203 L_027d:stloc.s dtNext 204 L_027f:ldloca.s dtNext 205 L_0281:ldc.r81 206 L_028a:call instance valuetypemscorlibSystem.DateTimemscorlibSystem.DateTime:AddDays(float64)207 L_028f:ldloc.s dtNow 208 L_0291:call valuetypemscorlibSystem.TimeSpanmscorlibSystem.DateTime:o
51、p_Subtraction(valuetypemscorlibSystem.DateTime,valuetypemscorlibSystem.DateTime)209 L_0296:callvoidmscorlibSystem.Threading.Thread:Sleep(valuetypemscorlibSystem.TimeSpan)210 L_029b:leave L_0000 211 L_02a0:stloc.s exc 212 L_02a2:ldsfldclasslog4netlog4net.ILog ExcelAutoReport.SftxExcelAutoReport:log 213 L_02a7:ldloc.s exc 214 L_ 02a9:callvirt instancestringmscorlibSystem.Object:ToString()215 L_02ae:callvirt instancevoidlog4netlog4net.ILog:Error(object)216 L_02b3:ldstru51f
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030物联网行业发展趋势及市场定位创新路径投资评估规划报告
- 2025-2030物联网智能家居网关行业市场供需分析及投资评估规划分析研究报告
- 2025-2030物联网技术应用在教育领域的教育信息化与智慧校园建设研究
- 2025-2030物联网平台服务行业市场现状供需分析及投资策略规划分析研究报告
- 2025-2030物流仓储配送中心市场发展潜力分析运营效率投资评估方向规划
- 2025-2030物流-智慧港口建设及智慧物流体系发展
- 2025-2030牛奶生产加工场所环境清洁维护设备使用管理制度产品保质期新鲜度调研食品安全技术标准市场分析报告
- 建筑材料供应与物流协调方案
- 幼儿科学教学设计《身高比较》
- 企业目标责任书范文及执行方案
- 2025年广东省生态环境厅下属事业单位考试真题附答案
- 2026年安徽省公务员考试招录7195名备考题库完整参考答案详解
- 统筹发展与安全课件
- 化工厂班组安全培训课件
- 2025四川成都农商银行招聘10人笔试备考题库及答案解析
- 营业执照借用协议合同
- 2025年秋苏教版(新教材)初中生物八年级上册期末知识点复习卷及答案(共三套)
- 弱电项目实施管理方案
- GB∕T 26408-2020 混凝土搅拌运输车
- 《直播电商平台运营》 课程标准
- 绿色建筑二星级认证及绿色施工实施方案
评论
0/150
提交评论