TagTool.Cache.TagCache.ExtractTagRaw C# (CSharp) Méthode

ExtractTagRaw() public méthode

Reads a tag's raw data from the file, including its header.
public ExtractTagRaw ( Stream stream, TagInstance tag ) : byte[]
stream Stream The stream to read from.
tag TagTool.TagGroups.TagInstance The tag to read.
Résultat byte[]
        public byte[] ExtractTagRaw(Stream stream, TagInstance tag)
        {
            if (tag == null)
                throw new ArgumentNullException(nameof(tag));
            if (tag.HeaderOffset < 0)
                throw new ArgumentException("The tag is not in the cache file");
            stream.Position = tag.HeaderOffset;
            var result = new byte[tag.TotalSize];
            stream.Read(result, 0, result.Length);
            return result;
        }