private ActionResult PdbFile(IWinDbgBackend backend, ImageFile imageFile, string sourcePath) { var directoryPathTemp = Path.Combine(Path.GetTempPath(), "hss-temp-" + Path.GetRandomFileName()); Directory.CreateDirectory(directoryPathTemp); var link = backend.GetSymbolFileLink(ref imageFile); var tempPath = Path.Combine(directoryPathTemp, imageFile.Name + ".pdb"); var temp2Path = Path.Combine(directoryPathTemp, imageFile.Name + ".pd_"); try { DownloadFile(link, tempPath); var pdbstr = new PdbSrcSrvSection(); pdbstr.Ini.Add("VERSION", "2"); pdbstr.Ini.Add("INDEXVERSION", "2"); //TODO: jaka jest idea tych podmian, zamiast od razu wkleić %cośtam%? pdbstr.Variables.Add("SRCSRVTRG", sourcePath.Replace("XVAR2X", "%var2%").Replace("XCNX", "%CN%").Replace("XUNX", "%UN%")); pdbstr.Variables.Add("SRCSRVCMD", string.Empty); pdbstr.Variables.Add("UN", "%USERNAME%"); pdbstr.Variables.Add("CN", "%COMPUTERNAME%"); pdbstr.Variables.Add("SRCSRVVERCTRL", "http"); pdbstr.Variables.Add("SRCSRVERRVAR", "var2"); pdbstr.Ini.Add("VERCTRL", "http"); var sources = backend.GetSourceFileList(ref imageFile); foreach (var source in sources) { pdbstr.Sources.Add(new[] { source.OriginalPath, source.Path, source.Hash }); } pdbStoreManager.WriteSrcSrv(tempPath, pdbstr); fileCompressor.Compress(tempPath, temp2Path); return(File(System.IO.File.ReadAllBytes(temp2Path), "application/octet-stream")); } finally { System.IO.File.Delete(tempPath); System.IO.File.Delete(temp2Path); Directory.Delete(directoryPathTemp); } }
private PdbSrcSrvSection CreatePdbStrSection(IBinaryInfo binaryInfo) { var pdbstr = new PdbSrcSrvSection(); pdbstr.Ini.Add("VERSION", "2"); pdbstr.Ini.Add("INDEXVERSION", "2"); pdbstr.Variables.Add("SRCSRVTRG", configuration.ServerUrl + "/src/%fnfile%(%var1%)/%var2%/%fnfile%(%var1%)"); pdbstr.Variables.Add("SRCSRVCMD", string.Empty); pdbstr.Variables.Add("SRCSRVVERCTRL", "http"); pdbstr.Ini.Add("VERCTRL", "http"); foreach (var source in binaryInfo.SymbolInfo.SourceInfos) { pdbstr.Sources.Add(new[] { source.OriginalPath, source.Hash }); } return(pdbstr); }