protected override void ImportHighLevel(Dictionary <string, string> correspondents, List <string> orphans) { foreach (var pair in correspondents) { Dbg.Write($"copying {pair.Key} into {pair.Value}"); File.Copy(pair.Key, pair.Value, true); } DeleteAllFiles(orphans); string code = GenerateClassCodeForTypedAsset(correspondents.Values.ToArray()); File.WriteAllText(Path.Combine(DirectoryWidget.GetPathOf(OUTCD), Id + ".cs"), code); }
protected override void ImportHighLevel(Dictionary <string, string> correspondents, List <string> orphans) { foreach (KeyValuePair <string, string> correspondent in correspondents) { Dbg.Write("COMPILING SHADER: " + correspondent.Key + " -> " + correspondent.Value); try { Process process = new Process(); process.StartInfo.FileName = DirectoryWidget.GetPathOf(DXCPL); process.StartInfo.Arguments = $"/T fx_2_0 \"{correspondent.Key}\" /Fo \"{correspondent.Value}\""; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); Dbg.Write(process.StandardOutput.ReadLine() + process.StandardError.ReadLine()); } catch (Exception e) { Dbg.Write("ERROR COMPILING SHADERS!: " + e.Message); } } foreach (string file in orphans) { foreach (string bis in BUILT_IN_SHADERS) { if (file.Contains(bis)) { Dbg.Write("SKIPPING BUILT-IN ORPHAN: " + file); goto SKIP1; } } Dbg.Write("DELETING ORPHAN: " + file); File.Delete(file); SKIP1 :; } string outcode = GenerateClassCodeForTypedAsset(correspondents.Values.ToArray()); File.WriteAllText(Path.Combine(DirectoryWidget.GetPathOf(OUTCD), Id + ".cs"), outcode); }