/// <summary> /// Creates an instance of <see cref="ZRequest"/> for <see cref="ZCommand.RunGame"/> /// </summary> /// <param name="runnableGameName">The runnable (sys) game name</param> /// <param name="commandArgs">The game run command args</param> /// <returns>An instance of <see cref="ZRequest"/> for <see cref="ZCommand.RunGame"/></returns> public static ZRequest CreateRunGameRequest(string runnableGameName, string commandArgs) => new ZRequest { RequestCommand = ZCommand.RunGame, Method = ZRequestMethod.Get, RequestPayload = ZBitConverter.Convert(runnableGameName) .Concat(ZBitConverter.Convert(commandArgs)) .ToArray() };
/// <summary> /// Creates an instance of <see cref="ZRequest"/> for <see cref="ZCommand.Inject"/> /// </summary> /// <param name="game">The target game</param> /// <param name="dllPath">The path to dll to inject</param> /// <returns>An instance of <see cref="ZRequest"/> for <see cref="ZCommand.Inject"/></returns> public static ZRequest CreateDllInjectRequest(ZGame game, string dllPath) => new ZRequest { RequestCommand = ZCommand.Inject, Method = ZRequestMethod.Get, RequestPayload = new[] { (byte)game } .Concat(ZBitConverter.Convert(dllPath)) .ToArray() };
/// <summary> /// Converts this instance to byte array representation /// </summary> /// <returns>Request in byte array representation</returns> public byte[] ToByteArray() { var requestBytes = new[] { (byte)RequestCommand } .Concat(ZBitConverter.Convert(RequestPayload.Length)) .Concat(RequestPayload) .ToArray(); return(requestBytes); }