private ActionResult HandleFound(IWinDbgBackend backend, ImageFile imageFile) { backend.LogImageFileFound(imageFile); string url = backend.GetImageFileLink(ref imageFile); return(Redirect(url)); }
private ActionResult HandleNotFound(IWinDbgBackend backend, string name, string hash, string imageName) { //TODO: czy tutaj nie lepiej logować name niż imageName? backend.LogImageFileNotFound(imageName, hash); Response.StatusCode = 404; return(Content(string.Format("{0} ({1}) not found", name, hash))); }
private ActionResult HandleNotFound(IWinDbgBackend backend, string name, string hash, string imageName) { //TODO: czy tutaj nie lepiej logować name niż imageName? backend.LogImageFileNotFound(imageName, hash); Response.StatusCode = 404; return Content(string.Format("{0} ({1}) not found", name, hash)); }
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 ActionResult HandleFound(IWinDbgBackend backend, string company, string login, string password, ImageFile imageFile) { backend.LogImageFileFound(imageFile); var routeData = new { company, login, password, imageName = imageFile.Name, pdbHash = imageFile.SymbolHash, sourcePath = "XVAR2X", computerName = "XCNX", computerUser = "******", }; var url = Request.Url.GetLeftPart(UriPartial.Authority) + Url.RouteUrl("Source", routeData); return PdbFile(backend, imageFile, url); }
private ActionResult HandleFound(IWinDbgBackend backend, string company, string login, string password, ImageFile imageFile) { backend.LogImageFileFound(imageFile); var routeData = new { company, login, password, imageName = imageFile.Name, pdbHash = imageFile.SymbolHash, sourcePath = "XVAR2X", computerName = "XCNX", computerUser = "******", }; var url = Request.Url.GetLeftPart(UriPartial.Authority) + Url.RouteUrl("Source", routeData); return(PdbFile(backend, imageFile, url)); }
private ActionResult HandleFound(IWinDbgBackend backend, ImageFile imageFile) { backend.LogImageFileFound(imageFile); string url = backend.GetImageFileLink(ref imageFile); return Redirect(url); }
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); } }