private static ITaskItem[] ComputeOutputs(string baseAssemblyName, int count) { const string deltaOutputTypeMetadata = "DeltaOutputType"; DeltaOutputType[] outputTypes = new DeltaOutputType[] { DeltaOutputType.dmeta, DeltaOutputType.dil, DeltaOutputType.dpdb, DeltaOutputType.updateHandlerJson, }; int itemsPerRev = outputTypes.Length; ITaskItem[] result = new TaskItem[itemsPerRev * count]; for (int i = 0; i < count; ++i) { int rev = 1 + i; foreach (var outputType in outputTypes) { int index = i * itemsPerRev + (int)outputType; string name = NameForOutput(baseAssemblyName, rev, outputType); result[index] = new TaskItem(name, new Dictionary <string, string> { { deltaOutputTypeMetadata, outputType.ToString() } }); } } return(result); }
private static string NameForOutput(string baseName, int rev, DeltaOutputType t) { string ext = t switch { DeltaOutputType.dmeta => "dmeta", DeltaOutputType.dil => "dil", DeltaOutputType.dpdb => "dpdb", DeltaOutputType.updateHandlerJson => "handler.json", _ => throw new Exception("unexpected") }; return($"{baseName}.{rev}.{ext}"); }