• 大小: 0.20M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-25
  • 语言: C#
  • 标签: 检测  进程  

资源简介

检测设置好到进程,如果没有启动,则自动触发运行

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;


using System.Net;
using System.Net.Sockets;
using System.Text.Regularexpressions;
using System.xml;//xml处理类专属的头文件

namespace ProcessCheck
{
    public partial class Form1 : Form
    {
        
        string opcserver;
        Array opcitem;
        bool pulse1 ;
        private bool windowCreate = true;
        int TimeCount;
        string xml_FilePath = ““;//用来记录当前打开文件的路径的

        public Form1()
        {
            InitializeComponent();
        }



        private void Form1_Load(object sender EventArgs e)
        {
            TimeCount = 0;
            xml_FilePath = System.Windows.Forms.Application.StartupPath + “\\ProcessSet.xml“;


            pulse1 = false;
            timer1.Enabled = true;
            timer1.Start();
        }

       


        //xml读取
        public String xmlread(String xmlstring)
        {
            try
            {
                String xmlPath = System.Windows.Forms.Application.StartupPath + “\\“ + xmlstring + “.xml“;
                if (File.Exists(xmlPath))
                {
                    CommonCS.xmlConfigUtil xml = new CommonCS.xmlConfigUtil(xmlPath);
                    return xml.Read(xmlstring);
                    xml = null;
                    GC.Collect();
                }
                else
                {
                    return “0“;
                }

            }
            catch (Exception ex)
            {
                return “0“;
            }
        }

        //xml写入
        public void xmlwrite(String xmlstring String value)
        {
            String xmlPath = System.Windows.Forms.Application.StartupPath + “\\“ + xmlstring + “.xml“;
            if (File.Exists(xmlPath))
            {
                File.Delete(xmlPath);
            }
            CommonCS.xmlConfigUtil xml = new CommonCS.xmlConfigUtil(xmlPath);
            xml.Write(value xmlstring);
            xml = null;
            GC.Collect();
        }

        

        public bool IsCorrenctIP(string ip)
        {
            string pattrn = @“((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))“;
            if (System.Text.Regularexpressions.Regex.IsMatch(ip pattrn))
            {
                return true;
            }
            else
            {
                return false;

            }
        }


        //public bool IsValidIP(string ip)
        //{
        //    if (System.Text.Regularexpressions.Regex.IsMatch(ip “[0-9]{13}//.[0-9]{13}//.[0-9]{13}//.[0-9]{13}“))
        //    {
        //        string[] ips = ip.Split(‘.‘);
        //        if (ips.Length == 4 || ips.Length == 6)
        //        {
        //            i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-12-11 09:36  ProcessCheck\
     目录           0  2020-12-11 09:37  ProcessCheck\iot\
     目录           0  2020-12-11 09:35  ProcessCheck\iot\bin\
     目录           0  2020-12-22 09:23  ProcessCheck\iot\bin\Debug\
     文件       36352  2020-12-22 09:23  ProcessCheck\iot\bin\Debug\ProcessCheck.exe
     文件       36352  2020-12-22 09:23  ProcessCheck\iot\bin\Debug\ProcessCheck.pdb
     文件       11600  2020-12-22 09:29  ProcessCheck\iot\bin\Debug\ProcessCheck.vshost.exe
     文件         490  2016-03-09 13:48  ProcessCheck\iot\bin\Debug\ProcessCheck.vshost.exe.manifest
     文件         205  2020-12-11 12:37  ProcessCheck\iot\bin\Debug\ProcessSet.xml
     目录           0  2020-01-19 21:12  ProcessCheck\iot\bin\Release\
     文件       16958  2017-07-21 15:02  ProcessCheck\iot\bitbug.ico
     文件       14626  2020-12-22 09:23  ProcessCheck\iot\Form1.cs
     文件        9593  2020-12-22 09:23  ProcessCheck\iot\Form1.Designer.cs
     文件       33104  2020-12-22 09:23  ProcessCheck\iot\Form1.resx
     目录           0  2020-12-11 09:35  ProcessCheck\iot\obj\
     目录           0  2020-12-11 09:35  ProcessCheck\iot\obj\x86\
     目录           0  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\
     文件        5359  2020-01-19 09:34  ProcessCheck\iot\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6205  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件        1252  2020-12-11 09:36  ProcessCheck\iot\obj\x86\Debug\iot.csproj.FileListAbsolute.txt
     文件         975  2020-06-01 21:15  ProcessCheck\iot\obj\x86\Debug\iot.csproj.GenerateResource.Cache
     文件         723  2020-06-01 21:15  ProcessCheck\iot\obj\x86\Debug\iot.csproj.ResolveComReference.cache
     文件       28955  2020-06-01 21:15  ProcessCheck\iot\obj\x86\Debug\iot.Form1.resources
     文件         180  2020-06-01 21:15  ProcessCheck\iot\obj\x86\Debug\iot.Properties.Resources.resources
     文件         602  2020-12-22 09:29  ProcessCheck\iot\obj\x86\Debug\ProcessCheck.csproj.FileListAbsolute.txt
     文件         975  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\ProcessCheck.csproj.GenerateResource.Cache
     文件        9080  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\ProcessCheck.csprojResolveAssemblyReference.cache
     文件       36352  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\ProcessCheck.exe
     文件       17536  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\ProcessCheck.Form1.resources
     文件       36352  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\ProcessCheck.pdb
     文件         180  2020-12-22 09:23  ProcessCheck\iot\obj\x86\Debug\ProcessCheck.Properties.Resources.resources
............此处省略16个文件信息

评论

共有 条评论