コード例 #1
0
        private void executeAllJobsForAllFilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Mod mod in ModManager.modlist)
            {
                string name   = mod._filename;
                string inname = mod._infilename;
                if (!Helper.FindExeLocation())
                {
                    return;
                }

                if (!File.Exists(Helper.pathgame + name))
                {
                    Helper.Log("File \"" + name + "\" not found!");
                    return;
                }
                HOGPFile hogp = new HOGPFile(Helper.pathgame + name);
                for (int i = 0; i < hogp.filelist.Count; i++)
                {
                    HOGPFile.FileEntry en = hogp.filelist[i];
                    if (en.name == inname)
                    {
                        hogp.ImportFile(i, mod._data);
                    }
                }
            }
            MessageBox.Show("Done.");
            return;
        }
コード例 #2
0
 static void RunModJobs(string filename)
 {
     ModManager.modlist = new List <Mod>(Mod.LoadModFile(filename));
     foreach (Mod mod in ModManager.modlist)
     {
         string name   = mod._filename;
         string inname = mod._infilename;
         if (!Helper.FindExeLocation())
         {
             return;
         }
         if (!File.Exists(Helper.pathgame + name))
         {
             return;
         }
         HOGPFile hogp = new HOGPFile(Helper.pathgame + name, true);
         for (int i = 0; i < hogp.filelist.Count; i++)
         {
             if (hogp.filelist[i].name == inname)
             {
                 hogp.ImportFile(i, mod._data);
             }
         }
     }
 }
コード例 #3
0
        private void rebuildBinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                rtb1.Text = "";
                try
                {
                    file        = new HOGPFile(d.FileName);
                    pb1.Value   = 0;
                    pb1.Maximum = file.filelist.Count;
                    FileStream fs  = new FileStream(d.FileName, FileMode.Open, FileAccess.Read);
                    FileStream fs2 = new FileStream(d.FileName + ".tmp", FileMode.Create, FileAccess.Write);
                    fs2.Write(new byte[] { 0x48, 0x4F, 0x47, 0x50, 0x3, 0, 0, 0 }, 0, 8);
                    fs2.Write(new byte[8], 0, 8);
                    long datacount   = 0;
                    uint memBlockPos = 0;
                    for (int i = 0; i < file.filelist.Count; i++)
                    {
                        HOGPFile.FileEntry en = file.filelist[i];
                        pb1.Value   = i;
                        status.Text = en.name;
                        Application.DoEvents();
                        if ((long)en.offset == -1)
                        {
                            continue;
                        }
                        Helper.StreamCopy(fs, fs2, (long)en.offset, (int)en.sizeComp);
                        en.offset        = (ulong)datacount + 16;
                        en.blockMapStart = memBlockPos;
                        memBlockPos     += (uint)en.blockSizes.Count;
                        datacount       += en.sizeComp;
                        file.filelist[i] = en;
                    }
                    fs2.Seek(8, 0);
                    fs2.Write(BitConverter.GetBytes(datacount), 0, 8);
                    fs2.Seek(0, SeekOrigin.End);
                    file.WriteTOC(fs2);
                    fs2.Close();
                    fs.Close();
                    File.Delete(d.FileName);
                    File.Move(d.FileName + ".tmp", d.FileName);
                    status.Text = "";
                    pb1.Value   = 0;
                    MessageBox.Show("Done.");
                }
                catch (Exception ex)
                {
                    Helper.Log("Error: " + ex.Message);
                }
            }
        }
コード例 #4
0
        private void executeSelectedJobToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;
            int m = listBox2.SelectedIndex;

            if (n == -1 || m == -1)
            {
                return;
            }
            string name   = listBox1.Items[n].ToString();
            string inname = listBox2.Items[m].ToString();

            foreach (Mod mod in ModManager.modlist)
            {
                if (mod._filename == name && mod._infilename == inname)
                {
                    if (!Helper.FindExeLocation())
                    {
                        return;
                    }
                    if (!File.Exists(Helper.pathgame + name))
                    {
                        Helper.Log("File \"" + name + "\" not found!");
                        return;
                    }
                    HOGPFile hogp = new HOGPFile(Helper.pathgame + name);
                    for (int i = 0; i < hogp.filelist.Count; i++)
                    {
                        HOGPFile.FileEntry en = hogp.filelist[i];
                        if (en.name == inname)
                        {
                            hogp.ImportFile(i, mod._data);
                            MessageBox.Show("Done.");
                            return;
                        }
                    }
                }
            }
        }
コード例 #5
0
        private void openBinToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                rtb1.Text = "";
                try
                {
                    file = new HOGPFile(d.FileName);
                    listBox1.Items.Clear();
                    int count = 0;
                    foreach (HOGPFile.FileEntry en in file.filelist)
                    {
                        listBox1.Items.Add((count++).ToString("X8") + " : " + en.name + "(" + en.sizeComp.ToString("X") + "h bytes)");
                    }
                }
                catch (Exception ex)
                {
                    Helper.Log("Error: " + ex.Message);
                }
            }
        }