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

8 years ago
  1. using System;
  2. using System.IO;
  3. namespace Hack.Xenosaga.Common
  4. {
  5. public class Functions
  6. {
  7. public static void usage()
  8. {
  9. Console.WriteLine("xenosaga <option> <file> [regroup]");
  10. Console.WriteLine(" option : -l = List files from index");
  11. Console.WriteLine(" -u = Unpack files from index");
  12. Console.WriteLine(" -p = Pack files from index");
  13. Console.WriteLine(" file : Index file (the first one of each decade : xenosaga.00, xenosaga.10, xenosaga.20...)");
  14. 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");
  15. }
  16. public static bool checkArgs(string[] args, out Variables.stArgs listArgs)
  17. {
  18. listArgs = new Variables.stArgs();
  19. if (args.Length != 2 && args.Length != 3)
  20. {
  21. Console.WriteLine("Incorrect number of parameter!");
  22. return false;
  23. }
  24. if (args[0] != "-l" && args[0] != "-p" && args[0] != "-u")
  25. {
  26. Console.WriteLine("Incorrect parameter 1!");
  27. return false;
  28. }
  29. if (!File.Exists(args[1]))
  30. {
  31. Console.WriteLine("Incorrect parameter 2 : unknown file");
  32. return false;
  33. }
  34. if (args.Length == 3 && (args[2] != "true" && args[2] != "false"))
  35. {
  36. Console.WriteLine("Incorrect parameter 3!");
  37. return false;
  38. }
  39. listArgs.option = args[0];
  40. listArgs.filename = args[1];
  41. if (args.Length == 3)
  42. listArgs.regroup = args[2] == "true" ? true : false;
  43. return true;
  44. }
  45. }
  46. }