public override object GetMetaData(IFile file) { if (file == null || file.Name == null) { return(null); } var descriptor = file.ExtensibleTag.GetInstance <ICategoryDescriptor>(Constants.FileTag_CategoryDescriptor); if (descriptor == null || descriptor.IsExpired) { descriptor = NameCategoryService.GetNameCategory(file.Name); if (descriptor != null) { file.ExtensibleTag.SetInstance(descriptor, Constants.FileTag_CategoryDescriptor); return($"{descriptor.CategoryName}-{descriptor.Key}"); } } else { return($"{descriptor.CategoryName}-{descriptor.Key}"); } return(null); }
public void TestGetKeyPair() { var pair = NameCategoryService.GetNameCategory("thumbcache_96.db"); Assert.IsNotNull(pair); Assert.IsFalse(pair.IsExpired); Assert.AreEqual(pair.CategoryName, "Windows 7缩略图"); }
public void TestExpired() { var pair = NameCategoryService.GetNameCategory("thumbcache_96.db"); Assert.IsNotNull(pair); Assert.IsFalse(pair.IsExpired); NameCategoryService.LoadDescriptorsFromFile("D:\\SingularitySolution\\SingularityForensic\\FileExplorer\\File Type Categories.txt"); Assert.IsTrue(pair.IsExpired); }
private void Button_Click(object sender, RoutedEventArgs e) { var file = DialogService.Current.OpenFile(); if (string.IsNullOrEmpty(file)) { return; } //NameCategoryService.LoadDescriptorsFromFile("E://anli/File Type Categories.txt"); NameCategoryService.LoadDescriptorsFromFile(file); }
private static void LoadCategoryNameDescriptors() { var fileName = DialogService.Current.OpenFile(); if (string.IsNullOrEmpty(fileName)) { return; } try { NameCategoryService.LoadDescriptorsFromFile(fileName); } catch (Exception ex) { LoggerService.WriteException(ex); MsgBoxService.Current.Show(ex.Message); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { NameCategoryService.LoadDescriptorsFromFile("E://anli/1.txt"); }
public void TestLoadKeyPairFrom() { NameCategoryService.LoadDescriptorsFromFile("D:\\SingularitySolution\\SingularityForensic\\FileExplorer\\File Type Categories.txt"); }