Beispiel #1
0
        public void SaveShadowFile(string filePath, ShadowFileDto dto)
        {
            var jsonFile = Path.ChangeExtension(filePath, "json");
            var json     = JsonConvert.SerializeObject(dto);

            _fileProxy.WriteAllText(jsonFile, json);
        }
Beispiel #2
0
        private async Task <IReadOnlyCollection <FileTag> > LoadTagsAsync(ShadowFileDto shadowFile)
        {
            if (!shadowFile.TagNames.Any())
            {
                return(new List <FileTag>());
            }

            return(await _fileTagRepository.LoadAsyncByNames(shadowFile.TagNames));
        }
Beispiel #3
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);
        }