Created
March 15, 2020 22:04
-
-
Save WamWooWam/7662337c45173253dd34a588812d1d3f to your computer and use it in GitHub Desktop.
Converts from .uv-anim to .xml and back.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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