Пример #1
0
 private ScrumTeam DeserializeScrumTeam(string json)
 {
     using (var reader = new StringReader(json))
     {
         return(_scrumTeamSerializer.Deserialize(reader));
     }
 }
 private static ScrumTeam DeserializeTeam(string json, DateTimeProvider dateTimeProvider = null)
 {
     using (var reader = new StringReader(json))
     {
         var serializer = new ScrumTeamSerializer(dateTimeProvider, GuidProvider.Default, DeckProvider.Default);
         return(serializer.Deserialize(reader));
     }
 }
        /// <summary>
        /// Loads the Scrum team from repository.
        /// </summary>
        /// <param name="teamName">Name of the team.</param>
        /// <returns>The Scrum team with specified name.</returns>
        public ScrumTeam LoadScrumTeam(string teamName)
        {
            if (string.IsNullOrEmpty(teamName))
            {
                throw new ArgumentNullException(nameof(teamName));
            }

            string file = GetFileName(teamName);

            file = Path.Combine(Folder, file);

            ScrumTeam result = null;

            if (File.Exists(file))
            {
                try
                {
                    using (var reader = File.OpenText(file))
                    {
                        result = _scrumTeamSerializer.Deserialize(reader);
                    }
                }
                catch (IOException)
                {
                    // file is not accessible
                    result = null;
                }
                catch (JsonReaderException)
                {
                    // file is currupted
                    result = null;
                }
            }

            if (result != null)
            {
                _logger.LogDebug(Resources.Repository_Debug_LoadScrumTeam, result.Name);
            }

            return(result);
        }