Esempio n. 1
0
 private void WMSETmod_listbox()
 {
     Wmset wmset = new Wmset(_lastKnownPath.Substring(0,_lastKnownPath.Length-3) + "Section16");
     int selectedModel = Convert.ToInt32(listBox1.Items[listBox1.SelectedIndex]);
     wmset.Sector16(selectedModel, listBox1.SelectedIndex);
     Bitmap bmp = wmset.GetTexture();
     pictureBox1.Image = bmp;
     Render3D();
 }
Esempio n. 2
0
 private void openToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog { Filter = "wmsetxx.obj|wmset*.obj" };
     if (ofd.ShowDialog() != DialogResult.OK) return;
     if (Path.GetFileNameWithoutExtension(ofd.FileName) == "wmset")
     {
         Console.WriteLine("WMSET: Please use your language version of wmset instead of selected file!");
         return;
     }
     _lastKnownPath = ofd.FileName;
     repackToolStripMenuItem.Enabled = true;
     openUnpackedOffsetToolStripMenuItem.Enabled = true;
     UpdateStatus(_lastKnownPath);
     _state = StateWmset;
     Wmset wmset = new Wmset(_lastKnownPath);
     listBox1.Items.Clear();
     listBox1.Items.AddRange(wmset._Debug_GetSections().Item1.ToArray());
     Render3D();
     wmsetunpack();
 }
Esempio n. 3
0
        private void wmsetunpack()
        {
            Wmset wmset = new Wmset(_lastKnownPath);
            var offsetList = wmset._Debug_GetSections().Item2.ToArray();
            listBox1.Items.Clear(); 
            listBox1.Items.AddRange(wmset._Debug_GetSections().Item1.ToArray());

            for (int i = 0; i != Wmset.DOffsetCount; i++)
            {
                string buildPath = Path.GetDirectoryName(_lastKnownPath);
                buildPath += $"\\{Path.GetFileNameWithoutExtension(_lastKnownPath)}.Section{(i + 1).ToString()}";
                if (File.Exists(buildPath))
                    File.Delete(buildPath);
                using (FileStream fs = new FileStream(_lastKnownPath, FileMode.Open))
                {
                    using (FileStream fsW = new FileStream(buildPath, FileMode.OpenOrCreate))
                    {
                        if (i + 1 != offsetList.Length)
                        {
                            byte[] tempMem = new byte[offsetList[i + 1] - offsetList[i]];
                            fs.Seek(offsetList[i], SeekOrigin.Begin);
                            fs.Read(tempMem, 0, tempMem.Length);
                            fsW.Write(tempMem, 0, tempMem.Length);
                        }
                        else
                        {
                            FileInfo fi = new FileInfo(_lastKnownPath);
                            long eof = fi.Length;
                            byte[] tempMem = new byte[eof - offsetList[i]];
                            fs.Seek(offsetList[i], SeekOrigin.Begin);
                            fs.Read(tempMem, 0, tempMem.Length);
                            fsW.Write(tempMem, 0, tempMem.Length);
                        }
                    }
                }
            }
            UpdateStatus("Unpacked wmsetus.obj");
        }
Esempio n. 4
0
 private void section1ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string test = Path.GetFileNameWithoutExtension(_lastKnownPath);
     if (test.Substring(0, 5) != "wmset")
     {
         Console.WriteLine("WMSET: Please open your lingual wmset file again");
         return;
     }
     string lingual = Wmset.ReturnLingual(_lastKnownPath);
     string dir = Path.GetDirectoryName(_lastKnownPath);
     string path = $"{dir}\\wmset{lingual}.Section16";
     _state = StateWmsetModel;
     Wmset wmset = new Wmset(path);
     UpdateStatus(_lastKnownPath);
     listBox1.Items.Clear();
     foreach (int i in wmset.ProduceOffset_sec16())
         listBox1.Items.Add(i);
 }