Exemplo n.º 1
0
        private async Task LogNumberOfRuns()
        {
            try
            {
                int numRuns = 0;
                _skillStorage = SkillStorage.GetDatabase(Skill);

                //Keep track of the number of times this is run in the file
                IDictionary <string, object> storedData = await _skillStorage.LoadDataAsync();

                if (storedData != null && storedData.ContainsKey("NumberOfRuns"))
                {
                    numRuns = Convert.ToInt32(storedData["NumberOfRuns"]);
                }

                await _skillStorage.SaveDataAsync(new Dictionary <string, object> {
                    { "NumberOfRuns", ++numRuns }
                });
            }
            catch (Exception ex)
            {
                _misty.SkillLogger.Log("Failed to update run number in data store.", ex);
            }
        }