Beispiel #1
0
        private void binToE()
        {
            StringBuilder bintoeCommand = new StringBuilder();

            //insert file and folder paths into conversion command
            bintoeCommand.Append("\"" + bin2ePath + "\"");
            bintoeCommand.Append(" ");
            bintoeCommand.Append("\"" + objLocation + objFileName + "\"");
            bintoeCommand.Append(" ");
            bintoeCommand.Append("\"" + newObjLocation + obj_e_FileName + "\"");

            RunCommand.Execute(bintoeCommand.ToString());

            Thread.Sleep(50); //Wait 50ms to give the above time to run
            if (File.Exists(newObjLocation + objFileName))
            {
                File.Delete(newObjLocation + objFileName);
            }
        }
Beispiel #2
0
        private void convertObject()
        {
            //Ensure res dir matches game dir if 'auto set' is checked
            if (chkAutoSetResourceDir.Checked)
            {
                AddToComboBox.UpdateItems(cbGameDir.Text, cbResDir);
            }
            //Ensure conv tex dir matches obj dir if checkbox is selected
            if (chkConvTexInObjDir.Checked)
            {
                AddToComboBox.UpdateItems(cbConvObjDir.Text, cbConvTexDir);
            }

            errorCheck();
            modelExtracted = false;         //initialise value
            ObjectType obType      = getObjectType(cbObjModel.Text);
            string     modelFolder = "obj"; //obj or mesh, depending on object type

            if (obType == ObjectType.Mesh)
            {
                modelFolder = "mesh";
            }

            if (checkList.Count == 0)                       //checks that relevant things have been filled in, but not if they're any good.
            {
                if (openCRFs(obType) && checkWriteAccess()) //checks that conversion can probably be done.
                {
                    string shortName       = Path.GetFileName(cbObjModel.Text).Trim();
                    string chosenModelPath = findModelFile(cbObjModel.Text, modelFolder, shortName);
                    if (chosenModelPath != "")
                    {
                        string noExt = Path.GetFileNameWithoutExtension(shortName);

                        string eFilePath = Path.Combine(cbConvObjDir.Text, noExt + ".e");

                        if (chosenModelPath.ToLower().EndsWith(".bin"))
                        {
                            string binToECommand = "\"" + cbBintoE.Text + "\" \"" + chosenModelPath + "\" \"" + eFilePath + "\"";
                            RunCommand.Execute(binToECommand);
                        }
                        else
                        {
                            File.Copy(chosenModelPath, eFilePath, true);
                        }
                        if (modelExtracted)
                        {
                            File.Delete(chosenModelPath); //delete source file if it was extracted from a CRF.
                        }
                        if (checkEFile(eFilePath))
                        {
                            if (!chkNoTextures.Checked)
                            {
                                convertETextures(eFilePath, modelFolder);
                            }

                            editEFile(eFilePath);

                            if (rdo3dsConv.Checked)
                            {
                                string eto3dsCommand = generate3dsCommand(eFilePath);
                                RunCommand.Execute(eto3dsCommand);
                                File.Delete(eFilePath);
                            }
                        }
                        else
                        {
                            MessageBox.Show(".e file not created or bintoe failed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        }
                    }
                    else
                    {
                        MessageBox.Show(cbObjModel.Text + " cannot be found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
            }

            else
            {
                StringBuilder sB = new StringBuilder();
                foreach (string error in checkList)
                {
                    sB.AppendLine(error);
                }
                MessageBox.Show(sB.ToString(), "Errors", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }