Skip to content

Instantly share code, notes, and snippets.

@WamWooWam
Created March 15, 2020 22:04
Show Gist options
  • Save WamWooWam/7662337c45173253dd34a588812d1d3f to your computer and use it in GitHub Desktop.
Save WamWooWam/7662337c45173253dd34a588812d1d3f to your computer and use it in GitHub Desktop.
Converts from .uv-anim to .xml and back.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HedgeLib.Animations;
namespace Anim2Xml
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine();
Console.WriteLine(" -- .uv-anim > .xml --");
Console.WriteLine(" Usage:");
Console.WriteLine(" ./anim2xml.exe input [output]");
Console.WriteLine();
}
else
{
var input = args.ElementAt(0);
var inputExt = Path.GetExtension(input).ToLowerInvariant();
var output = args.ElementAtOrDefault(1) ?? (inputExt == ".xml" ? Path.ChangeExtension(input, "uv-anim") : Path.ChangeExtension(input, "xml"));
if (File.Exists(output))
{
while (true)
{
Console.WriteLine();
Console.Write($"Output file already exists, overwrite? (Y/N): ");
var key = Console.ReadKey();
if (key.KeyChar == 'y')
{
File.Delete(output);
break;
}
else if (key.KeyChar == 'n')
{
return;
}
}
}
var anim = new UVAnimation();
if (inputExt == ".uv-anim")
{
anim.Load(input);
anim.ExportXML(output);
}
else
{
anim = (UVAnimation)GensAnimation.ImportXML(input);
anim.Save(output);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment