Пример #1
0
        public static async Task <bool> Read(TagLibMetaDataSource source, IList <MetaDataItem> metaDatas, File file)
        {
            var embedded = source.EmbeddedImages.Value;
            var loose    = source.LooseImages.Value;

            if (embedded && loose)
            {
                switch (MetaDataBehaviourConfiguration.GetImagesPreference(source.ImagesPreference.Value))
                {
                default:
                case ImagePreference.Embedded:
                    return(await ReadEmbedded(source, metaDatas, file).ConfigureAwait(false) || await ReadLoose(source, metaDatas, file).ConfigureAwait(false));

                case ImagePreference.Loose:
                    return(await ReadLoose(source, metaDatas, file).ConfigureAwait(false) || await ReadEmbedded(source, metaDatas, file).ConfigureAwait(false));
                }
            }
            else if (embedded)
            {
                return(await ReadEmbedded(source, metaDatas, file).ConfigureAwait(false));
            }
            else if (loose)
            {
                return(await ReadLoose(source, metaDatas, file).ConfigureAwait(false));
            }
            return(false);
        }
Пример #2
0
        public static async Task Write(TagLibMetaDataSource source, MetaDataItem metaDataItem, File file)
        {
            var embedded = source.EmbeddedImages.Value;
            var loose    = source.LooseImages.Value;

            if (embedded && loose)
            {
                switch (MetaDataBehaviourConfiguration.GetImagesPreference(source.ImagesPreference.Value))
                {
                default:
                case ImagePreference.Embedded:
                    await WriteEmbedded(source, metaDataItem, file).ConfigureAwait(false);

                    break;

                case ImagePreference.Loose:
                    WriteLoose(source, metaDataItem, file);
                    break;
                }
            }
            else if (embedded)
            {
                await WriteEmbedded(source, metaDataItem, file).ConfigureAwait(false);
            }
            else if (loose)
            {
                WriteLoose(source, metaDataItem, file);
            }
        }