private Role LoadRole(RoleType roleType) { string fileName = Enum.GetName(typeof(RoleType), roleType) + ".xml"; string filePath = Path.Combine(_rolesDirectoryPath, fileName); Role role; if (_diskInputOutputService.FileExists(filePath)) { role = _diskInputOutputService.LoadXmlFile <Role>(filePath); } else { role = new Role { Ids = new List <string>(), Type = roleType }; } _cacheService.SetRole(role, filePath); return(role); }
private Album LoadAlbum(string dirPath) { string albumFilePath = GetAlbumFilePath(dirPath); var album = _diskInputOutputService.LoadXmlFile <Album>(albumFilePath); album.DirectoryPath = dirPath; album.PhotoCount = GetValidPhotoFilePaths(dirPath).Count(); _cacheService.SetAlbum(album, dirPath); return(album); }
private Profile TryLoadProfile(string id) { string filePath = GetFilePath(id); if (!_diskInputOutputService.FileExists(filePath)) { return(null); } var profile = _diskInputOutputService.LoadXmlFile <Profile>(filePath); _cacheService.SetProfile(profile, filePath); return(profile); }