コード例 #1
0
ファイル: Dota2Model.cs プロジェクト: SpoinkyNL/Artemis
        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);
        }
コード例 #2
0
 protected virtual void OnGameDataReceived(GameDataReceivedEventArgs e)
 {
     GameDataReceived?.Invoke(this, e);
 }
コード例 #3
0
 protected virtual void OnGameDataReceived(GameDataReceivedEventArgs e)
 {
     GameDataReceived?.Invoke(this, e);
 }
コード例 #4
0
        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;
            }
        }