C 原始碼學習之 監控檔案系統

2021-04-13 09:01:41 字數 2026 閱讀 5449

說明:建立windows應用程式,在e盤上建立資料夾wang

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.text;

using system.windows.forms;

using system.io;

namespace filewatch

this.watch = new filesystemwatcher();

this.watch.deleted+=new filesystemeventhandler(this.ondeleted);

this.watch.renamed+=new renamedeventhandler(this.onrenamed);

this.watch.changed+=new filesystemeventhandler(this.onchanged);

this.watch.created+=new filesystemeventhandler(this.oncreated);

}public void ondeleted(object source,filesystemeventargs e)

deleted ", e.fullpath);

sw.close();

control.checkforillegalcrossthreadcalls = false;//此屬性是在.net framework 2.0新增加的,如果不設為false,會出錯!

label1.text="wrote deleted event to log";

}catch(ioexception ex)

}public void onrenamed(object source,renamedeventargs e)

to ",e.oldname ,e.fullpath);

sw.close();

control.checkforillegalcrossthreadcalls = false;//此屬性是在.net framework 2.0新增加的,如果不設為false,會出錯!

label1.text = "wrote renamed event to log";

}catch (ioexception ex)

}public void onchanged(object source, filesystemeventargs e)

", e.fullpath, e.changetype.tostring());

sw.close();

control.checkforillegalcrossthreadcalls = false;//此屬性是在.net framework 2.0新增加的,如果不設為false,會出錯!

label1.text = "wrote changed event to log";

}catch (ioexception ex)

}public void oncreated(object source, filesystemeventargs e)

created ", e.fullpath);

sw.close();

control.checkforillegalcrossthreadcalls = false;//此屬性是在.net framework 2.0新增加的,如果不設為false,會出錯!

label1.text = "wrote create event to log";

}catch (ioexception ex)

}private void button1_click(object sender, eventargs e)

this.button2.enabled = true;

}private void button2_click(object sender, eventargs e)}}

檔案系統原始碼分析之inode c

inode.c主要是管理檔案系統中inode結構的,功能包括,把硬碟的inode讀入內容,把記憶體的inode內容寫入硬碟,或記憶體的inode表中獲取乙個空的或者指定的inode,生成乙個管道的inode,查詢inode中的某個塊,或者在inode中生成新的塊。linux fs inode.c c...

檔案系統原始碼分析之普通檔案讀寫

檔案讀寫主要是通過inode結構裡的資料,讀取或者寫入到底層的硬碟中,並更新相應的屬性。linux fs read write.c c 1991 linus torvalds include include include include include include extern intrw c...

uboot修改原始碼之支援燒寫檔案系統

燒寫檔案系統 tftp 30000000 fs mini mdev.jffs2 nand erase.part root nand write.jffs2 30000000 260000 5b89a8 啟動之前修改啟動引數 set bootargs console ttysac0 root dev ...