<commit_before>﻿using System;
using System.Runtime.InteropServices;

namespace NFluidsynth.Native
{
    internal static partial class LibFluidsynth
    {
        public const string LibraryName = "fluidsynth";

        public const int FluidOk = 0;
        public const int FluidFailed = -1;

#if NETCOREAPP
        static LibFluidsynth()
        {
            NativeLibrary.SetDllImportResolver(typeof(LibFluidsynth).Assembly, (name, assembly, path) =>
            {
                if (name == LibraryName)
                {
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                    {
                        return NativeLibrary.Load("libfluidsynth.so");
                    }

                    if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                    {
                        return NativeLibrary.Load("libfluidsynth.dylib");
                    }
                }

                return IntPtr.Zero;
            });
        }
#endif
    }<commit_msg>Try libfluidsynth.so.2 for Ubuntu 20.04<commit_after>﻿using System;
using System.Runtime.InteropServices;

namespace NFluidsynth.Native
{
    internal static partial class LibFluidsynth
    {
        public const string LibraryName = "fluidsynth";

        public const int FluidOk = 0;
        public const int FluidFailed = -1;

#if NETCOREAPP
        static LibFluidsynth()
        {
            NativeLibrary.SetDllImportResolver(typeof(LibFluidsynth).Assembly, (name, assembly, path) =>
            {
                if (name == LibraryName)
                {
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                    {
                        // Assumption here is that this binds against whatever API .2 is,
                        //  but will try the general name anyway just in case.
                        try
                        {
                            return NativeLibrary.Load("libfluidsynth.so.2");
                        }
                        catch (Exception ex)
                        {
                        }
                        return NativeLibrary.Load("libfluidsynth.so");
                    }

                    if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                    {
                        return NativeLibrary.Load("libfluidsynth.dylib");
                    }
                }

                return IntPtr.Zero;
            });
        }
#endif
    }
{'fraction_non_alphanumeric': 0.07509083568833266, 'fraction_numerical': 0.0044408558740411785, 'mean_word_length': 1.2588878760255242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2537134', 'n_tokens_mistral': 646, 'n_tokens_neox': 585, 'n_words': 127}