public void LiveRecord(string filename, DownloadFile file, string extension = "") { this.Text = file.Title; label1.Text = "ダウンロードを開始します。このメッセージが変わらない場合はエラーだと思われます。"; downloadfile = file; savedfilename = filename; new Thread(() => { LiveRecord0(filename, file); }).Start(); this.TopMost = true; this.BringToFront(); }
public void Record0(string filename, DownloadFile file, string extension = "") { if (extension == "") { extension = file.Extension; } string filename2 = Util.RemoveExtension(filename) + "." + extension; //filename2 = Util.MakeValidFileName(filename2); savedlocation = filename2; System.IO.Directory.CreateDirectory(directory); templocation = directory + "\\" + Guid.NewGuid() + ".mp4"; string url = file.Uri; string argument = "ismdownloader \"" + url + "\" \"" + templocation + "\""; //Processオブジェクトを作成 p = new System.Diagnostics.Process(); exited = false; p.Exited += P_Exited; //出力とエラーをストリームに書き込むようにする p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; //OutputDataReceivedとErrorDataReceivedイベントハンドラを追加 p.OutputDataReceived += p_OutputDataReceived; p.ErrorDataReceived += p_ErrorDataReceived; p.StartInfo.FileName = System.Environment.GetEnvironmentVariable("ComSpec"); p.StartInfo.RedirectStandardInput = true; p.StartInfo.CreateNoWindow = true; //p.StartInfo.Arguments = argument; //p.StandardInput.Encoding = Encoding.Unicode; //起動 p.Start(); //非同期で出力とエラーの読み取りを開始 p.BeginOutputReadLine(); p.BeginErrorReadLine(); sw = p.StandardInput; if (sw.BaseStream.CanWrite) { //「dir c:\ /w」を実行する sw.WriteLine(argument); } return; }
public void AddFile(DownloadData data) { string extension = ""; string filename = data.URL.Split('/').Last(); if (data.Extension != "") { extension = data.Extension; filename = filename + "." + extension; } else { extension = Util.GetExtension(data.URL); } var file = new DownloadFile { Uri = data.URL, Folder = data.Folder, Filename = filename, Title = data.Title, Protocol = data.Protocol, Extension = extension, Data = data }; downloadFiles.Add(file); OnPropertyChanged("DownloadFiles"); }
public void LiveRecord0(string filename, DownloadFile file, string extension = "") { if(extension == "") { extension = file.Extension; } string filename2 = DateTime.Now.ToShortDateString() + "-" + DateTime.Now.ToShortTimeString() + "_" + DateTime.Now.Second + "." + extension; filename2 = Util.MakeValidFileName(filename2); savedlocation = filename + filename2; string url = file.Uri; string argument = "ffmpeg -c copy \"" + filename + filename2 + "\" -i " + url; //Processオブジェクトを作成 p = new System.Diagnostics.Process(); exited = false; p.Exited += P_Exited; //出力とエラーをストリームに書き込むようにする p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; //OutputDataReceivedとErrorDataReceivedイベントハンドラを追加 p.OutputDataReceived += p_OutputDataReceived; p.ErrorDataReceived += p_ErrorDataReceived; p.StartInfo.FileName = System.Environment.GetEnvironmentVariable("ComSpec"); p.StartInfo.RedirectStandardInput = true; p.StartInfo.CreateNoWindow = true; //p.StartInfo.Arguments = argument; //p.StandardInput.Encoding = Encoding.Unicode; //起動 p.Start(); //非同期で出力とエラーの読み取りを開始 p.BeginOutputReadLine(); p.BeginErrorReadLine(); sw = p.StandardInput; if (sw.BaseStream.CanWrite) { //「dir c:\ /w」を実行する sw.WriteLine(argument); } return; }