Tool dedicated to isohacking for Xenosaga on Playstation 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB

using System;
using System.IO;
namespace Hack.Xenosaga.Common
{
public class Functions
{
public static void usage()
{
Console.WriteLine("xenosaga <option> <file> [regroup]");
Console.WriteLine(" option : -l = List files from index");
Console.WriteLine(" -u = Unpack files from index");
Console.WriteLine(" -p = Pack files from index");
Console.WriteLine(" file : Index file (the first one of each decade : xenosaga.00, xenosaga.10, xenosaga.20...)");
Console.WriteLine(" regroup : true to regroup all files in only one (ex: 11, 12, 13 in 11) ; false or empty (default) to keep the same system of increment files");
}
public static bool checkArgs(string[] args, out Variables.stArgs listArgs)
{
listArgs = new Variables.stArgs();
if (args.Length != 2 && args.Length != 3)
{
Console.WriteLine("Incorrect number of parameter!");
return false;
}
if (args[0] != "-l" && args[0] != "-p" && args[0] != "-u")
{
Console.WriteLine("Incorrect parameter 1!");
return false;
}
if (!File.Exists(args[1]))
{
Console.WriteLine("Incorrect parameter 2 : unknown file");
return false;
}
if (args.Length == 3 && (args[2] != "true" && args[2] != "false"))
{
Console.WriteLine("Incorrect parameter 3!");
return false;
}
listArgs.option = args[0];
listArgs.filename = args[1];
if (args.Length == 3)
listArgs.regroup = args[2] == "true" ? true : false;
return true;
}
}
}