_Debug_GetSections() public method

public _Debug_GetSections ( ) : List>.Tuple
return List>.Tuple
Exemplo n.º 1
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");
        }
Exemplo 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();
 }