<commit_before>﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Content;

namespace ThreeSheeps.Spritesse.Content
{
    /// <summary>
    /// Defines a single animation frame in a sequence
    /// </summary>
    public struct AnimationFrame
    {
        /// <summary>
        /// Index of a sprite in the sprite sheet
        /// </summary>
        public ushort SpriteIndex;

        /// <summary>
        /// Delay in milliseconds
        /// </summary>
        public ushort Delay;
    }

    /// <summary>
    /// Defines an animation sequence consisting of 1+ frames
    /// </summary>
    public sealed class AnimationSequence
    {
        internal AnimationSequence(string name, bool looped, AnimationFrame[] frames)
        {
            this.Name = name;
            this.Looped = looped;
            this.Frames = frames;
        }

        /// <summary>
        /// A name to identify this animation
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// Whether the animation will start again when the end is reached
        /// </summary>
        public bool Looped { get; private set; }

        /// <summary>
        /// Frames defined in the animation sequence
        /// </summary>
        public AnimationFrame[] Frames { get; private set; }
    }

    /// <summary>
    /// Defines an animation set (1+ animations) over a sprite sheet.
    /// </summary>
    public sealed class AnimationSet : List<AnimationSequence>
    {
        /// <summary>
        /// Retrieve a specific animation sequence
        /// </summary>
        /// <param name="name"></param>
        /// <returns>Animation sequence instance</returns>
        public AnimationSequence this[string name]
        {
            get
            {
                foreach (AnimationSequence a in this)
                {
                    if (a.Name == name)
                    {
                        return a;
                    }
                }
                throw new IndexOutOfRangeException("name");
            }
        }
    }

    /// <summary>
    /// Loader class for the animation set content type.
    /// </summary>
    public sealed class AnimationSetReader : ContentTypeReader<AnimationSet>
    {
        protected override AnimationSet Read(ContentReader input, AnimationSet existingInstance)
        {
            string spriteSheetName = input.ReadString();
            int animationCount = input.ReadInt32();
            AnimationSet animations = new AnimationSet();
            for (int animIndex = 0; animIndex < animationCount; ++animIndex)
            {
                string name = input.ReadString();
                bool looped = input.ReadBoolean();
                int frameCount = input.ReadInt32();
                AnimationFrame[] frames = new AnimationFrame[frameCount];
                for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex)
                {
                    frames[frameIndex].SpriteIndex = input.ReadUInt16();
                    frames[frameIndex].Delay = input.ReadUInt16();
                }
                animations.Add(new AnimationSequence(name, looped, frames));
            }
            return animations;
        }
    }
}<commit_msg>animations: remove sprite sheet reference<commit_after>﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Content;

namespace ThreeSheeps.Spritesse.Content
{
    /// <summary>
    /// Defines a single animation frame in a sequence
    /// </summary>
    public struct AnimationFrame
    {
        /// <summary>
        /// Index of a sprite in the sprite sheet
        /// </summary>
        public ushort SpriteIndex;

        /// <summary>
        /// Delay in milliseconds
        /// </summary>
        public ushort Delay;
    }

    /// <summary>
    /// Defines an animation sequence consisting of 1+ frames
    /// </summary>
    public sealed class AnimationSequence
    {
        internal AnimationSequence(string name, bool looped, AnimationFrame[] frames)
        {
            this.Name = name;
            this.Looped = looped;
            this.Frames = frames;
        }

        /// <summary>
        /// A name to identify this animation
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// Whether the animation will start again when the end is reached
        /// </summary>
        public bool Looped { get; private set; }

        /// <summary>
        /// Frames defined in the animation sequence
        /// </summary>
        public AnimationFrame[] Frames { get; private set; }
    }

    /// <summary>
    /// Defines an animation set (1+ animations) over a sprite sheet.
    /// </summary>
    public sealed class AnimationSet : List<AnimationSequence>
    {
        /// <summary>
        /// Retrieve a specific animation sequence
        /// </summary>
        /// <param name="name"></param>
        /// <returns>Animation sequence instance</returns>
        public AnimationSequence this[string name]
        {
            get
            {
                foreach (AnimationSequence a in this)
                {
                    if (a.Name == name)
                    {
                        return a;
                    }
                }
                throw new IndexOutOfRangeException("name");
            }
        }
    }

    /// <summary>
    /// Loader class for the animation set content type.
    /// </summary>
    public sealed class AnimationSetReader : ContentTypeReader<AnimationSet>
    {
        protected override AnimationSet Read(ContentReader input, AnimationSet existingInstance)
        {
            int animationCount = input.ReadInt32();
            AnimationSet animations = new AnimationSet();
            for (int animIndex = 0; animIndex < animationCount; ++animIndex)
            {
                string name = input.ReadString();
                bool looped = input.ReadBoolean();
                int frameCount = input.ReadInt32();
                AnimationFrame[] frames = new AnimationFrame[frameCount];
                for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex)
                {
                    frames[frameIndex].SpriteIndex = input.ReadUInt16();
                    frames[frameIndex].Delay = input.ReadUInt16();
                }
                animations.Add(new AnimationSequence(name, looped, frames));
            }
            return animations;
        }
    }
}
{'fraction_non_alphanumeric': 0.1020003053901359, 'fraction_numerical': 0.0036646816307833257, 'mean_word_length': 1.5446775446775447, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 55, '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': '7548761', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1525, 'n_words': 465}