public static void Init(string rootFolder) { RootFolder = rootFolder; GameMasterTimestampUtils.Init(GAME_MASTER_Folder); }
static void Main(string[] args) { try { if (args.Count() < 1 || args[0].Contains("?")) { WriteHelp(); return; } int decoded = 0; for (int arg = 0; arg < args.Length; arg++) { bool createOnly = string.Equals(args[arg], "-c") || string.Equals(args[arg], "-create"); if (createOnly) { arg++; if (arg >= args.Length) { break; } } string folder; string filePattern; int pos = args[arg].LastIndexOf('\\'); if (pos == -1) { folder = "."; filePattern = args[arg]; } else { folder = args[arg].Substring(0, pos); filePattern = args[arg].Substring(pos + 1); } if (!Directory.Exists(folder)) { ConsoleOutput.OutputError("ERROR: Folder does not exist: \"{0}\"", folder); continue; } GameMasterTimestampUtils.Init(folder); foreach (var filePath in Directory.EnumerateFiles(folder, filePattern)) #if true { if (Path.GetExtension(filePath).Length == 0 && (!createOnly || !File.Exists(filePath + ".json"))) { Console.Out.WriteLine("Decoding \"" + filePath + "\""); GameMasterDecoder.WriteGameMasterJson(filePath); decoded++; } } #else { // This code is to reset the timestamps of the files try { GameMasterTimestampUtils.FixGameMasterFileTime(filePath); } catch (Exception) { } } #endif } ConsoleOutput.OutputSuccess($"Finished. {decoded} files decoded."); } catch (Exception ex) { ConsoleOutput.OutputException(ex, "********** ERROR!!! **********"); } }