static public void CopyOut(string cmd, string file, LibsToolsCFG libsToolsCFG) { foreach (CfgItem cfgItem in libsToolsCFG.cfgItemArr) { if (cfgItem.cmd.Equals(cmd)) { FileTools.CopyDir(file, cfgItem.value); } } EditorUtility.DisplayDialog("LOG", "Copy 完成!", "ok"); }
private void MakeMovieFile() { using (WorkingDir wd = new WorkingDir()) { FileTools.CopyDir(this.VideoJpgDir, wd.GetPath("1")); this.Batch( Consts.FFMPEG_FILE + " -r " + Consts.FPS + " -i %%d.jpg ..\\2.mp4", wd.GetPath("1") ); if (File.Exists(wd.GetPath("2.mp4")) == false) { throw new Exception("映像ファイルの生成に失敗しました。"); } File.Copy(this.MasterWavFile, wd.GetPath("3.wav")); // -codec:a copy を除去 // -ab 160k を追加 this.Batch( Consts.FFMPEG_FILE + " -i 2.mp4 -i 3.wav -map 0:0 -map 1:0 -vcodec copy -ab 160k 4.mp4", wd.GetPath(".") ); if (File.Exists(wd.GetPath("4.mp4")) == false) { throw new Exception("動画ファイルの生成に失敗しました。"); } this.Batch( "ECHO Y|CACLS 4.mp4 /P Users:F Guest:F", wd.GetPath(".") ); if (File.Exists(this.MovieFile)) // 2bs { throw null; } File.Move(wd.GetPath("4.mp4"), this.MovieFile); if (File.Exists(this.MovieFile) == false) { throw new Exception("動画ファイルの書き出しに失敗しました。"); } } }
static public void CopyFiles() { LibsToolsCFG libsToolsCFG = new LibsToolsCFG(); foreach (CfgItem f in libsToolsCFG.cfgItemArr) { if (f.cmd.Equals("CopyFiles")) { string formPath = f.value.Substring(0, f.value.IndexOf("->")); string toPath = f.value.Substring(f.value.IndexOf("->") + 2); FileTools.CopyDir(formPath, toPath); Debug.Log(f.value); Debug.LogWarning("CopyFiles >> " + toPath); } if (f.cmd.Equals("CopyFile")) { string formPath = f.value.Substring(0, f.value.IndexOf("->")); string toPath = f.value.Substring(f.value.IndexOf("->") + 2); int index = toPath.LastIndexOf("/"); string filePath = string.Empty; if (index != -1) { filePath = toPath.Substring(0, index); } if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } if (File.Exists(toPath)) { File.Delete(toPath); } File.Copy(formPath, toPath); Debug.Log(f.value); Debug.LogWarning("CopyFile >> " + toPath); } } }
private void Main3(ArgsReader ar) { bool noOpenOutput = ar.ArgIs("/-D"); if (ar.HasArgs(2)) { throw new Exception("不明なコマンド引数"); } if (ar.HasArgs()) { Ground.RootDir = FileTools.MakeFullPath(ar.NextArg()); } else { Ground.RootDir = CommonUtils.GetRiotDir(); } Console.WriteLine("RootDir: " + Ground.RootDir); if (Directory.Exists(Ground.RootDir) == false) { throw new Exception("no RootDir"); } Ground.FileAndDirectoryConfigFile = Path.Combine(Ground.RootDir, "FileAndDirectory.config.txt"); Ground.ResourceDir = Path.Combine(Ground.RootDir, "res"); Ground.OutDir = Path.Combine(Ground.RootDir, "out"); Ground.OutHtmlFile = Path.Combine(Ground.OutDir, "index.html"); Ground.OutHtmlFile_Slimmed = Path.Combine(Ground.OutDir, "slimmed_index.html"); Ground.OutHtmlFile_Slimmed_Wrapped = Path.Combine(Ground.OutDir, "slimmed_wrapped_index.html"); Ground.OutTestMainHtmlFileBase = Path.Combine(Ground.OutDir, "index_"); Console.WriteLine("ComponentAndScriptConfigFile: " + Ground.FileAndDirectoryConfigFile); Console.WriteLine("ResourceDir: " + Ground.ResourceDir); Console.WriteLine("OutDir: " + Ground.OutDir); Console.WriteLine("OutHtmlFile: " + Ground.OutHtmlFile); Console.WriteLine("OutHtmlFile_Slimmed: " + Ground.OutHtmlFile_Slimmed); Console.WriteLine("OutTestMainHtmlFileBase: " + Ground.OutTestMainHtmlFileBase); // ---- check ---- if (File.Exists(Ground.FileAndDirectoryConfigFile) == false) { throw new Exception("no FileAndDirectoryConfigFile"); } if (Directory.Exists(Ground.ResourceDir) == false) { throw new Exception("no ResourceDir"); } if (Directory.Exists(Ground.OutDir) == false) { throw new Exception("no OutDir"); } //Ground.OutHtmlFile //Ground.OutTestMainHtmlFileBase // ---- this.LoadFileAndDirectoryConfig(); Ground.DefineManager = new DefineManager(); // 先に! Ground.ScriptManager = new ScriptManager(); Ground.ComponentManager = new ComponentManager(); Ground.MainHtmlText = File.ReadAllText(Ground.MainHtmlFile, StringTools.ENCODING_SJIS); Ground.GlobalName = Ground.DefineManager.GetPropertyNN("GLOBAL"); FileTools.CleanupDir(Ground.OutDir); FileTools.CopyDir(Ground.ResourceDir, Ground.OutDir); foreach (string dir in Ground.ComponentAndScriptDirs) { this.CopyResources(dir, Ground.OutDir); } { string TESTMAIN_PTN = Guid.NewGuid().ToString("B"); string outHtmlFormat = Ground.MainHtmlText; GlobalIdentifierResolver gir = new GlobalIdentifierResolver(); { string script = Ground.ScriptManager.GetJSCode(); string component = Ground.ComponentManager.GetJSCode(); string css = Ground.ComponentManager.GetCSSCode(); gir.AddJSCode(script); gir.AddJSCode(component); script = gir.ResolveJSCode(script); component = gir.ResolveJSCode(component); css = gir.ResolveCSSCode(css); outHtmlFormat = StringTools.MultiReplace(outHtmlFormat, "riot_script", script, "riot_component", component, "riot_css", css, "riot_testmain", TESTMAIN_PTN ); } { string outHtml = outHtmlFormat; outHtml = StringTools.MultiReplace(outHtml, TESTMAIN_PTN, "" ); outHtml = CommonUtils.ToHTMLNewLine(outHtml); File.WriteAllText(Ground.OutHtmlFile, outHtml, Encoding.UTF8); } foreach (ScriptFile scriptFile in Ground.ScriptManager.GetTestMainScriptFiles()) { string outHtml = outHtmlFormat; { string script = scriptFile.GetJSCode(); gir.AddJSCode(script); script = gir.ResolveJSCode(script); outHtml = StringTools.MultiReplace(outHtml, TESTMAIN_PTN, script ); } outHtml = CommonUtils.ToHTMLNewLine(outHtml); File.WriteAllText(Ground.OutTestMainHtmlFileBase + scriptFile.CoName + Consts.OUT_TEST_MAIN_HTML_SUFFIX, outHtml, Encoding.UTF8); } if (noOpenOutput == false) { OpenOutput(); } HtmlFileOptimizer.Perform( Ground.OutHtmlFile, Ground.OutHtmlFile_Slimmed, ScriptOptimizer.Slim ); HtmlFileOptimizer.Perform( Ground.OutHtmlFile_Slimmed, Ground.OutHtmlFile_Slimmed_Wrapped, ScriptOptimizer.Wrap ); } }