public static void WriteDocument(string file, DocumentSyntax doc) { using (var writer = File.CreateText(file)) { doc.WriteTo(writer); } }
internal static bool Save(string ConfigPath) { try { var Document = new DocumentSyntax(); SaveClass(typeof(Config), Document); using var writer = File.CreateText(ConfigPath); Document.WriteTo(writer); writer.Flush(); } catch (Exception ex) { ex.PrintWarning(); return(false); } return(true); }
internal static bool Save(MemoryStream stream) { try { var Document = new DocumentSyntax(); SaveClass(typeof(Config), Document); using var writer = new StreamWriter(stream); Document.WriteTo(writer); writer.Flush(); } catch (Exception ex) { ex.PrintWarning(); return(false); } return(true); }