示例#1
0
        private static async Task <T> GetAlphaEndpoint <T>(ConstellationConfig constellationConfig)
        {
            var origin = (constellationConfig.UseSecureConnection ? "https://" : "http://") +
                         constellationConfig.AlphaServerAddress;

            using (var httpClient = new HttpClient())
            {
                var res = await httpClient.GetAsync($"{origin}/api/constellation/info");

                if (!res.IsSuccessStatusCode)
                {
                    throw new Exception("Request failed with code: " + res.StatusCode);
                }

                var rawJson = await res.Content.ReadAsStringAsync();

                return(JsonConvert.DeserializeObject <T>(rawJson));
            }
        }
 public CentaurusClient(ConstellationConfig constellationConfig)
 {
     Config       = constellationConfig;
     AccountState = new AccountState();
 }
示例#3
0
 public Connection(ConstellationConfig constellationConfig)
 {
     Config = constellationConfig;
 }
示例#4
0
 public static async Task <ConstellationInfo> GetConstellationInfo(ConstellationConfig constellationConfig)
 {
     return(await GetAlphaEndpoint <ConstellationInfo>(constellationConfig));
 }