<commit_before>﻿using System;
using Plugin.DownloadManager.Abstractions;

namespace Plugin.DownloadManager
{
    /// <summary>
    /// Cross platform DownloadManager implemenations
    /// </summary>
    public class CrossDownloadManager
    {
        static Lazy<IDownloadManager> Implementation = new Lazy<IDownloadManager> (() => CreateDownloadManager (), System.Threading.LazyThreadSafetyMode.PublicationOnly);

#if __IOS__
        /// <summary>
        /// Set the background session completion handler.
        /// @see: https://developer.xamarin.com/guides/ios/application_fundamentals/backgrounding/part_4_ios_backgrounding_walkthroughs/background_transfer_walkthrough/#Handling_Transfer_Completion
        /// </summary>
        public static Action BackgroundSessionCompletionHandler;

        /// <summary>
        /// The URL session download delegate.
        /// @see https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionDownloadDelegate_protocol/#//apple_ref/occ/intfm/NSURLSessionDownloadDelegate/URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:
        /// </summary>
        public static UrlSessionDownloadDelegate UrlSessionDownloadDelegate;
#endif

        /// <summary>
        /// The platform-implementation
        /// </summary>
        public static IDownloadManager Current {
            get {
                var ret = Implementation.Value;
                if (ret == null) {
                    throw NotImplementedInReferenceAssembly ();
                }
                return ret;
            }
        }

        static IDownloadManager CreateDownloadManager ()
        {
#if __IOS__
            return new DownloadManagerImplementation (UrlSessionDownloadDelegate ?? new UrlSessionDownloadDelegate());
#elif __ANDROID__
            return new DownloadManagerImplementation();
#else
            return null;
#endif
        }

        internal static Exception NotImplementedInReferenceAssembly ()<commit_msg>Trying to get MacOS running … or at least loaded …<commit_after>﻿using System;
using Plugin.DownloadManager.Abstractions;

namespace Plugin.DownloadManager
{
    /// <summary>
    /// Cross platform DownloadManager implemenations
    /// </summary>
    public class CrossDownloadManager
    {
        static Lazy<IDownloadManager> Implementation = new Lazy<IDownloadManager> (() => CreateDownloadManager (), System.Threading.LazyThreadSafetyMode.PublicationOnly);

#if __IOS__
        /// <summary>
        /// Set the background session completion handler.
        /// @see: https://developer.xamarin.com/guides/ios/application_fundamentals/backgrounding/part_4_ios_backgrounding_walkthroughs/background_transfer_walkthrough/#Handling_Transfer_Completion
        /// </summary>
        public static Action BackgroundSessionCompletionHandler;

        /// <summary>
        /// The URL session download delegate.
        /// @see https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionDownloadDelegate_protocol/#//apple_ref/occ/intfm/NSURLSessionDownloadDelegate/URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:
        /// </summary>
        public static UrlSessionDownloadDelegate UrlSessionDownloadDelegate;
#endif

        /// <summary>
        /// The platform-implementation
        /// </summary>
        public static IDownloadManager Current {
            get {
                var ret = Implementation.Value;
                if (ret == null) {
                    throw NotImplementedInReferenceAssembly ();
                }
                return ret;
            }
        }

        static IDownloadManager CreateDownloadManager ()
        {
#if __IOS__
            return new DownloadManagerImplementation (UrlSessionDownloadDelegate ?? new UrlSessionDownloadDelegate());
#elif __ANDROID__ || __UNIFIED__
            return new DownloadManagerImplementation();
#else
            return null;
#endif
        }

        internal static Exception NotImplementedInReferenceAssembly ()
{'fraction_non_alphanumeric': 0.08779761904761904, 'fraction_numerical': 0.000496031746031746, 'mean_word_length': 2.676390154968095, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 40, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '136803', 'n_tokens_mistral': 989, 'n_tokens_neox': 960, 'n_words': 201}