using Stripe;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp1.translationKey
{
    class TranslationPrivateIn
    {
        private static string pathTemp = Directory.GetCurrentDirectory() + "\\translationResource";
        private static string txtPath = Directory.GetCurrentDirectory() + "\\translationResource\\ListPrivate.txt";

        public TranslationPrivateIn() { }

        public void InPutPrivate(string name, List<string> list)
        {
            if (Directory.Exists(pathTemp))
            {
                Directory.CreateDirectory(pathTemp);
            }

            string temppathTemp = pathTemp + "\\" + name + ".txt";
            StreamWriter sw = new StreamWriter(temppathTemp);
            StreamWriter sw2 = new StreamWriter(txtPath);

            foreach (string s in list)
            {
                sw.WriteLine(s);
            }

            sw2.WriteLine(name);
            sw.Close();
            sw2.Close();
        }

        public void InputBaiduPrivate(string name, string id, string key)//该函数仅百度支持
        {
            if(Directory.Exists(pathTemp))
            {
                Directory.CreateDirectory(pathTemp);
            }

            string temppathTemp = pathTemp + "\\" + name + ".txt";
            StreamWriter sw = new StreamWriter(temppathTemp);
            StreamWriter sw2 = new StreamWriter(txtPath);
            
            InputTranslationId(id,sw);
            InputTranslationKey(key,sw);
            
            sw2.WriteLine(name);
            sw.Close();
            sw2.Close();
        }

        public void InputTranslationId(string id, StreamWriter sw)
        {

            sw.WriteLine(id);
        }

        public void InputTranslationKey(string key, StreamWriter sw)
        {
            sw.WriteLine(key);
        }
    }
}
