Пример #1
0
 public LibraProtocalWrapper(string caller)
 {
     _callMode = new LibraProtocalModel()
     {
         Flag = caller, Parameters = null
     };
 }
Пример #2
0
    public static LibraResult <S> Post <S>(string url, LibraProtocalModel callModel)
    {
        var request = GetClientInternal();

        try
        {
            StringContent content = new StringContent(JsonSerializer.Serialize(callModel));
            content.Headers.ContentType.MediaType = "application/json";
            var result = request.PostAsync(url + "api/Libra", content).Result;
            if (result.IsSuccessStatusCode)
            {
                if (result.StatusCode != System.Net.HttpStatusCode.NoContent)
                {
                    var message = result.Content.ReadAsStringAsync().Result;
                    if (message == "该类型不支持远程调用!")
                    {
                        throw new Exception($"{callModel.Flag} 暂不支持远程调用!");
                    }
                    return(JsonSerializer.Deserialize <LibraResult <S> >(message));
                }
            }
            return(default);
Пример #3
0
 public string Run(LibraProtocalModel model)
 {
     return(LibraProtocalAnalysis.Call(model.Flag, model.Parameters));
 }
Пример #4
0
 public static LibraResult <S> Post <S>(LibraProtocalModel callModel)
 {
     return(Post <S>(_baseUrl, callModel));
 }