Exemplo n.º 1
0
        /*----- Public Methods -----*/

        /// <summary>
        /// Writes a single gemstone to file.
        /// Overrides previous file
        /// </summary>
        public void SaveSingleGemstone(string filename, Gem gemstone)
        {
            var path = BasePath + StaticStrings.GemPath;

            try
            {
                var playerDoc = OpenDocument(filename, path, false);
                WriteToDocument(playerDoc, gemstone.PlayerDocumentStrings());
                playerDoc.Close();

                var GMDoc = OpenDocument("GM" + filename, path, false);
                WriteToDocument(GMDoc, gemstone.GMDocumentStrings());
                GMDoc.Close();
            }
            catch (Exception ex)
            {
                var message = "Error saving single gemstone => " + ex.Message;
                throw new InvalidOperationException(message, ex);
            }
        }