protected override ResponseData Request(RequestData requestData) { ProcessWriter.WriteLine(JsonConvert.SerializeObject(requestData)); ProcessWriter.Flush(); var s = Process.StandardOutput.ReadLine(); if (s != null) { return(JsonConvert.DeserializeObject <ResponseData>(s)); } else { Process.StandardError.ReadToEnd(); throw new Exception("Action意外结束"); } }
public override void Dispose() { if (Process != null) { ProcessWriter.WriteLine(); ProcessWriter.Flush(); Process.StandardOutput.ReadLine(); ProcessWriter.Close(); ProcessWriter.Dispose(); ProcessWriter = null; Process.Close(); Process.Dispose(); Process = null; } }