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

            return(result);
        }
Exemple #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));
        }
        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();
        }
Exemple #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);
        }
Exemple #5
0
        public string ReadTextFile(string path)
        {
            if (!fileProxy.Exists(path))
            {
                return(string.Empty);
            }

            var text = fileProxy.ReadAllText(path);

            return(text);
        }
        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);
        }
Exemple #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);
        }
        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);
        }