Esempio n. 1
0
        private static T LoadJsonDocument <T>(IReadOnlyArchiveEntry entry)
        {
            using var zipStream = entry.OpenRead();
            using var sr        = new StreamReader(zipStream);
            using var reader    = new JsonTextReader(sr);

            var serializer = new JsonSerializer();

            return(serializer.Deserialize <T>(reader));
        }
Esempio n. 2
0
        internal PackageResource(PackageExplorer packageExplorer, PackageDirectory directory, IReadOnlyArchiveEntry contentEntry, PackageResourceMetadataModel metadataModel)
        {
            Explorer     = packageExplorer;
            Directory    = directory;
            Dependencies = new PackageResourceDependencies(packageExplorer, metadataModel);
            Tags         = new PackageResourceTags();

            Name = contentEntry.Name;

            string withoutData = contentEntry.FullName.Substring(5);

            FullName = withoutData;

            Content = new PackageResourceContent(packageExplorer, contentEntry.FullName, contentEntry);

            int dotIndex = contentEntry.FullName.LastIndexOf('.');

            Extension = dotIndex != -1
                                ? contentEntry.FullName.Substring(dotIndex)
                                : null;
        }
Esempio n. 3
0
        internal PackageResourceContent(PackageExplorer packageExplorer, string contentKey, IReadOnlyArchiveEntry zipArchiveEntry)
        {
            this.packageExplorer = packageExplorer;
            this.contentKey      = contentKey;

            CompressedSize   = zipArchiveEntry.CompressedSize;
            UncompressedSize = zipArchiveEntry.UncompressedSize;
        }