Tinkr2/4.2/AphelionCore/AphelionCore/Helpers/XMLReaderEX.cs
/// <summary>
/// Saves structure to an XML file
/// </summary>
/// <param name="filename">Full path of the file to save to</param>
Saves structure to an XML file
Saves structure to an XML file
public void Save(string filename)
      {
         string xml = string.Empty;
         for (int i = 0; i < _nodes.Length; i++)
         {
            if (_nodes[i].Nodes.Length == 0)
            {
               xml = string.Concat(xml,
                  "<" + _nodes[i].ShortName + ">" + _nodes[i].Value + "</" + _nodes[i].ShortName + ">");
            }
            else
            {
               xml = string.Concat(xml, "<" + _nodes[i].ShortName + ">" + SubNodeData(_nodes[i]) + "</" + _nodes[i].ShortName + ">");
            }
         }
         byte[] b = Encoding.UTF8.GetBytes(xml);
         if (File.Exists(filename))
         {
            File.Delete(filename);
         }
         var iFile = new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
         iFile.Write(b, 0, b.Length);
         iFile.Close();
      }
public void Save ( string filename ) { string xml = string . Empty ; for ( int i = 0 ; i < _nodes . Length ; i ++ ) { if ( _nodes [ i ] . Nodes . Length == 0 ) { xml = string . Concat ( xml , " " + _nodes [ i ] . ShortName + " " + _nodes [ i ] . Value + " " + _nodes [ i ] . ShortName + " " ) ; } else { xml = string . Concat ( xml , " " + _nodes [ i ] . ShortName + " " + SubNodeData ( _nodes [ i ] ) + " " + _nodes [ i ] . ShortName + " " ) ; } } byte [ ] b = Encoding . UTF8 . GetBytes ( xml ) ; if ( File . Exists ( filename ) ) { File . Delete ( filename ) ; } var iFile = new FileStream ( filename , FileMode . CreateNew , FileAccess . Write ) ; iFile . Write ( b , 0 , b . Length ) ; iFile . Close ( ) ; }
Saves structure to an XML file
Saves structure to an XML file
filename
string
Full path of the file to save to
Full path of the file to save to