using System.Collections.Generic;
using System.IO;
namespace OpenVIII
{
public sealed partial class ArchiveZzz
{
#region Classes
public static class FileData
{
#region Methods
///
/// Convert the FileData for ZZZ to a String and FI pair
///
/// Binary reader with raw data.
/// String and FI pair
public static KeyValuePair Load(BinaryReader br)
{
var filenameLength = br.ReadInt32();
var filenameBytes = br.ReadBytes(filenameLength);
return new KeyValuePair(ConvertFilename(filenameBytes), new FI(checked((int)br.ReadInt64()), checked((int)br.ReadUInt32())));
}
///
/// Decode/Encode the filename string as bytes.
///
///
/// Could be Ascii or UTF8, I see no special characters and the first like 127 of UTF8 is the
/// same as Ascii.
///
private static string ConvertFilename(byte[] filenameBytes) => System.Text.Encoding.UTF8.GetString(filenameBytes);
#endregion Methods
}
#endregion Classes
}
}