public static string GetFairFullPath(string path) { using (WorkingDir wd = new WorkingDir()) { string argsFile = wd.MakePath(); string outFile = wd.MakePath(); string molp = SecurityTools.MakePassword_9(); string[] args = { "//O", outFile, "//MOLP", molp, "//-E", "//$", JString.AsLine(path), }; File.WriteAllLines(argsFile, args, StringTools.ENCODING_SJIS); ProcessTools.Start(@"C:\Factory\Bodewig\DenebolaToolkit\FairFullPath.exe", "//R \"" + argsFile + "\"").WaitForExit(); string[] outLines = File.ReadAllLines(outFile, StringTools.ENCODING_SJIS) .Where(v => v.StartsWith(molp)) .Select(v => v.Substring(molp.Length)).ToArray(); if (outLines.Length != 1) { throw new Exception("不正なパス文字列です。"); } return(outLines[0]); } }
public static void RemovePrimeDat() { GeneratePrimeDat_Proc.WaitForExit(); GeneratePrimeDat_Proc = null; ProcessTools.Start(Prime53File, "/D").WaitForExit(); }
private static void Perform_OutFile_Interlude(string arguments, string outFile, Func <bool> interlude) { using (Process p = ProcessTools.Start( Prime4096File, arguments + " \"" + outFile + "\"", "", ProcessTools.WindowStyle_e.INVISIBLE, psi => psi.RedirectStandardOutput = true )) using (new ThreadEx(() => { StreamReader reader = p.StandardOutput; for (int c = 0; c < 100; c++) { string line = reader.ReadLine(); if (line == null) { break; } using (StreamWriter writer = new StreamWriter(LogFile, c != 0, Encoding.UTF8)) { writer.WriteLine("[" + DateTime.Now + "." + (c + 1).ToString("D3") + "] " + line); } } } )) { bool cancelled = false; while (p.WaitForExit(2000) == false) { if (cancelled || interlude() == false) { ProcessTools.Start(Prime4096File, "/S").WaitForExit(); cancelled = true; } } } { string errorReportFile = Path.Combine(Path.GetDirectoryName(Prime4096File), Consts.ERROR_REPORT_LOCAL_FILE); if (File.Exists(errorReportFile)) { string message = File.ReadAllText(errorReportFile, Encoding.UTF8); FileTools.Delete(errorReportFile); throw new CUIError(message); } } }
private static void Perform_OutFile_Interlude(string arguments, string outFile, Func <bool> interlude) { using (Process p = ProcessTools.Start( Prime53File, arguments + " \"" + outFile + "\"", "", ProcessTools.WindowStyle_e.INVISIBLE, psi => psi.RedirectStandardOutput = true )) using (new ThreadEx(() => { StreamReader reader = p.StandardOutput; for (; ;) { string line = reader.ReadLine(); if (line == null) { break; } Console.WriteLine(line); } } )) { bool cancelled = false; while (p.WaitForExit(2000) == false) { if (cancelled || interlude() == false) { ProcessTools.Start(Prime53File, "/S").WaitForExit(); cancelled = true; } } } }
public static void GeneratePrimeDat() { GeneratePrimeDat_Proc = ProcessTools.Start(Prime53File, "/2"); }
private void StartMain() { if (this.Info.AudioFile == "") { throw new Exception("音楽ファイルが指定されていません。"); } if (this.Info.ImageFile == "") { throw new Exception("映像用の画像が指定されていません。"); } if (this.Info.MovieFile == "") { throw new Exception("動画ファイル(出力先)が指定されていません。"); } if (File.Exists(this.Info.AudioFile) == false) { throw new Exception("音楽ファイルが見つかりません。"); } if (File.Exists(this.Info.ImageFile) == false) { throw new Exception("映像用の画像が見つかりません。"); } if (File.Exists(this.Info.MovieFile) && Ground.I.AllowOverwrite == false) { throw new Exception("動画ファイル(出力先)は既に存在します。(上書きは許可されていません)"); } if (Ground.I.FFmpegDir == "") { throw new Exception("ffmpegフォルダが設定されていません。"); } if (Directory.Exists(Ground.I.FFmpegDir) == false) { throw new Exception("ffmpegフォルダが見つかりません。"); } this.WorkDir = Ground.I.WD.MakePath(); this.ErrorMessageFile = Ground.I.WD.MakePath(); this.LogFile = Ground.I.WD.MakePath(); //FileTools.CreateDir(this.WorkDir); // 作成不要 FileTools.CreateDir(Path.GetDirectoryName(this.Info.MovieFile)); File.WriteAllBytes(this.Info.MovieFile, BinTools.EMPTY); // 書き込みテスト FileTools.Delete(this.Info.MovieFile); this.Proc = ProcessTools.Start( CommonUtils.GetConverterFile(), string.Join(" ", new string[] { "/WD", CommonUtils.Encode(this.WorkDir), "/FFMD", CommonUtils.Encode(Ground.I.FFmpegDir), "/ITF", CommonUtils.Encode(CommonUtils.GetImgToolsFile()), "/BCF", CommonUtils.Encode(CommonUtils.GetBmpToCsvFile()), "/MST-F", CommonUtils.Encode(CommonUtils.GetMasterFile()), "/AF", CommonUtils.Encode(this.Info.AudioFile), "/IF", CommonUtils.Encode(this.Info.ImageFile), "/MF", CommonUtils.Encode(this.Info.MovieFile), "/FPS", "" + this.Info.FPS, "/JQ", "" + Ground.I.Config.JpegQuality, "/EMF", CommonUtils.Encode(this.ErrorMessageFile), "/LF", CommonUtils.Encode(this.LogFile), "/AG", "" + (Ground.I.Config.ApproveGuest ? 1 : 0), "/DI", "" + (Ground.I.画像を二重に表示 ? 1 : 0), "/DI-W", "" + Ground.I.画像を二重に表示_MonitorW, "/DI-H", "" + Ground.I.画像を二重に表示_MonitorH, "/DI-B", "" + Ground.I.画像を二重に表示_ぼかし, "/DI-A", "" + Ground.I.画像を二重に表示_明るさ, "/M", "" + (Ground.I.MasteringFlag ? 1 : 0), }) ); }