Пример #1
0
        public void GetContentById(uint index, Stream output)
        {
            var fileDes = fileDescriptors[index];

            if ((fileDes.Flags & FileInvalid) != 0)
            {
                throw new Exception("File Invalid");
            }

            if ((fileDes.LinkFlags & LinkPrev) != 0)
            {
                GetContentById(fileDes.LinkToPrevious, output);
                return;
            }

            if ((fileDes.Flags & FileObfuscated) != 0)
            {
                throw new NotImplementedException("Haven't implemented obfuscated files");
            }

            using (var reader = new CabReader(context, fileDes, index, Name))
                reader.CopyTo(output);

            if (output.Length != fileDes.ExpandedSize)
            {
                throw new Exception("Did not fully extract Expected = {0}, Got = {1}".F(fileDes.ExpandedSize, output.Length));
            }
        }
Пример #2
0
        public Stream GetContentById(uint index)
        {
            var fileDes = fileDescriptors[index];

            if ((fileDes.Flags & FileInvalid) != 0)
            {
                throw new Exception("File Invalid");
            }

            if ((fileDes.LinkFlags & LinkPrev) != 0)
            {
                return(GetContentById(fileDes.LinkToPrevious));
            }

            if ((fileDes.Flags & FileObfuscated) != 0)
            {
                throw new NotImplementedException("Haven't implemented obfustcated files");
            }

            var output = new MemoryStream((int)fileDes.ExpandedSize);

            using (var reader = new CabReader(fileDes, index, commonName))
                reader.CopyTo(output);

            if (output.Length != fileDes.ExpandedSize)
            {
                throw new Exception("Did not fully extract Expected = {0}, Got = {1}".F(fileDes.ExpandedSize, output.Length));
            }

            output.Position = 0;
            return(output);
        }
Пример #3
0
		public void GetContentById(uint index, Stream output)
		{
			var fileDes = fileDescriptors[index];
			if ((fileDes.Flags & FileInvalid) != 0)
				throw new Exception("File Invalid");

			if ((fileDes.LinkFlags & LinkPrev) != 0)
			{
				GetContentById(fileDes.LinkToPrevious, output);
				return;
			}

			if ((fileDes.Flags & FileObfuscated) != 0)
				throw new NotImplementedException("Haven't implemented obfustcated files");

			using (var reader = new CabReader(fileDes, index, commonName))
				reader.CopyTo(output);

			if (output.Length != fileDes.ExpandedSize)
				throw new Exception("Did not fully extract Expected = {0}, Got = {1}".F(fileDes.ExpandedSize, output.Length));
		}
Пример #4
0
        public Stream GetContentById(uint index)
        {
            var fileDes = fileDescriptors[index];
            if ((fileDes.Flags & FileInvalid) != 0)
                throw new Exception("File Invalid");

            if ((fileDes.LinkFlags & LinkPrev) != 0)
                return GetContentById(fileDes.LinkToPrevious);

            if ((fileDes.Flags & FileObfuscated) != 0)
                throw new NotImplementedException("Haven't implemented obfuscated files");

            var output = new MemoryStream((int)fileDes.ExpandedSize);

            using (var reader = new CabReader(context, fileDes, index, Name))
                reader.CopyTo(output);

            if (output.Length != fileDes.ExpandedSize)
                throw new Exception("Did not fully extract Expected = {0}, Got = {1}".F(fileDes.ExpandedSize, output.Length));

            output.Position = 0;
            return output;
        }