Esempio n. 1
0
        public static void Main(string[] args)
        {
            var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

            XmlConfigurator.Configure(logRepository, new FileInfo(args[2]));
            _userName                   = args[0];
            _coordinatorUrl             = args[3];
            _test                       = bool.Parse(args[5]);
            _magicNumber                = ulong.Parse(args[6]);
            _dbOptions                  = new DbContextOptionsBuilder <Repository>().UseNpgsql(args[4]).Options;
            _dotaClient                 = new DotaClient();
            _dotaClient.OnDota2Launched = () => {
                _dotaClient.LeaveLobby(); //Try leaving the current lobby on startup in case the client was shut down forcefully and couldn't leave the lobby before.
                StartCoordinatorTaskPoller();
                StartMatchHistoryRequester();
                StartLobbyTimeoutChecker();
            };
            _dotaClient.OnLobbyUpdate                = OnLobbyUpdate;
            _dotaClient.OnChatMessage                = OnChatMessage;
            _dotaClient.OnChatChannelJoined          = OnChatChannelJoin;
            _dotaClient.OnPlayerMatchHistoryResponse = OnGetPlayerMatchHistoryResponse;
            _dotaClient.OnCacheUnsubscribed          = OnCacheUnsubscribed;
            _dotaClient.OnReadyUpStatus              = OnReadyUpStatus;
            _dotaClient.Connect(_userName, args[1]);
        }
Esempio n. 2
0
        public void GetMatchMeta()
        {
            SteamDirectory.Initialize().Wait();

            var userinfo   = GetUserInfo();
            var gameClient = new DotaClient(userinfo.Username, userinfo.Password);

            gameClient.Connect();

            var controller = new MatchController(gameClient);
            var match      = controller.Get(3111014659);

            Assert.IsNotNull(match);
        }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var section  = this.Configuration.GetSection("Site");
            var username = section.GetValue <string>("SteamUsername");
            var password = section.GetValue <string>("SteamPassword");

            var gameClient = new DotaClient(username, password);

            gameClient.Connect();
            services.AddSingleton <DotaClient>(gameClient);

            services.AddResponseCaching();

            // Add framework services.
            services.AddMvc();
        }
Esempio n. 4
0
 public void Connect()
 {
     DotaClient = new DotaClient();
     DotaClient.OnDota2Launched     = OnDota2Startup;
     DotaClient.OnChatChannelJoined = OnChatChannelJoin;
     DotaClient.OnChatMessage       = OnChatMessage;
     if (OnGetPlayerMatchHistoryResponse != null)
     {
         DotaClient.OnPlayerMatchHistoryResponse = OnGetPlayerMatchHistoryResponse;
     }
     if (OnMatchDetailsResponse != null)
     {
         DotaClient.OnMatchDetailsResponse = OnMatchDetailsResponse;
     }
     DotaClient.OnClientConnectionStatus = OnClientConnectionStatus;
     DotaClient.OnDisconnected           = OnDisconnected;
     DotaClient.Connect(_config.CoordinatorBot.UserName, _config.CoordinatorBot.Password);
 }
Esempio n. 5
0
 public MatchController(DotaClient dotaClient)
 {
     this.DotaClient = dotaClient;
 }
Esempio n. 6
0
 public ReplayController(DotaClient dotaClient)
 {
     this.DotaClient = dotaClient;
 }