Ejemplo n.º 1
0
        private void Load()
        {
            if (!Directory.Exists(config.Directory))
            {
                throw new DirectoryNotFoundException(config.Directory);
            }

            foreach (var fileName in Directory.GetFiles(config.Directory))
            {
                var extension = Path.GetExtension(fileName);
                if (extension != ".ase" && extension != ".aseprite")
                {
                    continue;
                }

                var name = Path.GetFileNameWithoutExtension(fileName);
                aseprites.TryGetValue(name, out var sprite);
                if (sprite == null)
                {
                    sprite          = new Aseprite();
                    aseprites[name] = sprite;
                }

                AsepriteReader.ReadFromFile(fileName, sprite);
            }
        }