public static GeneratePartialTypeDisambiguationFile ( string solutionDestinationFolder, string projectDestinationFolder, string symbolId, IEnumerable |
||
solutionDestinationFolder | string | |
projectDestinationFolder | string | |
symbolId | string | |
filePaths | IEnumerable |
|
Résultat | void |
private static void WriteMapping( StreamWriter writer, string solutionDestinationFolder, string projectDestinationFolder, Dictionary <string, IEnumerable <string> > symbolIDToListOfLocationsMap) { var files = ExtractFilePaths(symbolIDToListOfLocationsMap); var fileIndexLookup = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase); writer.WriteLine("(function(){"); writer.WriteLine("var f = ["); for (int i = 0; i < files.Length; i++) { fileIndexLookup.Add(files[i], i); writer.WriteLine($@"""{Path.GetFileName(projectDestinationFolder)}/{files[i]}"","); } writer.WriteLine("];"); writer.WriteLine("var m = new Object();"); foreach (var kvp in symbolIDToListOfLocationsMap.OrderBy(kvp => kvp.Key)) { string shortenedKey = GetShortenedKey(kvp.Key); var filePaths = kvp.Value; if (filePaths.Count() == 1) { var value = filePaths.First(); writer.WriteLine("m[\"" + shortenedKey + "\"]=f[" + fileIndexLookup[value].ToString() + "];"); } else { writer.WriteLine("m[\"" + shortenedKey + "\"]=\"" + Constants.PartialResolvingFileName + "/" + kvp.Key + "\";"); Markup.GeneratePartialTypeDisambiguationFile( solutionDestinationFolder, projectDestinationFolder, kvp.Key, filePaths); } } writer.WriteLine("return {{map: m, bytes: {0} }};", SignificantIdBytes); writer.WriteLine("})();"); }