private void extract_button_Click(object sender, EventArgs e)
        {
            isRecursive  = recursive_radio_.Checked;
            isOverrideOn = override_tags_.Checked;
            isOutDBOn    = output_db_.Checked;

            DestinationFolder = textBox1.Text;
            MapsFolder        = MainBox.map_path;

            string mapName   = DATA_READ.Read_File_from_file_location(MainBox.map_name);
            int    TotalTags = TagsList.Count;

            curent_tag_status.Visible = true;


            if (DestinationFolder == "")
            {
                curent_tag_status.Text = "Select a Destination Folder Please";
                return;
            }

            if (MapsFolder == "")
            {
                curent_tag_status.Text = "Select a Maps Folder Please";
                return;
            }



            curent_tag_status.Text = "Initializing Decompiler";


            MainBox.CloseMap();
            progressBar1.Value   = 0;
            progressBar1.Maximum = TotalTags;
            int index = 0;

            foreach (int i in TagsList.Keys)
            {
                tag_count_stats.Text   = "[" + index + "/" + TotalTags + "]";
                curent_tag_status.Text = "Extracting Objects : " + TagsList.Values.ElementAt(index);
                MainBox.H2Test.Halo2_ExtractTagCache(i, isRecursive, isOutDBOn, isOverrideOn, DestinationFolder, MapsFolder, mapName);
                progressBar1.Value++;     //update the progress bar
                index++;
            }

            if (MessageBox.Show("Extraction Done!", "Progress", MessageBoxButtons.OK) == DialogResult.OK)
            {
                MainBox.ReOpenMap();
            }
        }
Exemplo n.º 2
0
        private void extract_button_Click(object sender, EventArgs e)
        {
            isRecursive  = recursive_radio_.Checked;
            isOverrideOn = override_tags_.Checked;
            isOutDBOn    = output_db_.Checked;


            DestinationFolder = textBox3.Text;


            string mapName   = DATA_READ.Read_File_from_file_location(MainBox.map_name);
            int    TotalTags = AddList.Count;

            current_tag_status.Visible = true;


            if (DestinationFolder == "")
            {
                current_tag_status.Text = "Select a Destination Folder Please";
                return;
            }



            current_tag_status.Text = "Initializing Decompiler";


            MainBox.CloseMap();
            progressBar1.Value   = 0;
            progressBar1.Maximum = ExtractList.Count;
            int index = 0;

            foreach (int i in ExtractList.Keys)
            {
                current_tag_status.Text = "Extracting Objects : " + ExtractList.Values.ElementAt(index);
                MainBox.H2Test.Halo2_ExtractTagCache(i, isRecursive, isOutDBOn, isOverrideOn, DestinationFolder, H2V_BaseMapsDirectory + "\\", mapName);
                progressBar1.Value++; //update the progress bar
                index++;
            }

            current_tag_status.Text = "Extraction Complete!";
            if (MessageBox.Show("Extraction Done!", "Progress", MessageBoxButtons.OK) == DialogResult.OK)
            {
                MainBox.ReOpenMap();
            }
            clear_button.Enabled   = false;
            extract_button.Enabled = false;
            ExtractList.Clear();
            richTextBox1.Text = "";
        }
Exemplo n.º 3
0
        //Tag extraction stuff
        private void extractTagToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (map_loaded)
            {
                if (treeView1.SelectedNode != null)
                {
                    //Extraction for a single tag
                    if (treeView1.SelectedNode.Name.CompareTo(treeView1.SelectedNode.Text) != 0)
                    {
                        int tag_table_ref = Int32.Parse(treeView1.SelectedNode.Name);
                        int datum_index   = DATA_READ.ReadINT_LE(tag_table_ref + 4, map_stream);

                        map_stream.Close();
                        obj.Halo2_ExtractTagCache(datum_index, DATA_READ.Read_File_from_file_location(map_name));
                        map_stream = new StreamReader(map_name);
                    }
                    else
                    {
                        //Extraction for a whole same bunch of tags
                        List <int> DatumsList = new List <int>();
                        foreach (TreeNode tn in treeView1.SelectedNode.Nodes)
                        {
                            int tag_table_ref = Int32.Parse(tn.Name);
                            int datum_index   = DATA_READ.ReadINT_LE(tag_table_ref + 4, map_stream);
                            DatumsList.Add(datum_index);
                        }

                        map_stream.Close();

                        int index = 1;

                        foreach (int i in DatumsList)
                        {
                            obj.Halo2_ExtractTagCache(i, DATA_READ.Read_File_from_file_location(map_name));

                            progressBar1.Value = (index++) * 100 / DatumsList.Count;//update the progress bar
                        }

                        map_stream = new StreamReader(map_name);
                    }
                }
            }
            progressBar1.Value = 0;//reset the progress bar
        }
