Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winform 怎么使用MyEverything的监控事件? #1

Open
cxw3292008 opened this issue Apr 24, 2020 · 0 comments
Open

winform 怎么使用MyEverything的监控事件? #1

cxw3292008 opened this issue Apr 24, 2020 · 0 comments

Comments

@cxw3292008
Copy link

cxw3292008 commented Apr 24, 2020

@yiwenshengmei 你好!

MyEverything是我找到的一个很棒的项目,调试没有任何问题。

Winform MainWindows.cs里添加了:MyEverything2 xt = new MyEverything2("D:");//尝试使用MyEverything的监控事件

一旦有触发事件,VolumeMonitor.cs中 MonitorThread就提示"算术运算导致溢出",请问该怎么使用呢?谢谢

MyEverything.cs添加了:

public class MyEverything2
{
	private static MyEverythingDB db = new MyEverythingDB();
	private static VolumeMonitor monitor = new VolumeMonitor();

	public MyEverything2(string volume) 
	{
		List<MyEverythingRecord> files;
		List<MyEverythingRecord> folders;
		EnumerateVolume(volume, out files, out folders);

		db.AddRecord(volume, files, MyEverythingRecordType.File);
		db.AddRecord(volume, folders, MyEverythingRecordType.Folder);

		//VolumeMonitor monitor = new VolumeMonitor();
		monitor.RecordAddedEvent += delegate (MyEverythingRecord record) {
			new Log.Log.LogFactory().GetLog("monitor").Info(true, "新增事件:" + record.FullPath);
		};
		monitor.RecordDeletedEvent += delegate (MyEverythingRecord record) {
			new Log.Log.LogFactory().GetLog("monitor").Info(true, "删除事件:" + record.FullPath);
		};
		monitor.RecordRenameEvent += delegate (MyEverythingRecord oldRecord, MyEverythingRecord newRecord) {

			new Log.Log.LogFactory().GetLog("monitor").Info(true, "重命名事件:" + oldRecord.FullPath + " --> " + newRecord.FullPath);
		};
		monitor.RecordChangeEvent += delegate (MyEverythingRecord record) {
			new Log.Log.LogFactory().GetLog("monitor").Info(true, "修改事件:" + record.FullPath);
		};
		monitor.Monitor(volume.Split(' ').ToList(), db);

	}

……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant