using System;
using System.Xml;
using System.Linq;
using System.Xml.Linq;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using AR;
using System.IO;
using System.Text;


namespace Project
{
    public static class MethodExts
    {
        /// <summary>
        /// 지정된 파일 끝에 내용을 추가합니다.
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="data"></param>
        public static void AppendText(this System.IO.FileInfo filename, string data)
        {
            if (filename.Directory.Exists == false) filename.Directory.Create();
            using (var writer = new StreamWriter(filename.FullName, true, System.Text.Encoding.Default))
                writer.Write(data);//
        }
     
        public static void WriteText(this System.IO.FileInfo filename, string data, bool append = false)
        {
            if (filename.Directory.Exists == false) filename.Directory.Create();
            if (append == false)
                System.IO.File.WriteAllText(filename.FullName, data);
            else
                AppendText(filename, data);
        }
        
    }

}
