* move stuff out into file transfer manager * obnoxious unsupported version text, adjustments to filetransfermanager * add back file upload transfer progress * restructure code * cleanup some more stuff I guess * downloadids by playername * individual anim/sound bs * fix migration stuff, finalize impl of individual sound/anim pause * fixes with logging stuff * move download manager to transient * rework dl ui first iteration * some refactoring and cleanup * more code cleanup * refactoring * switch to hostbuilder * some more rework I guess * more refactoring * clean up mediator calls and disposal * fun code cleanup * push error message when log level is set to anything but information in non-debug builds * remove notificationservice * move message to after login * add download bars to gameworld * fixes download progress bar * set gpose ui min and max size * remove unnecessary usings * adjustments to reconnection logic * add options to set visible/offline groups visibility * add impl of uploading display, transfer list in settings ui * attempt to fix issues with server selection * add back download status to compact ui * make dl bar fixed size based * some fixes for upload/download handling * adjust text from Syncing back to Uploading --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com> Co-authored-by: Stanley Dimant <stanley.dimant@varian.com>
54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
namespace MareSynchronos.PlayerData.Export;
|
|
|
|
public record MareCharaFileHeader(byte Version, MareCharaFileData CharaFileData)
|
|
{
|
|
public static readonly byte CurrentVersion = 1;
|
|
|
|
public byte Version { get; set; } = Version;
|
|
public MareCharaFileData CharaFileData { get; set; } = CharaFileData;
|
|
public string FilePath { get; private set; } = string.Empty;
|
|
|
|
public void WriteToStream(BinaryWriter writer)
|
|
{
|
|
writer.Write('M');
|
|
writer.Write('C');
|
|
writer.Write('D');
|
|
writer.Write('F');
|
|
writer.Write(Version);
|
|
var charaFileDataArray = CharaFileData.ToByteArray();
|
|
writer.Write(charaFileDataArray.Length);
|
|
writer.Write(charaFileDataArray);
|
|
}
|
|
|
|
public static MareCharaFileHeader? FromBinaryReader(string path, BinaryReader reader)
|
|
{
|
|
var chars = new string(reader.ReadChars(4));
|
|
if (!string.Equals(chars, "MCDF", StringComparison.Ordinal)) throw new InvalidDataException("Not a Mare Chara File");
|
|
|
|
MareCharaFileHeader? decoded = null;
|
|
|
|
var version = reader.ReadByte();
|
|
if (version == 1)
|
|
{
|
|
var dataLength = reader.ReadInt32();
|
|
|
|
decoded = new(version, MareCharaFileData.FromByteArray(reader.ReadBytes(dataLength)))
|
|
{
|
|
FilePath = path,
|
|
};
|
|
}
|
|
|
|
return decoded;
|
|
}
|
|
|
|
public static void AdvanceReaderToData(BinaryReader reader)
|
|
{
|
|
reader.ReadChars(4);
|
|
var version = reader.ReadByte();
|
|
if (version == 1)
|
|
{
|
|
var length = reader.ReadInt32();
|
|
_ = reader.ReadBytes(length);
|
|
}
|
|
}
|
|
} |