コード例 #1
0
        private FeedEntry DeserializeManifest(VsixPackagePartNode part, string fileName, string category)
        {
            var entry = new FeedEntry(fileName, category);

            using (var stream = part.Part.GetStream(FileMode.Open))
            {
                var vsixSerializer = new VsixSerializer();
                var vsix           = vsixSerializer.Deserialize(stream) as Vsix;
                if (vsix == null)
                {
                    throw new Exception("Could not deserialize VSIX manifest from " + fileName);
                }
                entry.Title  = vsix.Identifier.Name;
                entry.Id     = vsix.Identifier.Id;
                entry.Author = new FeedEntryAuthor {
                    Name = vsix.Identifier.Author
                };
                entry.Content = new FeedEntryContent {
                    Src = BuildUri(category, fileName), Type = "octet/stream"
                };
                entry.Vsix = new FeedEntryVsix {
                    Id = vsix.Identifier.Id, Version = vsix.Identifier.Version
                };
                entry.MoreInfo = vsix.References.Any() ? vsix.References.First().MoreInfoUrl : string.Empty;
                entry.Summary  = vsix.Identifier.Description;
            }
            return(entry);
        }
コード例 #2
0
        private static VsixItem ReadVsixV2(string name, VsixPackagePartNode packageNode, byte[] content)
        {
            using (var stream = packageNode.Part.GetStream(FileMode.Open))
            {
                using (var sr = new StreamReader(stream))
                {
                    var vsixSerializer = new VsixSerializer();
                    var vsixManifest   = vsixSerializer.Deserialize(sr) as Vsix;
                    if (vsixManifest == null)
                    {
                        throw new Exception("Could not deserialize VSIX manifest from " + name);
                    }

                    return(new VsixItem(vsixManifest, content));
                }
            }
        }