Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }