Exemple #1
0
        // private Dictionary<int, AddOn> addons = new Dictionary<int, AddOn> ();
        // private Dictionary<int, Dictionary<int, AddOnFile>> addonFiles = new Dictionary<int, Dictionary<int, AddOnFile>> ();
        // private Dictionary<int, Dictionary<int, string>> addonFileChangelogs = new Dictionary<int, Dictionary<int, string>> ();
        // private Dictionary<int, string> addonDescriptions = new Dictionary<int, string> ();

        private async Task <AddOnServiceClient> Authenticate()
        {
            AddOnServiceClient client;

            var deserializer = new DeserializerBuilder()
                               .IgnoreUnmatchedProperties()
                               .WithNamingConvention(new CamelCaseNamingConvention())
                               .Build();

            var path = Path.Combine(Config.CONFIG, "curse.yaml");

            LoginResponse loginResponse;

            using (var reader = new StreamReader(File.OpenRead(path))) {
                var request = deserializer.Deserialize <LoginRequest> (reader);
                loginResponse = await loginClient.LoginAsync(request);

                logger.LogInformation($"Login: {loginResponse.Status}");
            }

            client = new AddOnServiceClient(AddOnServiceClient.EndpointConfiguration.BinaryHttpsAddOnServiceEndpoint);
            client.Endpoint.EndpointBehaviors.Add(new TokenEndpointBehavior(loginResponse));

            return(client);
        }
Exemple #2
0
 public Client(ILogger <Client> _logger, Cache _cache)
 {
     logger      = _logger;
     cache       = _cache;
     loginClient = new ClientLoginServiceClient(ClientLoginServiceClient.EndpointConfiguration.BinaryHttpsClientLoginServiceEndpoint);
     client      = Authenticate().Result;
 }