private async void PackBSA(string path, List <Asset> assetList) { string formText = this.Text; this.Text = "Packing..."; this.IsPackingCurrently = true; menuStripMain.Enabled = false; bool compress = bool.Parse(SettingsIni.Data["Archive"]["CompressAssets"]); bool usePS3FileFlags = bool.Parse(SettingsIni.Data["Archive"]["UsePS3FileFlags"]); bool extendDDS = bool.Parse(SettingsIni.Data["DDS"]["ExtendData"]); bool convertNormalMaps = bool.Parse(SettingsIni.Data["DDS"]["ConvertNormalMaps"]); await Task.Run(() => BSA.Write(path, assetList, compress, usePS3FileFlags, extendDDS, convertNormalMaps)); this.IsArchiveSaved = true; this.IsPackingCurrently = false; menuStripMain.Enabled = true; this.Text = formText; MessageBox.Show("Done!", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
static void Main(string[] args) { // If there are no arguments passed then it acts as if help command is ran if (args.Count() == 0) { Program.ShowHelpText(); return; } switch (args[0].ToLower()) { default: { if (args.Count() == 1 && Directory.Exists(args[0])) { // If a single existing folder is inputted, the tool will autopack that // The following codes sets up that process string inputDir = args[0]; args = new string[6]; args[0] = string.Empty; // Can equal blank string value args[1] = "-useps3settings"; args[2] = "-i"; args[3] = inputDir; args[4] = "-o"; args[5] = Path.GetDirectoryName(inputDir) + "\\output.bsa"; goto case "-p"; } Program.ShowHelpText(true); break; } case "-h": case "-help": { Program.ShowHelpText(); break; } case "-p": case "-pack": { string inputDir = string.Empty; string outputPath = string.Empty; bool compress = false; bool usePS3FileFlags = false; bool extendDDS = false; bool convertNormalMaps = false; for (uint i = 1; i < args.Count(); i++) { string option = args[i].ToLower(); switch (option) { default: { Program.ShowHelpText(true); return; } case "-compress": { compress = true; break; } case "-useps3fileflags": { usePS3FileFlags = true; break; } case "-extenddds": { extendDDS = true; break; } case "-convertnormals": { convertNormalMaps = true; break; } case "-useps3settings": { usePS3FileFlags = true; extendDDS = true; convertNormalMaps = true; break; } case "-i": case "-indir": { i++; inputDir = args[i]; break; } case "-o": case "-out": { i++; outputPath = args[i]; break; } } } if (string.IsNullOrEmpty(inputDir) || string.IsNullOrEmpty(outputPath)) { Program.ShowHelpText(true); return; } Console.WriteLine("Reading and verifying files..."); var assetList = new List <Asset>(); foreach (string file in Directory.GetFiles(inputDir, "*", SearchOption.AllDirectories)) { var assetFile = new Asset(file.Substring(inputDir.Length + 1), file); assetList.Add(assetFile); } Console.WriteLine("Packing..."); BSA.Write(outputPath, assetList, compress, usePS3FileFlags, extendDDS, convertNormalMaps); Console.WriteLine("\nDone!\n"); break; } } }