예제 #1
0
파일: MainForm.cs 프로젝트: Trenavix/BK2BT
        private void OpenMainBin(object sender, EventArgs e)//LoadMainBin
        {
            // Displays an OpenFileDialog so the user can select a Cursor.
            OpenFileDialog OpenBIN = OFD();

            OpenBIN.Filter = "BIN Files|*.bin";
            OpenBIN.Title  = "Select a BIN File";
            if (OpenBIN.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                bool isBinFile = false;
                using (FileStream fs = new FileStream(OpenBIN.FileName, FileMode.Open, FileAccess.Read))
                {
                    byte[] Header = new byte[16]; fs.Read(Header, 0, 16); //Load header into bytearray
                    if (Header[3] == 0x0B && Header[0] == 0x00)
                    {
                        isBinFile = true;
                    }                                                                 //Check if header is correct
                    if (Header[9] == 0x50)
                    {
                        isBTBin = true;
                    }
                    else
                    {
                        isBTBin = false;
                    }
                    fs.Close();
                }
                if (isBinFile)
                {
                    if (isBTBin)
                    {
                        DisplayBTBinMessage(); return;
                    }                                               //BT Not supported YET
                    BinManager.LoadBIN(OpenBIN.FileName);
                    SaveBinMenu.Enabled    = true; SaveBinAs.Enabled = true;
                    LoadBKAlphaBin.Enabled = true;
                    Renderer.Render(ClientRectangle, Width, Height, RenderPanel);
                    currentMainBinPath = OpenBIN.FileName;
                    UpdateStatusText();
                    ControlPanel.Visible          = true;
                    viewToolStripMenuItem.Visible = true;
                }
                else
                {
                    MessageBox.Show("File is not a BK Model Bin! Please try again.", "Invalid File!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #2
0
파일: MainForm.cs 프로젝트: Trenavix/BK2BT
 private void ReloadMainBin()
 {
     BinManager.LoadBIN(currentMainBinPath);
     Renderer.Render(ClientRectangle, Width, Height, RenderPanel);
     UpdateStatusText();
 }