Ejemplo n.º 1
0
        public static async Task <IBook> ToPlatformAsync([NotNull] this ContentPackage source)
        {
            var result = new Book
            {
                Name  = source.GetValue(ParamBookName, DefaultName),
                Pages = source.GetParts().Select(part => part.ToPlatform())
            };
            var configuration = InteractiveInkServices.EngineService.Engine.Configuration;
            var identifier    = configuration.GetString(ConfigurationKeys.Language);

            result.Language = InteractiveInkServices.LanguageService.Languages.Single(x => x.Tag == identifier);
            if (!(await source.GetTargetFileAsync() is { } file))
            {
                return(result);
            }

            result.Name                 = source.GetValue(ParamBookName, file.DisplayName);
            result.TargetFile           = file;
            result.TargetFileProperties = await file.GetBasicPropertiesAsync();

            return(result);
        }