/// <summary> /// Loads in the values from a temp file, after the TextEditor has been closed /// </summary> public void loadInValuesFromTemp() { smbxNpcFile = new SMBXNpc(); if (File.Exists(Environment.CurrentDirectory + @"\temp.npctxt")) { smbxNpcFile.ReadFromTextFile(Environment.CurrentDirectory + @"\temp.npctxt"); hasChanges = true; } }
private void menuItem4_Click(object sender, EventArgs e) { OpenFileDialog of = new OpenFileDialog(); of.Filter = "SMBX NPC Text Files (npc-*.txt)|npc-*.txt|Plain Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; of.Title = "Select an NPC Text File"; DialogResult dr = of.ShowDialog(); switch (dr) { case (DialogResult.OK): ResetItems(this.Controls, true); curFile = of.FileName; smbxNpcFile = new SMBXNpc(); try { smbxNpcFile.ReadFromTextFile(curFile); loadValuesFromSmbxNpc(); } catch (BadNpcTextFileException ex) { MessageBox.Show(String.Format("An error occurred while trying to process the NPC Text File\n{0}", ex.Message), "Error Processing Text File", MessageBoxButtons.OK, MessageBoxIcon.Error); } // hasDoneASaveAs = true; if (File.Exists(npcAnimator.GetSpritePath(of.FileName))) { npcAnimator.setSprite(npcAnimator.GetSpritePath(of.FileName)); } ///TODO: Load the values into the UI break; case (DialogResult.Cancel): break; } }