예제 #1
0
 internal ResultValue(AddParam parent)
 {
     mParent = parent;
 }
예제 #2
0
        private void ToolstripRenameEntry_Click(object sender, EventArgs e)
        {
            //Make sure params file is open
            if (paramEntries.Count <= 0)
            {
                return;
            }

            //Open param entry creation form
            bool   alreadyExists = false;
            bool   createBin     = false;
            string fileName      = "";

            if (bustupDirPath != null)
            {
                using (var entryDialog = new AddParam())
                {
                    if (entryDialog.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    try
                    {
                        createBin     = AddParam.Result.createBin;
                        fileName      = AddParam.Result.fileName;
                        alreadyExists = AddParam.Result.alreadyExists;
                    }
                    catch
                    {
                    }
                }
                if (alreadyExists)
                {
                    return;
                }

                //Create .bin and/or add entry
                if (pType == BustupParamEditor.ParamEntry.ParamType.Assist)
                {
                    if (createBin && !File.Exists($"{bustupDirPath}\\{fileName}"))
                    {
                        DDS2.Create(bustupDirPath, fileName, true);
                    }
                    Params.RenameEntry(paramFilePath, fileName, true, listBox1.SelectedIndex);
                }
                else if (pType == BustupParamEditor.ParamEntry.ParamType.Normal)
                {
                    if (createBin && !File.Exists($"{bustupDirPath}\\{fileName}"))
                    {
                        DDS2.Create(bustupDirPath, fileName, false);
                    }
                    Params.RenameEntry(paramFilePath, fileName, false, listBox1.SelectedIndex);
                }
                //Reload file and select new entry
                LoadParams(paramFilePath);
                listBox1.SelectedIndex = listBox1.Items.Count - 1;
            }
            else
            {
                MessageBox.Show("Please set your Bustup .bin Directory path first!");
            }
        }