public KFreonSearchForm(Form callingForm) { myTexplorer = callingForm as Texplorer2; InitializeComponent(); this.HandleCreated += new EventHandler(Search_HandleCreated); SearchCount.Text = listBox1.Items.Count.ToString(); }
private void saveCloneToolStripMenuItem_Click(object sender, EventArgs e) { if (pcc == null || Index == -1) return; if (pcc.pccFileName != null) { string path = pcc.pccFileName; savePccFile(path); // Reload File Print("Reloading File..."); pcc = new PCCObject(path); Print("Checking for texture..."); if (path.StartsWith(Path.Combine(Properties.Settings.Default.TexplorerME3Path, "CookedPCConsole")) && pcc.Exports[pcc.Exports.Count - 1].ClassName == "Texture2D" || pcc.Exports[pcc.Exports.Count - 1].ClassName == "LightMapTexture2D" || pcc.Exports[pcc.Exports.Count - 1].ClassName == "TextureFlipBook") { Print("PCC in Game Directory. Texture Found. Adding to DB..."); int exportID = (pcc.Exports.Count - 1); Texplorer2 tp = new Texplorer2(true); tp.AddToTree(path, exportID); MessageBox.Show("Texture added to DB."); } else { Print("No Texture Found or File not in Game Directory."); } Print("Refreshing Screen..."); ListRefresh(); MessageBox.Show("Done."); } }
private bool InstallTextures(List<TPFTexInfo> textures, bool result) { // KFreon: Cancel if analysis failed if (!result) { this.Invoke(new Action(() => { EnableSecondProgressBar(false); OverallStatusLabel.Text = "Ready."; OverallProgressBar.Value = 0; })); return false; } // KFreon: Get valids only List<TPFTexInfo> validtexes = new List<TPFTexInfo>(); validtexes = new List<TPFTexInfo>(textures.Where(tex => tex.Valid)); int valids = validtexes.Count; if (valids == 0) return true; // KFreon: Setup modified DLC list List<string> modifiedDLC = new List<string>(); // Heff: Cancellation check if (cts.IsCancellationRequested) return false; OverallProg.ChangeProgressBar(0, validtexes.Count + 1); int count = 0; DebugOutput.PrintLn("Textures loaded = " + validtexes.Count); DebugOutput.PrintLn("Num valid: " + valids); // KFreon: Install textures Texplorer2 texplorer = new Texplorer2(true, WhichGame); var numInstalled = 0; foreach (TPFTexInfo tex in validtexes) { // Heff: Cancellation check if (cts.IsCancellationRequested) return false; // Heff: match against known problematic hashes, prompt the user. // (particularly textures animateed by distortion) if (DistortionHashList.Contains(tex.Hash)) { bool install = false; this.Invoke(new Action(() => { var dialogResult = MessageBox.Show("This texture is known to cause problems when resolution is higher than normal. \nDo you still want to try to install it? (Not recommended for normal users)", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); install = dialogResult == System.Windows.Forms.DialogResult.Yes ? true : false; })); if (!install) { this.Invoke(new Action(() => { Overall.UpdateText("Skipping mod: " + tex.TexName + " | " + count + "/" + valids + " mods completed."); DebugOutput.PrintLn("Skipping mod: " + tex.TexName + " | " + count++ + "/" + valids + " mods completed."); OverallProg.IncrementBar(); })); continue; } } this.Invoke(new Action(() => { Overall.UpdateText("Installing mod: " + tex.TexName + " | " + count + "/" + valids + " mods completed."); DebugOutput.PrintLn("Installing mod: " + tex.TexName + " | " + count++ + "/" + valids + " mods completed."); OverallProg.IncrementBar(); })); try { if (texplorer.InstallTexture(tex.TexName, tex.Files, tex.ExpIDs, tex.Extract(null, true))) numInstalled++; } catch (Exception e) { if (e is System.UnauthorizedAccessException) { this.Invoke(new Action(() => { MessageBox.Show("Could not install " + tex.TexName + " due to problems with the pcc file, \nplease check that the relevant .pcc files are not set as read-only, \nand try running me3explorer as admin.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); })); } else { DebugOutput.PrintLn("Unknown error with mod: " + tex.TexName + ", skipping."); DebugOutput.PrintLn("(Error: " + e.Message + ")"); } continue; } // KFreon: Add modified DLC to list if (WhichGame == 3) { foreach (string file in tex.Files) { string dlcname = KFreonLib.Misc.Methods.GetDLCNameFromPath(file); if (dlcname != "" && dlcname != null && !modifiedDLC.Contains(dlcname)) modifiedDLC.Add(dlcname); } } } // Heff: Cancellation check if (cts.IsCancellationRequested) return false; if (numInstalled > 0) { // KFreon: Update TOC's this.Invoke(new Action(() => { OverallProgressBar.Value = OverallProgressBar.Maximum - 1; OverallStatusLabel.Text = "Checking TOC.bin..."; })); Texplorer2.UpdateTOCs(WhichGame); // Heff: Cancellation check if (cts.IsCancellationRequested) return false; this.Invoke(new Action(() => { OverallStatusLabel.Text = "Installed " + numInstalled + "/" + valids + " valid mods."; OverallProgressBar.Value = OverallProgressBar.Maximum; })); } else { DebugOutput.PrintLn("All mods were skipped."); this.Invoke(new Action(() => { OverallStatusLabel.Text = "No mods installed!"; OverallProgressBar.Value = OverallProgressBar.Maximum; })); } return true; }
private void texplorerToolStripMenuItem_Click_1(object sender, EventArgs e) { Texplorer2 texplorer = new Texplorer2(); texplorer.Show(); }
private bool InstallTextures(List<TPFTexInfo> textures, bool result) { // KFreon: Cancel if analysis failed if (!result) { this.Invoke(new Action(() => { EnableSecondProgressBar(false); OverallStatusLabel.Text = "Ready."; OverallProgressBar.Value = 0; })); return false; } // KFreon: Get valids only List<TPFTexInfo> validtexes = new List<TPFTexInfo>(); validtexes = new List<TPFTexInfo>(textures.Where(tex => tex.Valid)); int valids = validtexes.Count; if (valids == 0) return true; // KFreon: Setup modified DLC list List<string> modifiedDLC = new List<string>(); OverallProg.ChangeProgressBar(0, validtexes.Count + 1); int count = 1; DebugOutput.PrintLn("Textures loaded = " + validtexes.Count); DebugOutput.PrintLn("Num valid: " + valids); // KFreon: Install textures Texplorer2 texplorer = new Texplorer2(true, WhichGame); foreach (TPFTexInfo tex in validtexes) { Overall.UpdateText("Installing mod: " + tex.TexName + " | " + count + "/" + valids + " mods completed."); DebugOutput.PrintLn("Installing mod: " + tex.TexName + " | " + count++ + "/" + valids + " mods completed."); OverallProg.IncrementBar(); texplorer.InstallTexture(tex.TexName, tex.Files, tex.ExpIDs, tex.Extract(null, true)); // KFreon: Add modified DLC to list if (WhichGame == 3) { foreach (string file in tex.Files) { string dlcname = KFreonLib.Misc.Methods.GetDLCNameFromPath(file); if (dlcname != "" && dlcname != null && !modifiedDLC.Contains(dlcname)) modifiedDLC.Add(dlcname); } } // KFreon: Check cancellation if (cts.IsCancellationRequested) return false; } // KFreon: Update TOC's this.Invoke(new Action(() => { OverallProgressBar.Value = OverallProgressBar.Maximum - 1; OverallStatusLabel.Text = "Checking TOC.bin..."; })); DebugOutput.PrintLn("Updating Basegame..."); Texplorer2.UpdateTOCs(pathBIOGame, WhichGame, DLCPath, modifiedDLC); this.Invoke(new Action(() => { OverallStatusLabel.Text = "All mods installed!"; OverallProgressBar.Value = OverallProgressBar.Maximum; })); return true; }
private void texplorerToolStripMenuItem_Click_1(object sender, EventArgs e) { Texplorer2 texplorer = new Texplorer2(); //OpenMaximized(texplorer); texplorer.Show(); taskbar.AddTool(texplorer, Properties.Resources.texplorer_64x64, true); }