public SolutionModeConfiguration Load(string configurationId)
        {
            var filePath = CreateFilePath(configurationId);
            var jsonData = _fileProxy.ReadAllText(filePath);
            var result   = CreateModelFromJsonData(jsonData);

            return(result);
        }
コード例 #2
0
        public DogData GetDogData()
        {
            var jsonSerializerOptions = new JsonSerializerOptions();

            jsonSerializerOptions.PropertyNameCaseInsensitive = true;
            jsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
            return(JsonSerializer.Deserialize <DogData>(_fileProxy.ReadAllText(_jsonFilePath), jsonSerializerOptions));
        }
コード例 #3
0
        public void Initialize(string solutionPath)
        {
            var solutionConfigData  = _fileProxy.ReadAllText(solutionPath);
            var projectBlockStrings = _stringParsingService.GetBlockElements(
                solutionConfigData,
                SolutionConfigConstants.ProjectStartTagName,
                SolutionConfigConstants.ProjectEndTagName);

            _solutionProjectBlocks = projectBlockStrings.Select(str => new SolutionProjectBlock(str)).ToList();
        }
コード例 #4
0
        private IEnumerable <Comic> ReadSerializedComics()
        {
            var json = file.Exists(appSettings.ComicsFile) ?
                       file.ReadAllText(appSettings.ComicsFile) :
                       "";

            var comics = JsonConvert.DeserializeObject <Comic[]>(json) ?? new Comic[0];

            return(comics);
        }
コード例 #5
0
        public string ReadTextFile(string path)
        {
            if (!fileProxy.Exists(path))
            {
                return(string.Empty);
            }

            var text = fileProxy.ReadAllText(path);

            return(text);
        }
コード例 #6
0
ファイル: PlayDateCalculator.cs プロジェクト: missymessa/dogs
        public PlayDateCalculator(IDogDataDAO dogDataDAO, IFileProxy fileProxy, string dogFilePath)
        {
            _dogDataDAO   = dogDataDAO;
            _fileProxy    = fileProxy;
            _dogBreedData = _dogDataDAO.GetDogData();

            var jsonSerializerOptions = new JsonSerializerOptions();

            jsonSerializerOptions.PropertyNameCaseInsensitive = true;
            jsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
            _teamDogs = JsonSerializer.Deserialize <TeamDogs>(_fileProxy.ReadAllText(dogFilePath), jsonSerializerOptions);
        }
コード例 #7
0
        public ShadowFileDto LoadShadowFile(string filePath)
        {
            var jsonFile = Path.ChangeExtension(filePath, "json");

            if (!File.Exists(jsonFile))
            {
                return(ShadowFileDto.CreateEmpty(jsonFile));
            }

            var json   = _fileProxy.ReadAllText(jsonFile);
            var result = JsonConvert.DeserializeObject <ShadowFileDto>(json) ?? ShadowFileDto.CreateEmpty(filePath);

            return(result);
        }
コード例 #8
0
        public string CreateSolutionConfigData(string solutionPath, SolutionConfigurationFile solutionConfig)
        {
            var solutionConfigData = _fileProxy.ReadAllText(solutionPath);

            _solutionProjectBlockHandler.Initialize(solutionPath);

            var allBlocksInFile = _solutionProjectBlockHandler.GetAllBlocks();

            foreach (var blockInFile in allBlocksInFile)
            {
                if (!solutionConfig.CheckIfContainsReference(blockInFile.AssemblyName))
                {
                    solutionConfigData = solutionConfigData.Replace(blockInFile.Data, string.Empty);
                }
            }

            return(solutionConfigData);
        }