using System;
using System.IO;
using System.Windows;

namespace Earthblend.Tts.Common.Core.Extentions
{
    public static partial class UniqueExtensions
    {
        public static void WriteFile(this String text, String fullPath, Boolean append)
        {
            try
            {
                String path = fullPath.Replace("\\\\", "\\");
                StreamWriter streamWriter = new StreamWriter(path);
                streamWriter.AutoFlush = true;
                streamWriter.WriteLine(FormatXml(text));
                streamWriter.Close();
                streamWriter.Dispose();
                streamWriter = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public static void WriteTextFile(this String text, String fullPath, Boolean append)
        {
            try
            {
                String path = fullPath;
                StreamWriter streamWriter = new StreamWriter(path);
                streamWriter.WriteLine(text);
                streamWriter.Flush();
                streamWriter.Close();
                streamWriter.Dispose();
                streamWriter = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}