<commit_before>using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using MonoGame.Extended.BitmapFonts;
using Stream = System.IO.Stream;
using Microsoft.Xna.Framework.Audio;
using XmasHell.Spriter;
using SpriterDotNet;
using SpriterDotNet.Providers;
using SpriterDotNet.MonoGame;
using SpriterDotNet.MonoGame.Content;
using System;

#if ANDROID
using Android.App;
#endif

namespace XmasHell
{
    public static class Assets
    {
        private static List<BitmapFont> _fonts;
        private static List<Texture2D> _textures;
        private static Dictionary<string, Stream> _patternSteams;
        private static List<Song> _musics;
        private static List<SoundEffect> _soundEffects;
        private static List<Effect> _effects;

        // Spriter
        private static readonly Config DefaultAnimatorConfig = new Config
        {
            MetadataEnabled = true,
            EventsEnabled = true,
            PoolingEnabled = true,
            TagsEnabled = false,
            VarsEnabled = false,
            SoundsEnabled = false
        };
        private static Dictionary<string, Dictionary<string, CustomSpriterAnimator>> _spriterAnimators;

#if ANDROID
        private static Activity _activity;

        public static void SetActivity(Activity activity)
        {
            _activity = activity;
        }
#endif

        private static string GetPatternsFolder()
        {
#if ANDROID
            return "Patterns/";
#else
            return "Assets/Patterns/";
#endif
        }

        private static Stream OpenRawFile(string path)
        {
#if ANDROID
            return _activity.ApplicationContext.Assets.Open(path);
#else
            return File.Open(path, FileMode.Open);
#endif
        }

        private static string BuildRawAssetPath(string path)
        {
            return GetPatternsFolder() + path;
        }

        private static Dictionary<string, CustomSpriterAnimator> LoadSpriterFile(ContentManager content, string filename)
        {
            var factory = new DefaultProviderFactory<ISprite, SoundEffect>(DefaultAnimatorConfig, true);

            var loader = new SpriterContentLoader(content, filename);
            loader.Fill(factory);

            var animators = new Dictionary<string, CustomSpriterAnimator>();

            foreach (var entity in loader.Spriter.Entities)
            {
                var animator = new CustomSpriterAnimator(entity, factory);

                // Center the animator
                animator.Position = XmasHell.Instance().ViewportAdapter.Center.ToVector2();

                animators.Add(entity.Name, animator);
            }

            return animators;
        }

#if ANDROID
        public static void Load(ContentManager content, GraphicsDevice graphicsDevice)
#else
        public static void Load(ContentManager content, GraphicsDevice graphicsDevice)
#endif<commit_msg>Remove useless #if ANDROID macro to load assets.<commit_after>using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using MonoGame.Extended.BitmapFonts;
using Stream = System.IO.Stream;
using Microsoft.Xna.Framework.Audio;
using XmasHell.Spriter;
using SpriterDotNet;
using SpriterDotNet.Providers;
using SpriterDotNet.MonoGame;
using SpriterDotNet.MonoGame.Content;
using System;

#if ANDROID
using Android.App;
#endif

namespace XmasHell
{
    public static class Assets
    {
        private static List<BitmapFont> _fonts;
        private static List<Texture2D> _textures;
        private static Dictionary<string, Stream> _patternSteams;
        private static List<Song> _musics;
        private static List<SoundEffect> _soundEffects;
        private static List<Effect> _effects;

        // Spriter
        private static readonly Config DefaultAnimatorConfig = new Config
        {
            MetadataEnabled = true,
            EventsEnabled = true,
            PoolingEnabled = true,
            TagsEnabled = false,
            VarsEnabled = false,
            SoundsEnabled = false
        };
        private static Dictionary<string, Dictionary<string, CustomSpriterAnimator>> _spriterAnimators;

#if ANDROID
        private static Activity _activity;

        public static void SetActivity(Activity activity)
        {
            _activity = activity;
        }
#endif

        private static string GetPatternsFolder()
        {
#if ANDROID
            return "Patterns/";
#else
            return "Assets/Patterns/";
#endif
        }

        private static Stream OpenRawFile(string path)
        {
#if ANDROID
            return _activity.ApplicationContext.Assets.Open(path);
#else
            return File.Open(path, FileMode.Open);
#endif
        }

        private static string BuildRawAssetPath(string path)
        {
            return GetPatternsFolder() + path;
        }

        private static Dictionary<string, CustomSpriterAnimator> LoadSpriterFile(ContentManager content, string filename)
        {
            var factory = new DefaultProviderFactory<ISprite, SoundEffect>(DefaultAnimatorConfig, true);

            var loader = new SpriterContentLoader(content, filename);
            loader.Fill(factory);

            var animators = new Dictionary<string, CustomSpriterAnimator>();

            foreach (var entity in loader.Spriter.Entities)
            {
                var animator = new CustomSpriterAnimator(entity, factory);

                // Center the animator
                animator.Position = XmasHell.Instance().ViewportAdapter.Center.ToVector2();

                animators.Add(entity.Name, animator);
            }

            return animators;
        }

        public static void Load(ContentManager content, GraphicsDevice graphicsDevice)
{'fraction_non_alphanumeric': 0.0723496901691509, 'fraction_numerical': 0.000669904538603249, 'mean_word_length': 2.558998808104887, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '4020823', 'n_tokens_mistral': 1564, 'n_tokens_neox': 1499, 'n_words': 401}