using System.Diagnostics;
namespace DragonVideoPlayer
{
    public static class Download_class
    {
        public static void DownloadStream(string url, string outputPath)
        {
            String steam_path = config_class.config_text_read("streamlinkのパス");

            ProcessStartInfo psi = new ProcessStartInfo
            {
                FileName = steam_path,
                Arguments = $"\"{url}\" best -o \"{outputPath}\"",
                UseShellExecute = true,   // DOS窓を表示
                CreateNoWindow = false
            };

            Process.Start(psi);
        }
        public static void Download_Ytdlp_nopart(string url, string file_path)
        {
            String ytdlp_path = config_class.config_text_read("yt-dlpのパス");

            string command = $"--no-part -o \"{file_path}\" \"{url}\"";

            ProcessStartInfo psi = new ProcessStartInfo
            {
                FileName = ytdlp_path,
                Arguments = command,
                UseShellExecute = true,
                CreateNoWindow = false
            };

            Process.Start(psi);
        }
        public static void Download_Ytdlp(string url, String file_path)
        {
            String ytdlp_path = config_class.config_text_read("yt-dlpのパス");

            // コマンド（ファイル名指定なし＝yt-dlpのデフォルト）
            string command = $"-o \"{file_path}\" \"{url}\"";

            ProcessStartInfo psi = new ProcessStartInfo
            {
                FileName = ytdlp_path,
                Arguments = command, // ← 実行後も窓を閉じない
                UseShellExecute = true,      // ← DOS窓を出す
                CreateNoWindow = false
            };

            Process.Start(psi);
        }
        public static void Download_Ytdlp(string url)
        {
            String ytdlp_path = config_class.config_text_read("yt-dlpのパス");

            // コマンド（ファイル名指定なし＝yt-dlpのデフォルト）
            string command = $"\"{url}\"";

            ProcessStartInfo psi = new ProcessStartInfo
            {
                FileName = ytdlp_path,
                Arguments = command, // ← 実行後も窓を閉じない
                UseShellExecute = true,      // ← DOS窓を出す
                CreateNoWindow = false
            };

            Process.Start(psi);
        }
    }
}
