public void ShowCreateRoomTemplateWizard(UnloadedRoom room)
{
List<WizardPage> pages = new List<WizardPage>();
MakeTemplateWizardPage templateCreationPage = new MakeTemplateWizardPage(_agsEditor.TemplatesDirectory, ".art");
pages.Add(templateCreationPage);
WizardDialog dialog = new WizardDialog("Room Template", "This wizard will guide you through the process of creating a room template. A room template allows you to easily create new rooms based off an existing one.", pages);
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
string templateFileName = templateCreationPage.GetFullPath();
try
{
if (File.Exists(templateFileName))
{
File.Delete(templateFileName);
}
BinaryWriter writer = new BinaryWriter(new FileStream(ROOM_TEMPLATE_ID_FILE, FileMode.Create, FileAccess.Write));
writer.Write(ROOM_TEMPLATE_ID_FILE_SIGNATURE);
writer.Write(room.Number);
writer.Close();
Factory.NativeProxy.CreateTemplateFile(templateFileName, ConstructRoomTemplateFileList(room));
File.Delete(ROOM_TEMPLATE_ID_FILE);
Factory.GUIController.ShowMessage("Template created successfully. To try it out, create a new room.", MessageBoxIcon.Information);
}
catch (AGSEditorException ex)
{
Factory.GUIController.ShowMessage("There was an error creating your template: " + ex.Message, MessageBoxIcon.Warning);
}
catch (Exception ex)
{
Factory.GUIController.ShowMessage("There was an error creating your template. The error was: " + ex.Message + Environment.NewLine + Environment.NewLine + "Error details: " + ex.ToString(), MessageBoxIcon.Warning);
}
}
dialog.Dispose();
}