private static void RunUnpack(ProgramArgs args, BaseProfile profile) { var database = new Database(new DatabaseOptions(profile.GetGame(), profile.GetDatabaseType())); var files = profile.LoadFiles(database, args.InputDirectory); database.CompleteLoad(); var stopwatch = Stopwatch.StartNew(); var serializer = new DatabaseSerializer(database, args.OutputDirectory); serializer.Serialize(files); stopwatch.Stop(); Console.WriteLine("Exported database to {2} in {0}ms ({1:f2}s)", stopwatch.ElapsedMilliseconds, stopwatch.ElapsedMilliseconds / 1000f, args.OutputDirectory); }
private static int RunUnpack(UnpackOptions args) { if (!Directory.Exists(args.InputDirectory)) { throw new Exception($"Non-existent input directory: {args.InputDirectory}"); } if (!Directory.Exists(args.OutputDirectory)) { Directory.CreateDirectory(args.OutputDirectory); } var profile = ResolveProfile(args.ProfileName); if (profile == null) { Console.WriteLine("ERROR: Unknown profile {0}", args.ProfileName); Console.WriteLine("AVAILABLE PROFILES:"); foreach (var baseProfile in Profiles) { Console.WriteLine("\tNAME: {0}", baseProfile.GetName()); } return(1); } var database = new Database(new DatabaseOptions(profile.GetGame(), profile.GetDatabaseType())); var files = profile.LoadFiles(database, args.InputDirectory); database.CompleteLoad(); var stopwatch = Stopwatch.StartNew(); var serializer = new DatabaseSerializer(database, args.OutputDirectory); serializer.Serialize(files); stopwatch.Stop(); Console.WriteLine("Exported database to {2} in {0}ms ({1:f2}s)", stopwatch.ElapsedMilliseconds, stopwatch.ElapsedMilliseconds / 1000f, args.OutputDirectory); return(0); }