ParseUSN() публичный статический Метод

public static ParseUSN ( string volume, MyEverything.PInvokeWin32 usn ) : MyEverythingRecord
volume string
usn MyEverything.PInvokeWin32
Результат MyEverythingRecord
Пример #1
0
        private void ProcessRenameNewName(PInvokeWin32.USN_RECORD usn, string volume, MyEverythingDB db)
        {
            // frn 没有改变
            // newname = usn.FileName
            // 根据usn.FRN可以从db中获取oldname
            // db.update...
            MyEverythingRecord newRecord = MyEverythingRecord.ParseUSN(usn);
            string             fullpath  = newRecord.Name;

            db.FindRecordPath(newRecord, ref fullpath, db.GetFolderSource(volume));
            newRecord.FullPath = fullpath;
            var    oldRecord = db.FindByFrn(volume, usn.FRN);
            string newname   = newRecord.FullPath;

            Debug.WriteLine(string.Format(">>>> RenameFile {0} to {1}", oldRecord.FullPath, newname));
            db.UpdateRecord(volume, newRecord,
                            usn.IsFolder ? MyEverythingRecordType.Folder : MyEverythingRecordType.File);
            if (RecordRenameEvent != null)
            {
                RecordRenameEvent(oldRecord, newRecord);
            }
            if (newname.Contains("$RECYCLE.BIN"))
            {
                Debug.WriteLine(string.Format(">>>> Means {0} moved to recycle.", oldRecord.FullPath));
            }
        }
Пример #2
0
        private void ProcessFileCreate(PInvokeWin32.USN_RECORD usn, string volume, MyEverythingDB db)
        {
            MyEverythingRecord record   = MyEverythingRecord.ParseUSN(usn);
            string             fullpath = record.Name;

            db.FindRecordPath(record, ref fullpath, db.GetFolderSource(volume));
            record.FullPath = fullpath;
            db.AddRecord(volume, record, usn.IsFolder ? MyEverythingRecordType.Folder : MyEverythingRecordType.File);
            Debug.WriteLine(string.Format(">>>> NewFile: {0}", record.FullPath));
            if (RecordAddedEvent != null)
            {
                RecordAddedEvent(record);
            }
        }