public void Command_Dialog_AddPatch(IWin32Window owner) {
var result = _openModDialog.ShowDialog(owner);
if (result == DialogResult.Cancel) {
return;
}
var fileName = _openModDialog.FileName;
var fileNameOnly = Path.GetFileName(fileName);
var collision =
Instructions.SingleOrDefault(instr => Path.GetFileName(instr.PatchLocation).EqualsIgnoreCase(fileNameOnly));
if (collision != null) {
Command_Display_Error("Load a patch", fileNameOnly, message: "You already have a patch with this filename.");
return;
}
try {
Command_Direct_AddPatch(fileName, true);
}
catch (Exception ex) {
Command_Display_Error("Load a patch", PathHelper.GetUserFriendlyPath(fileName), ex, "");
}
}