예제 #1
0
 public static void WriteDocument(string file, DocumentSyntax doc)
 {
     using (var writer = File.CreateText(file))
     {
         doc.WriteTo(writer);
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }