///// ------------------------------------------------------------------------------------ ///// <summary> ///// Asks the user to specify a TMX file for saving TMX information. ///// </summary> ///// ------------------------------------------------------------------------------------ //public static string AskForTMXFileAndWrite(TMXDocument tmxDoc) //{ // using (SaveFileDialog dlg = new SaveFileDialog()) // { // dlg.OverwritePrompt = true; // dlg.Title = Properties.Resources.kstidTMXSFDCaption; // dlg.Filter = Properties.Resources.kstidTMXOpenAndSaveDlgFilter; // DialogResult result = dlg.ShowDialog(); // if (result == DialogResult.Cancel) // return null; // Write(tmxDoc, dlg.FileName); // return dlg.FileName; // } //} /// ------------------------------------------------------------------------------------ /// <summary> /// Writes the specified TMXDocument information to the specified TMX file. /// </summary> /// ------------------------------------------------------------------------------------ public static void Write(TMXDocument tmxDoc, string tmxFile) { if (tmxDoc == null) { throw new ArgumentNullException("tmxDoc"); } TMXXmlSerializationHelper.SerializeToFile(tmxFile, tmxDoc); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Saves the TMXDocument to the specified TMX file. /// </summary> /// ------------------------------------------------------------------------------------ public void Save(string tmxFile) { var dir = Path.GetDirectoryName(tmxFile); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } TMXXmlSerializationHelper.SerializeToFile(tmxFile, this); }