Exemplo n.º 1
0
 /// <summary>
 ///     Initializes a new instance of the TravianClient class.
 /// </summary>
 /// <param name="a">Travian account.</param>
 /// <param name="client">Http client.</param>
 public TravianClient(Account a, HttpClient client)
 {
     Account = a;
     Client = client;
     Tasks = new List<Task>();
     Status = ClientStatus.NotLogged;
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Creates or gets a travian client.
        /// </summary>
        /// <param name="a">Account to be associated.</param>
        /// <param name="host">Host address.</param>
        /// <returns>Travian client.</returns>
        public TravianClient CreateTravianClient(Account a, string host)
        {
            if (TravianClients.ContainsKey(a.Username))
            {
                return TravianClients[a.Username];
            }

            var tc = new TravianClient(a, GetClient(a.Username, host));
            TravianClients.Add(a.Username, tc);

            if (NewClient != null)
            {
                NewClient.Invoke(tc);
            }

            return tc;
        }