1
0
mirror of synced 2024-11-12 02:00:50 +01:00

Fix form dialogs not working for sarc (ie AAMP editor)

This commit is contained in:
KillzXGaming 2019-06-15 08:50:09 -04:00
parent 153783562e
commit 05cb5979f8
5 changed files with 16 additions and 7 deletions

Binary file not shown.

View File

@ -393,12 +393,21 @@ namespace FirstPlugin
private void OpenFormDialog(IFileFormat fileFormat)
{
STForm form = GetEditorForm(fileFormat);
UserControl form = GetEditorForm(fileFormat);
form.Text = (((IFileFormat)fileFormat).FileName);
var parentForm = LibraryGUI.Instance.GetActiveForm();
form.Text = (((IFileFormat)fileFormat).FileName);
form.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat);
form.Show(parentForm);
GenericEditorForm editorForm = new GenericEditorForm(true, form);
editorForm.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat);
if (editorForm.ShowDialog() == DialogResult.OK)
{
if (fileFormat.CanSave)
{
ArchiveFileInfo.FileData = fileFormat.Save();
UpdateEditor();
}
}
}
private void FormClosing(object sender, EventArgs args, IFileFormat fileFormat)
@ -413,7 +422,7 @@ namespace FirstPlugin
}
}
private STForm GetEditorForm(IFileFormat fileFormat)
private UserControl GetEditorForm(IFileFormat fileFormat)
{
Type objectType = fileFormat.GetType();
foreach (var inter in objectType.GetInterfaces())
@ -421,7 +430,7 @@ namespace FirstPlugin
if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>))
{
System.Reflection.MethodInfo method = objectType.GetMethod("OpenForm");
return (STForm)method.Invoke(fileFormat, new object[0]);
return (UserControl)method.Invoke(fileFormat, new object[0]);
}
}
return null;

View File

@ -110,7 +110,7 @@ namespace FirstPlugin
readonly STToolStripItem[] toolsExt = new STToolStripItem[1];
public OdysseyCostumeSelectorMenu()
{
toolsExt[0] = new STToolStripItem("Odyssey Costume Selctor");
toolsExt[0] = new STToolStripItem("Odyssey Costume Selector");
toolsExt[0].Click += OpenSelector;
}
private void OpenSelector(object sender, EventArgs args)