Exemplo n.º 4
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            //i used timer instead of a loop because of the fancy progress bar(IT looks COOL)

            if (index < datum_list.Count)
            {
                obj.Halo2_ExtractTagCache(datum_list[index], DATA_READ.Read_File_from_file_location(map_name));
                progressBar1.Value = (index + 1) * 100 / datum_list.Count;    //update the progress bar

                //we have to increment the index
                index++;
            }
            else
            {
                progressBar1.Value = 0;                          //reset the progres bar
                map_stream         = new StreamReader(map_name); //lets load the map
                map_loaded         = true;                       //well now u are now free
                index          = 0;                              //reset the index
                timer2.Enabled = false;
            }
        }
Exemplo n.º 5
0
        private void Extract_Click(object sender, EventArgs e)
        {
            string log = "\nEXTRACTION LOG : ";//or log

            string rel_path = SID_list[extraction_list[0].datum_index] + "." + extraction_list[0].type;

            XmlTextWriter xw = new XmlTextWriter(textBox1.Text + "\\" + DATA_READ.Read_File_from_file_location(rel_path) + ".xml", Encoding.UTF8);

            xw.Formatting = Formatting.Indented;
            xw.WriteStartElement("config");

            if (textBox1.Text.Length > 0)
            {
                for (int i = 0; i < extraction_list.Count; i++)
                {
                    tagRef temp_tagref = extraction_list[i];

                    int    datum = temp_tagref.datum_index;
                    string type  = temp_tagref.type;

                    if (datum != -1)
                    {
                        if (!extracted_list.Contains(datum))
                        {
                            if (File.Exists(Application.StartupPath + "\\plugins\\" + type + ".xml"))
                            {
                                if (SID_list.ContainsKey(datum))
                                {
                                    meta obj = new meta(datum, SID_list[datum], map_stream);
                                    obj.Rebase_meta(0x0);

                                    if (checkBox1.Checked)
                                    {
                                        obj.Null_StringID();
                                    }

                                    if (radioButton1.Checked == true)
                                    {
                                        //add recursivity
                                        extraction_list.AddRange(obj.Get_all_tag_refs());
                                    }

                                    byte[] data = obj.Generate_meta_file();

                                    string path      = textBox1.Text + "\\" + obj.Get_Path() + "." + obj.Get_Type();
                                    string directory = DATA_READ.ReadDirectory_from_file_location(path);

                                    //lets create our directory
                                    System.IO.Directory.CreateDirectory(directory);
                                    //create our file
                                    StreamWriter sw = new StreamWriter(path);
                                    sw.BaseStream.Write(data, 0, obj.Get_Total_size());
                                    sw.Dispose();

                                    //write to configuration xml
                                    xw.WriteStartElement("tag");
                                    xw.WriteStartElement("name");
                                    xw.WriteString(obj.Get_Path() + "." + type); //writing in the inner most level ie,name
                                    xw.WriteEndElement();                        //name level
                                    xw.WriteStartElement("datum");
                                    xw.WriteString(datum.ToString("X"));         //writing in the inner most level ie here,datum
                                    xw.WriteEndElement();                        //datum level
                                    xw.WriteEndElement();                        //tag level

                                    //at least mention this in the logs
                                    log += "\nExtracted meta " + datum.ToString("X") + " to " + path;

                                    //add it to the extracted list
                                    extracted_list.Add(datum);
                                }
                                else
                                {
                                    log += "\nCouldnot find stringID to datum_index " + datum.ToString("X");
                                }
                            }
                            else
                            {
                                log += "\nPlugin " + type + ".xml doesnt exist";
                                extracted_list.Add(datum);
                            }
                        }
                    }
                }
                //close the config field and close the xml handle
                xw.WriteEndElement();
                xw.Dispose();

                //Log box
                LogBox lb = new LogBox(log);
                lb.Show();

                //wprk is now done so lets close this stupid box
                this.Close();
            }
            else
            {
                MessageBox.Show("At least Select the Directory", "Error");
            }
        }