using Newtonsoft.Json;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Cryville.Crtr.Browsing {
	public class SkinResourceImporter : ResourceConverter {
		static readonly string[] SUPPORTED_FORMATS = { ".umgs" };
		public override string[] GetSupportedFormats() {
			return SUPPORTED_FORMATS;
		}

		public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
			using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
				var data = JsonConvert.DeserializeObject<Skin>(reader.ReadToEnd());
				return new Resource[] { new SkinResource(data.name, file) };
			}
		}
	}
}
