using InABox.Core;
using System;
using System.Collections.Generic;
using System.Text;

namespace InABox.Rpc
{
    public class RpcInstallerResult : IRpcCommandResult
    {
        public byte[]? Installer { get; set; }

        public void SerializeBinary(CoreBinaryWriter writer)
        {
            if(Installer != null)
            {
                writer.Write(Installer.Length);
                writer.Write(Installer);
            }
            else
            {
                writer.Write(0);
            }
        }

        public void DeserializeBinary(CoreBinaryReader reader)
        {
            Installer = reader.ReadBytes(reader.ReadInt32());
            if(Installer.Length == 0)
            {
                Installer = null;
            }
        }

        public string? FullDescription() => null;
    }
}
