private void button2_Click(object sender, EventArgs e) { if (mod_path == null || !Directory.Exists(mod_path)) //stop if no folder selected return; toolStripProgressBar1.Value = 0; progress = 0; RawPool pool = new RawPool(); pool.ReadPoolData(); pool.ReadFree(); pool.ReadRawfiles(); for (int i = 0; i < pool.rawfiles.Count - 1; i++) { pool.rawfiles[i].name = PS3.ReadCString(pool.rawfiles[i].name_ptr); richTextBox1.Text += "[ 0x" + pool.rawfiles[i].index.ToString("X") + " ] Found: " + pool.rawfiles[i].name + "\n"; toolStripProgressBar1.Value = (int)((double)((double)progress / (double)pool.rawfiles.Count) * RawPool.PoolMax); progress++; Goto(richTextBox1, progress); } //read local files. string output = pool.ReadLocalFiles(mod_path); richTextBox1.Text += output; Goto(richTextBox1, richTextBox1.Lines.Count() - 1); //start injecting.. for (int i = 0; i < pool.rawfiles.Count; i++) { if (!pool.rawfiles[i].requireOverwrite) continue; pool.writeRawfile(pool.rawfiles[i]); } //update the freehead. //pool.updateFreeHead(); }
private void button3_Click(object sender, EventArgs e) { FolderBrowserDialog fb = new FolderBrowserDialog(); if (fb.ShowDialog() == DialogResult.OK) { RawPool pool = new RawPool(); pool.ReadPoolData(); pool.ReadFree(); pool.ReadRawfiles(); for (int i = 0; i < pool.rawfiles.Count - 1; i++) { string name = PS3.ReadCString(pool.rawfiles[i].name_ptr); byte[] buffer = PS3.GetMemory(pool.rawfiles[i].buffer_ptr, (int)pool.rawfiles[i].length); if (name.Contains("/")) { name = name.Replace("/", @"\"); String[] lel = name.Replace(@"\", "|").Split('|'); String directory = fb.SelectedPath + @"\" + name.Replace(lel[lel.Length - 1], ""); if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); } String path = name.Replace("//", @"\").Replace("/", @"\"); File.WriteAllBytes(fb.SelectedPath + @"\" + path, buffer); } } }