using System.Diagnostics;

namespace WpfApp1.ScnToJson
{
    internal class TranslationScnToJson
    {
        //private string spath;//scn路径
        //private string dpath;//json

        private string cmdHandle = "cd " + Directory.GetCurrentDirectory() + "\\VNT\\VNTextPatch";
        private string voice = ".\\VNTextPatch extractlocal " + Directory.GetCurrentDirectory() + "\\VNT\\p1 " + Directory.GetCurrentDirectory() + "\\VNT\\p2";

        public void StartTrans()
        {
            this.DirExsis("VNT\\p1");
            this.DirExsis("VNT\\p2");

            var p = new Process
            {
                StartInfo =
                {
                    FileName = "PowerShell.exe",
                    Arguments = "/c " + cmdHandle + "\n" + voice,
                    UseShellExecute = false,
                    CreateNoWindow = false,
                }
            };
            p.Start();
            p.WaitForExit();
            p.Close();

        }

        public void DirExsis(string id)
        {
            if(Directory.Exists(Directory.GetCurrentDirectory() + "\\" + id))
            {
                Directory.CreateDirectory(Directory.GetCurrentDirectory() + "\\" + id);
            }
        }

        public void StopTrans(string spa, string dps)//自选路径
        {
            string tempVoice = ".\\VNTextPatch extractlocal " + spa + " " + dps;

            var p = new Process
            {
                StartInfo =
                {
                    FileName = "PowerShell.exe",
                    Arguments = "/c " + cmdHandle + "\n" + tempVoice,
                    UseShellExecute = false,
                    CreateNoWindow = false,
                }
            };
            p.Start();
            p.WaitForExit();
            p.Close();
        }




    }
}