private static IEnumerable <PropertyItem> GetItemsInternal(string path, Detaillevel details) { if (IsNetAssembly(path)) { var assembly = AssemblyDefinition.ReadAssembly(path); yield return(new PropertyItem("Assembly Version", assembly.Name.Version)); var description = assembly.CustomAttributes.FirstOrDefault(c => c.AttributeType.Name == "AssemblyDescriptionAttribute"); if (description != null) { yield return(new PropertyItem("Description", description.ConstructorArguments.FirstOrDefault().Value)); } var token = GetPublicKeyToken(assembly); if (!string.IsNullOrEmpty(token)) { yield return(new PropertyItem("Public Key Token", token)); } var debugModes = GetDebugInfo(assembly).ToList(); if (debugModes.Any()) { yield return(new PropertyItem("Debug Attributes", string.Join(Environment.NewLine, debugModes))); } yield return(new PropertyItem("Runtime Version", assembly.MainModule.RuntimeVersion)); yield return(new PropertyItem("References", string.Join(Environment.NewLine, assembly.MainModule.AssemblyReferences))); if (details == Detaillevel.Full) { yield return(new PropertyItem("Custom Attributes", string.Join(Environment.NewLine, assembly.CustomAttributes.Select(c => c.AttributeType.Name + " = " + c.ConstructorArguments.FirstOrDefault().Value)))); } } }
public Task <IEnumerable <PropertyItem> > GetItems(IItem item, Detaillevel details) { var so = ShellObject.FromParsingName(item.Path); var ret = from sp in so.Properties.DefaultPropertyCollection let nameClean = CleanupPropertyName(sp?.CanonicalName) where !string.IsNullOrEmpty(sp?.CanonicalName) && sp.ValueAsObject != null select new PropertyItem("FileInfos", nameClean, nameClean, sp.ValueAsObject.ToString()); return(Task.FromResult(ret)); }
public Task <IEnumerable <PropertyItem> > GetItems(IItem item, Detaillevel details) { return(Task.Run(() => { if (item is FileItem fileItem) { var path = fileItem.GetPathResolved(); if (IsNetAssembly(path)) { return GetItemsInternal(path, details); } } return Enumerable.Empty <PropertyItem>(); })); }
public async Task <IEnumerable <PropertyItem> > GetItems(IItem item, Detaillevel detail) { var book = await EpubReader.OpenBookAsync(item.Path).ConfigureAwait(false); var properties = new List <PropertyItem> { new PropertyItem("Title", book.Title), new PropertyItem("Authors", string.Join(Environment.NewLine, book.AuthorList)), }; var cover = await book.ReadCoverAsync().ConfigureAwait(false); if (cover != null) { properties.Add(new PropertyItem("Thumbnail", ImageFromBuffer(cover))); } return(properties.AsEnumerable()); }
public override async Task SetItem(FileItem item, Detaillevel detail) { _shellObject = await Task.Factory.StartNew(() => ShellObject.FromParsingName(item.Path)).ConfigureAwait(false); await base.SetItem(item, detail).ConfigureAwait(false); }