public void write(BuildTarget target, BuildTracker buildTracker, ProgressWriter progressWriter) { Dictionary <string, TES5Target> scripts = buildTracker.GetBuiltScripts(target.GetTargetName()); List <TES5Target> connectedQuestFragments = new List <TES5Target>(); Dictionary <string, List <QuestStageScript> > jointScripts = new Dictionary <string, List <QuestStageScript> >(); /* * Scan manually for .map files in the QF scripts folder * Reason is that in case we"ve got a quest with no fragments to anything whatsoever, we"ll have to go * through it too ( just with empty subfragments trees ), to generate the objective handlings */ string sourcePath = target.GetSourcePath(); foreach (var mapFilePath in Directory.EnumerateFiles(sourcePath, "*.map")) { string mapFileName = Path.GetFileNameWithoutExtension(mapFilePath); jointScripts.AddNewListIfNotContainsKey(mapFileName); } /* * Group the fragments together */ foreach (var script in scripts.Values) { string[] parts = script.Script.ScriptHeader.OriginalScriptName.Split('_'); if (parts.Length < 3) { //Not able to categorize, probably wrong name of the fragment. continue; } string baseName = parts[0] + "_" + parts[1] + "_" + parts[2]; jointScripts.AddNewListIfNotContainsKeyAndAddValueToList(baseName, new QuestStageScript(script, int.Parse(parts[3]), int.Parse(parts[4]))); } foreach (var kvp in jointScripts) { var resultingFragmentName = kvp.Key; var subfragmentsTrees = kvp.Value; connectedQuestFragments.Add(this.QFFragmentFactory.JoinQFFragments(target, resultingFragmentName, subfragmentsTrees)); } Write(connectedQuestFragments, progressWriter); }
public void write(BuildTarget target, BuildTracker buildTracker, ProgressWriter progressWriter) { Write(buildTracker.GetBuiltScripts(target.GetTargetName()).Values, progressWriter); }