コード例 #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);
        }