Example #1
0
        public Resource Get(string resourceName)
        {
            var serializer = new BinaryResourceSerializer();
            var entryName  = GetEntryName(resourceName);
            var entry      = zip.GetEntry(entryName);

            if (entry == null)
            {
                throw new ResourceException($"Entry '{entryName}' not found");
            }

            // read to the buffer whole entry
            var ms     = new MemoryStream();
            var buffer = new byte[4096];

            StreamUtils.Copy(zip.GetInputStream(entry), ms, buffer);

            ms.Position = 0;
            return(serializer.Deserialize(ms));
        }
Example #2
0
        public Resource Get(string resourceName)
        {
            var data = client.DownloadData(resourceName + ".res");

            return(serializer.Deserialize(new MemoryStream(data)));
        }