/// <summary> /// Operation the specified loginSite, imageUrl and image. /// </summary> /// <param name="loginSite">Login site.</param> /// <param name="imageUrl">Image URL.</param> /// <param name="image">Image.</param> public string Operation(string loginSite, string imageUrl = "", Image image = null) { string result = ""; TTransport transport = new TSocket(_host, _port); try { TProtocol protocol = new TBinaryProtocol(transport); ThriftOperation.Client client = new ThriftOperation.Client(protocol); transport.Open(); OperationObj operationObj = new OperationObj() { LoginSite = loginSite, ImageUrl = imageUrl, //Image = ImageHelper.GetBytesByImage(image) }; result = client.Operation(operationObj); } catch (Exception ex) { ILog logger = LogManager.GetLogger(typeof(ThriftHelper)); logger.Error("Operation Not Found!" + Environment.NewLine + ex.ToString()); } finally { transport.Close(); } return(result); }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { OperationObj = new OperationObj(); OperationObj.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void send_Operation(OperationObj operationObj) { oprot_.WriteMessageBegin(new TMessage("Operation", TMessageType.Call, seqid_)); Operation_args args = new Operation_args(); args.OperationObj = operationObj; args.Write(oprot_); oprot_.WriteMessageEnd(); oprot_.Transport.Flush(); }
public string Operation(OperationObj operationObj) { send_Operation(operationObj); return(recv_Operation()); }