• 大小: 7.85M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-08
  • 语言: 其他
  • 标签: 其他  

资源简介

c实现软件系统监控.zip

资源截图

代码片段和文件信息

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

using System.Threading;

using System.IO; //for fileSystemWatcher


namespace FileEventWatcher
{
    public partial class fileSystemWatcherFrm : Form
    {
        public fileSystemWatcherFrm()
        {
            InitializeComponent();
        }

        private delegate void setLogTextDelegate(FileSystemEventArgs e);

        private delegate void renamedDelegate(RenamedEventArgs e);

        FileSystemWatcher[] fswArr;

        private void fileSystemWatcherFrm_Load(object sender EventArgs e)
        {
            ListViewGroup hardDisk_lvg = new ListViewGroup();

            hardDisk_lvg.Header = “可监控硬盘“;

            hardDisk_lvg.Name = “hardDisk“;

            ListViewGroup removableDisk_lvg = new ListViewGroup();

            removableDisk_lvg.Header = “可监控移动硬盘“;

            removableDisk_lvg.Name = “removableDisk“;

            ListViewGroup other_lvg = new ListViewGroup();

            other_lvg.Header = “其它“;

            other_lvg.Name = “other“;

            this.dir_lvw.Groups.Add(hardDisk_lvg);

            this.dir_lvw.Groups.Add(removableDisk_lvg);

            this.dir_lvw.Groups.Add(other_lvg);

            this.dir_lvw.ShowGroups = true;

            this.dir_lvw.LargeImageList = this.file_ilst;

            foreach (string driverName in Directory.GetLogicalDrives())
            {
                DriveInfo driverInfo = new DriveInfo(driverName);

                if (driverInfo.IsReady == true)
                {
                    if (driverInfo.DriveType == DriveType.Fixed)
                    {
                        ListViewItem lvi = new ListViewItem();

                        lvi.ImageIndex = 0;

                        lvi.Text = driverInfo.Name;

                        lvi.Group = hardDisk_lvg;

                        this.dir_lvw.Items.Add(lvi);
                    }
                    else if (driverInfo.DriveType == DriveType.Removable)
                    {
                        ListViewItem lvi = new ListViewItem();

                        lvi.ImageIndex = 1;

                        lvi.Text = driverInfo.Name;

                        lvi.Group = removableDisk_lvg;

                        this.dir_lvw.Items.Add(lvi);

                    }
                }
            }

            this.dir_lvw.Items.Add(new ListViewItem(“系统盘“2other_lvg));  

        }

        private void setLogText(FileSystemEventArgs e)
        {
            string[] strArr = e.FullPath.Split(new char[] { ‘\\‘ });

            if (!strArr[1].Equals(“$RECYCLE.BIN“))  //回收站
            {
                this.fileEventLog_lvw.BeginUpdate();

                ListViewItem lvi = new ListViewItem();

                lvi.SubItems.Add(DateTime.Now.ToString());

      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-09-23 23:18  c#系统监控软件\
     目录           0  2015-09-23 23:18  c#系统监控软件\Backup\
     目录           0  2015-09-23 23:18  c#系统监控软件\Backup\FileEventWatcher\
     文件        3314  2012-08-26 23:38  c#系统监控软件\Backup\FileEventWatcher\FileEventWatcher.csproj
     文件         490  2012-08-24 09:15  c#系统监控软件\Backup\FileEventWatcher\Program.cs
     目录           0  2015-09-23 23:18  c#系统监控软件\Backup\FileEventWatcher\Properties\
     文件        1180  2012-08-23 23:16  c#系统监控软件\Backup\FileEventWatcher\Properties\AssemblyInfo.cs
     文件        2888  2012-08-23 23:16  c#系统监控软件\Backup\FileEventWatcher\Properties\Resources.Designer.cs
     文件        5612  2012-08-23 23:16  c#系统监控软件\Backup\FileEventWatcher\Properties\Resources.resx
     文件        1101  2012-08-23 23:16  c#系统监控软件\Backup\FileEventWatcher\Properties\Settings.Designer.cs
     文件         249  2012-08-23 23:16  c#系统监控软件\Backup\FileEventWatcher\Properties\Settings.settings
     文件       21557  2012-08-28 13:45  c#系统监控软件\Backup\FileEventWatcher\fileSystemWatcherFrm.Designer.cs
     文件       12913  2012-08-28 16:40  c#系统监控软件\Backup\FileEventWatcher\fileSystemWatcherFrm.cs
     文件       35965  2012-08-28 13:45  c#系统监控软件\Backup\FileEventWatcher\fileSystemWatcherFrm.resx
     文件         937  2012-08-23 23:16  c#系统监控软件\Backup\FileEventWatcher.sln
     文件       20480  2012-09-05 18:08  c#系统监控软件\Backup\FileEventWatcher.suo
     目录           0  2015-09-23 23:18  c#系统监控软件\FileEventWatcher\
     文件        3751  2015-05-02 14:12  c#系统监控软件\FileEventWatcher\FileEventWatcher.csproj
     文件         490  2012-08-24 09:15  c#系统监控软件\FileEventWatcher\Program.cs
     目录           0  2015-09-23 23:18  c#系统监控软件\FileEventWatcher\Properties\
     文件        1180  2012-08-23 23:16  c#系统监控软件\FileEventWatcher\Properties\AssemblyInfo.cs
     文件        2872  2015-05-02 14:12  c#系统监控软件\FileEventWatcher\Properties\Resources.Designer.cs
     文件        5612  2012-08-23 23:16  c#系统监控软件\FileEventWatcher\Properties\Resources.resx
     文件        1116  2015-05-02 14:12  c#系统监控软件\FileEventWatcher\Properties\Settings.Designer.cs
     文件         249  2012-08-23 23:16  c#系统监控软件\FileEventWatcher\Properties\Settings.settings
     目录           0  2015-09-23 23:18  c#系统监控软件\FileEventWatcher\bin\
     目录           0  2015-09-23 23:18  c#系统监控软件\FileEventWatcher\bin\Debug\
     文件       43008  2015-09-23 23:16  c#系统监控软件\FileEventWatcher\bin\Debug\FileEventWatcher.exe
     文件       40448  2015-09-23 23:16  c#系统监控软件\FileEventWatcher\bin\Debug\FileEventWatcher.pdb
     文件       11608  2015-09-23 23:16  c#系统监控软件\FileEventWatcher\bin\Debug\FileEventWatcher.vshost.exe
     文件         490  2010-03-17 22:39  c#系统监控软件\FileEventWatcher\bin\Debug\FileEventWatcher.vshost.exe.manifest
............此处省略38个文件信息

评论

共有 条评论