Example #1
0
        /// <summary>
        /// Gets the file bytes based on name
        /// </summary>
        /// <param name="s">The serializer object</param>
        /// <param name="fileName">The file name</param>
        /// <returns>The file bytes</returns>
        public async UniTask <byte[]> GetFileBytesAsync(SerializerObject s, string fileName)
        {
            // Attempt to find the file
            var file = GetFile(fileName);

            s.Goto(BaseOffset + file.FileOffset);

            await s.FillCacheForRead((int)file.FileSize);

            // Read the bytes
            byte[] buffer = s.SerializeArray <byte>(default, file.FileSize, name: nameof(buffer));