资源简介
开源:SMT 监控FUJI NXT当前服务器上传送的程序名称,并输出清单,输出格式为xml格式,可用于程序名称校对防止技术调错程序
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Net;
using System.Timers;
using System.xml.Linq;
using System.Threading.Tasks;
namespace FujiNxtDataCollectionService
{
public partial class FujiNxtDataCollectionService : Servicebase
{
//记录到event log中,地址是 C:\Windows\System32\winevt\Logs (双击查看即可,文件名为MyNewLog)
private static EventLog eventLog1;
private int eventId = 1;
private System.Timers.Timer timer;
private string outlogpath = ““;
public FujiNxtDataCollectionService()
{
InitializeComponent();
RunOnIniti();
}
///
/// 启动服务
///
///
protected override void onstart(string[] args)
{
RunOnStar();
}
protected override void onstop()
{
eventLog1.WriteEntry(“In onstop.“);
log(“In onstop.“);
}
///
/// 继续服务
///
protected override void OnContinue()
{
eventLog1.WriteEntry(“In OnContinue.“);
log(“In OnContinue.“);
}
///
/// 定时器中定时执行的任务
///
///
///
public void OnTimer(object sender ElapsedEventArgs args)
{
// TODO: Insert monitoring activities here.
eventLog1.WriteEntry(“Monitoring the System“ EventLogEntryType.Information eventId++);
log(“Proceed to the next count“);
ReadWeb.GetWebPageContent();
//log(“Get Web content“);
}
///
/// 用于临时测试网页读取操作
///
public void TestWinForm()
{
eventLog1.WriteEntry(“Monitoring the System“ EventLogEntryType.Information eventId++);
log(“Proceed to the next count“);
log(“Go to the off-line data test step“);
ReadWeb.GetWebPageContentAndOutput();
}
///
/// 主程序执行前需要调用的初始化服务配置
///
public void RunOnIniti()
{
eventLog1 = new System.Diagnostics.EventLog();
if (!System.Diagnostics.EventLog.SourceExists(“MySource“))
{
System.Diagnostics.EventLog.CreateEventSource(
“MySource“ “MyNewLog“);
}
eventLog1.Source = “MySource“;
eventLog1.Log = “MyNewLog“;
//读取Url
ReadConfig.ReadxmlConfig();
}
///
/// onstart 执行服务主程序
//
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-06-22 14:34 FUJINXT3\
目录 0 2020-06-22 14:56 FUJINXT3\0\
文件 95 2020-06-18 22:14 FUJINXT3\0\InstallUtilService.bat
文件 98 2020-06-18 22:15 FUJINXT3\0\UnInstallUtilService.bat
目录 0 2020-06-22 14:34 FUJINXT3\FujiNxtDataCollectionService\
目录 0 2020-06-22 14:34 FUJINXT3\FujiNxtDataCollectionService\.vs\
目录 0 2020-06-22 14:34 FUJINXT3\FujiNxtDataCollectionService\.vs\FujiNxtDataCollectionService\
目录 0 2020-06-22 14:34 FUJINXT3\FujiNxtDataCollectionService\.vs\FujiNxtDataCollectionService\v14\
文件 88064 2020-06-25 20:25 FUJINXT3\FujiNxtDataCollectionService\.vs\FujiNxtDataCollectionService\v14\.suo
目录 0 2020-06-25 20:24 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\
文件 1538 2020-06-20 20:09 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService.sln
文件 189 2020-06-18 21:42 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\App.config
目录 0 2020-06-22 14:34 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\
目录 0 2020-06-22 14:34 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\
文件 230 2020-06-22 14:39 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\Config.xm
文件 15360 2020-06-25 20:24 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\FujiNxtDataCollectionService.exe
文件 189 2020-06-18 21:42 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\FujiNxtDataCollectionService.exe.config
文件 97639 2020-06-25 20:27 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\FujiNxtDataCollectionService.InstallLog
文件 38400 2020-06-25 20:24 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\FujiNxtDataCollectionService.pdb
文件 22696 2020-06-19 00:32 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\FujiNxtDataCollectionService.vshost.exe
文件 189 2020-06-18 21:42 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\FujiNxtDataCollectionService.vshost.exe.config
文件 490 2017-04-11 11:11 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\FujiNxtDataCollectionService.vshost.exe.manifest
文件 58315 2020-06-25 20:27 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\InstallUtil.InstallLog
文件 135 2020-06-18 23:16 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\InstallUtilService.bat
目录 0 2020-06-22 14:56 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\Result\
文件 8192 2020-06-25 20:24 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\TestService.exe
文件 189 2020-06-20 20:07 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\TestService.exe.config
文件 19968 2020-06-25 20:24 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\TestService.pdb
文件 22696 2020-06-25 20:24 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\TestService.vshost.exe
文件 189 2020-06-20 20:07 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\TestService.vshost.exe.config
文件 490 2017-04-11 11:11 FUJINXT3\FujiNxtDataCollectionService\FujiNxtDataCollectionService\bin\Debug\TestService.vshost.exe.manifest
............此处省略67个文件信息
评论
共有 条评论