Exemple #1
0
        public void HandleGameData(object sender, GameDataReceivedEventArgs e)
        {
            var jsonString = e.Json.ToString();

            // Ensure it's Dota 2 JSON
            if (!jsonString.Contains("Dota 2"))
                return;

            // Parse the JSON
            DataModel = JsonConvert.DeserializeObject<Dota2DataModel>(jsonString);
        }
 protected virtual void OnGameDataReceived(GameDataReceivedEventArgs e)
 {
     GameDataReceived?.Invoke(this, e);
 }
Exemple #3
0
 protected virtual void OnGameDataReceived(GameDataReceivedEventArgs e)
 {
     GameDataReceived?.Invoke(this, e);
 }
        public void HandleGameData(object sender, GameDataReceivedEventArgs e)
        {
            var jsonString = e.Json.ToString();

            // Ensure it's CS:GO JSON
            if (!jsonString.Contains("Counter-Strike: Global Offensive"))
                return;

            // Parse the JSON
            try
            {
                if (DataModel == null)
                    DataModel = new CounterStrikeDataModel();
                JsonConvert.PopulateObject(jsonString, DataModel);
            }
            catch (Exception ex)
            {
                Logger?.Error(ex, "Failed to deserialize CS:GO JSON");
                throw;
            }
        }