private void ExtractResults(XmlReader reader, ResultFile trx) { if (reader.ReadToFollowing("Results")) { if (reader.ReadToDescendant("UnitTestResult")) { do { TestResult item = new TestResult(); item.ExecutionId = Guid.Parse(reader.GetAttribute("executionId")); item.TestId = Guid.Parse(reader.GetAttribute("testId")); item.TestName = reader.GetAttribute("testName"); item.Duration = reader.GetAttribute("duration"); item.Outcome = reader.GetAttribute("outcome"); item.TestListId = Guid.Parse(reader.GetAttribute("testListId")); item.ComputerName = reader.GetAttribute("computerName"); item.StartTime = reader.GetAttribute("startTime"); item.EndTime = reader.GetAttribute("endTime"); item.RelativeResultDirectory = Guid.Parse(reader.GetAttribute("relativeResultsDirectory")); using (XmlReader errorReader = reader.ReadSubtree()) { if (errorReader.ReadToFollowing("Message")) { item.ErrorMessage = reader.ReadElementContentAsString(); if (errorReader.ReadToNextSibling("StackTrace")) { item.StackTrace = errorReader.ReadElementContentAsString(); } } } trx.Results.Add(item); }while (reader.ReadToNextSibling("UnitTestResult")); } } }
public void Parse() { Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ParallelTestRunner.Tests.Resources.testXml.trx"); ResultFile file = target.Parse(stream); Assert.AreEqual(start, file.Summary.StartTime); Assert.AreEqual(finish, file.Summary.FinishTime); Assert.AreEqual(2, file.Results.Count); Assert.AreEqual(unitTest1Id, file.Results[0].TestId); Assert.AreEqual(TestName, file.Results[0].TestName); Assert.AreEqual(Duration, file.Results[0].Duration); Assert.AreEqual(ClassName, file.Results[0].ClassName); Assert.AreEqual(ErrorMessage, file.Results[1].ErrorMessage); Assert.AreEqual(StackTrace, file.Results[1].StackTrace); Assert.AreEqual("Passed", file.Results[0].Outcome); Assert.AreEqual("Failed", file.Results[1].Outcome); Assert.AreEqual(1, file.Summary.Total); Assert.AreEqual(2, file.Summary.Executed); Assert.AreEqual(3, file.Summary.Passed); Assert.AreEqual(4, file.Summary.Failed); Assert.AreEqual(5, file.Summary.Error); Assert.AreEqual(6, file.Summary.Timeout); Assert.AreEqual(7, file.Summary.Aborted); Assert.AreEqual(8, file.Summary.Inconclusive); Assert.AreEqual(9, file.Summary.PassedButRunAborted); Assert.AreEqual(10, file.Summary.NotRunnable); Assert.AreEqual(11, file.Summary.NotExecuted); Assert.AreEqual(12, file.Summary.Disconnected); Assert.AreEqual(13, file.Summary.Warning); Assert.AreEqual(14, file.Summary.Completed); Assert.AreEqual(15, file.Summary.InProgress); Assert.AreEqual(16, file.Summary.Pending); Assert.AreEqual(1, file.StdOut.Count); }
private void ExtractSummary(XmlReader reader, ResultFile trx) { if (reader.ReadToFollowing("ResultSummary")) { ResultSummary item = trx.Summary; item.Outcome = reader.GetAttribute("outcome"); if (reader.ReadToFollowing("Counters")) { item.Total = int.Parse(reader.GetAttribute("total")); item.Executed = int.Parse(reader.GetAttribute("executed")); item.Passed = int.Parse(reader.GetAttribute("passed")); item.Failed = int.Parse(reader.GetAttribute("failed")); item.Error = int.Parse(reader.GetAttribute("error")); item.Timeout = int.Parse(reader.GetAttribute("timeout")); item.Aborted = int.Parse(reader.GetAttribute("aborted")); item.Inconclusive = int.Parse(reader.GetAttribute("inconclusive")); item.PassedButRunAborted = int.Parse(reader.GetAttribute("passedButRunAborted")); item.NotRunnable = int.Parse(reader.GetAttribute("notRunnable")); item.NotExecuted = int.Parse(reader.GetAttribute("notExecuted")); item.Disconnected = int.Parse(reader.GetAttribute("disconnected")); item.Warning = int.Parse(reader.GetAttribute("warning")); item.Completed = int.Parse(reader.GetAttribute("completed")); item.InProgress = int.Parse(reader.GetAttribute("inProgress")); item.Pending = int.Parse(reader.GetAttribute("pending")); } if (reader.ReadToFollowing("StdOut")) { do { trx.StdOut.Add(reader.ReadElementContentAsString()); }while (reader.ReadToNextSibling("StdOut")); } } }
private void ExtractDefinitions(XmlReader reader, ResultFile trx) { if (reader.ReadToFollowing("TestDefinitions")) { if (reader.ReadToDescendant("UnitTest")) { do { var testId = Guid.Parse(reader.GetAttribute("id")); var tempResult = trx.Results.First(result => result.TestId == testId); tempResult.Storage = reader.GetAttribute("storage"); if (reader.ReadToFollowing("TestMethod")) { tempResult.CodeBase = reader.GetAttribute("codeBase"); tempResult.AdapterTypeName = reader.GetAttribute("adapterTypeName"); tempResult.ClassName = reader.GetAttribute("className"); } reader.ReadToNextSibling("UnitTest"); }while (reader.ReadToNextSibling("UnitTest")); } } }
//public SortedList GetResults(string searchterm, Catalog catalog, bool geolocOnly) //{ // return GetResults(searchterm, catalog, false, new Cache()); //} /// <summary> /// v6 /// </summary> /// <param name="searchterm">search query</param> /// <param name="catalog">catalog to search</param> /// <param name="geolocOnly">If true, ONLY return results with a lat/long</param> /// <param name="cache">Cache of page 'content'</param> /// <returns>ResultFile SortedList for display</returns> public SortedList GetResults(string searchterm, Catalog catalog, bool geolocOnly) { SortedList output = new SortedList(); // ----------------------- DOING A SEARCH ----------------------- if ((null != searchterm) && (null != catalog)) { SetPreferences(); string[] searchTermArray = null, searchTermDisplay = null; /****** Too *********/ Regex r = new Regex(@"\s+"); //remove all whitespace searchterm = r.Replace(searchterm, " "); // to a single space searchTermArray = searchterm.Split(' '); // then split searchTermDisplay = (string[])searchTermArray.Clone(); for (int i = 0; i < searchTermArray.Length; i++) { if (_GoChecker.IsGoWord(searchTermArray[i])) { // was a Go word, just Lower it searchTermArray[i] = searchTermArray[i].ToLower(); } else { // Not a Go word, apply stemming searchTermArray[i] = searchTermArray[i].Trim(' ', '?', '\"', ',', '\'', ';', ':', '.', '(', ')').ToLower(); searchTermArray[i] = _Stemmer.StemWord(searchTermArray[i].ToString()); } } if (searchterm == String.Empty) { // After trimming the search term, it was found to be empty! return(output); } else { // we have a search term! DateTime start = DateTime.Now; // to show 'time taken' to perform search // Array of arrays of results that match ONE of the search criteria Dictionary <File, List <int> >[] searchResultsArrayArray = new Dictionary <File, List <int> > [searchTermArray.Length]; // finalResultsArray is populated with pages that *match* ALL the search criteria HybridDictionary finalResultsArray = new HybridDictionary(); bool botherToFindMatches = true; int indexOfShortestResultSet = -1, lengthOfShortestResultSet = -1; for (int i = 0; i < searchTermArray.Length; i++) { // ##### THE SEARCH ##### searchResultsArrayArray[i] = catalog.Search(searchTermArray[i].ToString()); if (null == searchResultsArrayArray[i]) { _Matches += searchTermDisplay[i] + " <font color=gray style='font-size:xx-small'>(not found)</font> "; botherToFindMatches = false; // if *any one* of the terms isn't found, there won't be a 'set' of Matches } else { int resultsInThisSet = searchResultsArrayArray[i].Count; _Matches += "<a href=\"?" + Preferences.QuerystringParameterName + "=" + searchTermDisplay[i] + "\" title=\"" + searchTermArray[i] + "\">" + searchTermDisplay[i] + "</a> <font color=gray style='font-size:xx-small'>(" + resultsInThisSet + ")</font> "; if ((lengthOfShortestResultSet == -1) || (lengthOfShortestResultSet > resultsInThisSet)) { indexOfShortestResultSet = i; lengthOfShortestResultSet = resultsInThisSet; } } } // Find the common files from the array of arrays of documents // matching ONE of the criteria if (botherToFindMatches) // all words have *some* matches { // for each result set [NOT required, but maybe later if we do AND/OR searches) int c = indexOfShortestResultSet; // loop through the *shortest* resultset Dictionary <File, List <int> > searchResultsArray = searchResultsArrayArray[c]; foreach (File foundInFile in searchResultsArray.Keys) // for each file in the *shortest* result set { //DictionaryEntry fo = (DictionaryEntry)foundInFile; // find matching files in the other resultsets int matchcount = 0, totalcount = 0, weight = 0; List <int> occurences = new List <int>(); for (int cx = 0; cx < searchResultsArrayArray.Length; cx++) { totalcount += (cx + 1); // keep track, so we can compare at the end (if term is in ALL resultsets) if (cx == c) // current resultset { matchcount += (cx + 1); // implicitly matches in the current resultset //weight += (int)fo.Value; // sum the weighting weight += searchResultsArray[foundInFile].Count; // sum the weighting occurences.AddRange(searchResultsArray[foundInFile]); } else { Dictionary <File, List <int> > searchResultsArrayx = searchResultsArrayArray[cx]; if (null != searchResultsArrayx) { foreach (File foundInFilex in searchResultsArrayx.Keys) { // for each file in the result set //DictionaryEntry fox = (DictionaryEntry)foundInFilex; //if (fo.Key == fox.Key) if (foundInFile == foundInFilex) { matchcount += (cx + 1); // and if it matches, track the matchcount //weight += (int)fox.Value; // and weighting; then break out of loop, since weight += searchResultsArrayx[foundInFilex].Count; occurences.AddRange(searchResultsArrayx[foundInFilex]); break; // no need to keep looking through this resultset } } // foreach } // if } // else } // for if ((matchcount > 0) && (matchcount == totalcount)) // was matched in each Array { // we build the finalResults here, to pass to the formatting code below // - we could do the formatting here, but it would mix up the 'result generation' // and display code too much //fo.Value = weight; // set the 'weight' in the combined results to the sum of individual document matches //if (!finalResultsArray.Contains(fo.Key)) finalResultsArray.Add(fo.Key, fo); if (!finalResultsArray.Contains(foundInFile)) { finalResultsArray.Add(foundInFile, occurences); //.Count } } // if } // foreach } // Time taken calculation Int64 ticks = DateTime.Now.Ticks - start.Ticks; TimeSpan taken = new TimeSpan(ticks); if (taken.Seconds > 0) { _DisplayTime = taken.Seconds + " seconds"; } else if (taken.TotalMilliseconds > 0) { _DisplayTime = Convert.ToInt32(taken.TotalMilliseconds) + " milliseconds"; } else { _DisplayTime = "less than 1 millisecond"; } // The preceding 80 lines (or so) replaces this single line from Version 1 // Hashtable searchResultsArray = m_catalog.Search (searchterm); // when only single-word-searches were supported. Look closely and you'll see this line // labelled #THE SEARCH# still in the code above... // Format the results if (finalResultsArray.Count > 0) { // intermediate data-structure for 'ranked' result HTML //SortedList output = new SortedList(finalResultsArray.Count); // empty sorted list // DictionaryEntry fo; ResultFile infile; // string result=""; int sortrank = 0; // build each result row foreach (object foundInFile in finalResultsArray.Keys) { // Create a ResultFile with it's own Rank infile = new ResultFile((File)foundInFile); // [v7] if we have a cache of the page's content, we'll display the relevant // text excerpt in the search results if (catalog.FileCache.Contains(infile.Url)) { string desc = ""; string[] words = catalog.FileCache.GetDocumentCache(infile.Url); int position = (words.Length / 2); // # find the position of a searched-for word here !!!!!!! if (words.Length < 10) { for (int i = 0; i < words.Length; i++) { desc += words[i] + " "; } } else { List <int> pos = (List <int>)finalResultsArray[foundInFile]; pos.Sort(); int q = 0; position = pos[q]; List <int> useablePos = new List <int>(); foreach (int p in pos) { if (p < (position + 50)) { useablePos.Add(p); } if (p > (position + 50)) { break; } } int lowerBound = (position < 24) ? position : 24; int upperBound = (position < 24) ? 48 - position : 24; lowerBound = position - lowerBound; upperBound = position + upperBound; if (upperBound > words.Length) { upperBound = words.Length - 1; } for (int i = lowerBound; i < upperBound; i++) { if (i == position) { desc += "<b>"; } desc += words[i] + " "; if (i == position) { desc += "</b>"; q++; if (q < pos.Count) { position = pos[q]; } } } } infile.Description = desc; } if (geolocOnly && (infile.GpsLocation == null || infile.GpsLocation == new Location())) { // don't add this ResultFile to output [v6] } else { // Jim Harkins [sort for paging] ported from VB to C# // http://www.codeproject.com/aspnet/spideroo.asp#xx927327xx //infile.Rank = (int)((DictionaryEntry)finalResultsArray[foundInFile]).Value; infile.Rank = (int)((List <int>)finalResultsArray[foundInFile]).Count; sortrank = infile.Rank * -1000; // Assume not 'thousands' of results if (output.Contains(sortrank)) { // rank exists - drop key index one number until it fits for (int i = 1; i < 999; i++) { sortrank++; if (!output.Contains(sortrank)) { output.Add(sortrank, infile); if (infile.GpsLocation != null) { _GeolocCount += 1; } break; } } } else { output.Add(sortrank, infile); if (infile.GpsLocation != null) { _GeolocCount += 1; } } } sortrank = 0; // reset for next pass } // Jim Harkins [paged results] // http://aspnet.4guysfromrolla.com/articles/081804-1.aspx } // else Count == 0, so output SortedList will be empty } } return(output); }
/// <summary> /// Получение полей(Перегрузка). /// </summary> /// <param name="result"><see cref="ResultFile"/></param> /// <returns>Строка.</returns> public static string GetPropertys(ResultFile result) => Task.Run(() => String.Format("{0,-20}{1,-30}{2,-30}{3,-20}", result.Name, result.Department, result.Type, result.Price)).Result;
protected override void DoTest() { const string viewName = "TicNormalizationTestView"; RunUI(() => { SkylineWindow.OpenFile(TestFilesDir.GetTestPath("TicNormalizationTest.sky")); SkylineWindow.ShowDocumentGrid(true); }); WaitForDocumentLoaded(); var documentGrid = FindOpenForm <DocumentGridForm>(); RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Proteins)); WaitForConditionUI(() => documentGrid.IsComplete); RunDlg <ViewEditor>(documentGrid.NavBar.CustomizeView, viewEditor => { viewEditor.ChooseColumnsTab.RemoveColumns(0, viewEditor.ChooseColumnsTab.ColumnCount); var ppPeptides = PropertyPath.Root.Property(nameof(SkylineDocument.Proteins)).LookupAllItems() .Property(nameof(Protein.Peptides)).LookupAllItems(); var ppReplicates = PropertyPath.Root.Property(nameof(SkylineDocument.Replicates)).LookupAllItems(); var ppPeptideResult = ppPeptides.Property(nameof(Peptide.Results)).DictionaryValues(); var ppFiles = ppReplicates.Property(nameof(Replicate.Files)).LookupAllItems(); viewEditor.ChooseColumnsTab.AddColumn(ppPeptides); viewEditor.ChooseColumnsTab.AddColumn(ppReplicates); viewEditor.ChooseColumnsTab.AddColumn(ppFiles); viewEditor.ChooseColumnsTab.AddColumn(ppFiles.Property(nameof(ResultFile.TicArea))); viewEditor.ChooseColumnsTab.AddColumn(ppPeptideResult.Property(nameof(PeptideResult.Quantification)) .Property(nameof(QuantificationResult.NormalizedArea))); viewEditor.ViewName = viewName; viewEditor.OkDialog(); }); var unnormalizedAreas = ReadNormalizedAreas(documentGrid) .ToDictionary(tuple => Tuple.Create(tuple.Item1.IdentityPath, tuple.Item2.FilePath), tuple => tuple.Item3); RunDlg <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI, peptideSettingsUi => { peptideSettingsUi.SelectedTab = PeptideSettingsUI.TABS.Quantification; peptideSettingsUi.QuantNormalizationMethod = NormalizationMethod.TIC; peptideSettingsUi.OkDialog(); }); var medianTicArea = new Statistics(SkylineWindow.Document.MeasuredResults.Chromatograms .SelectMany(chromSet => chromSet.MSDataFileInfos.Select(chromFileInfo => chromFileInfo.TicArea)) .OfType <double>()).Median(); foreach (var tuple in ReadNormalizedAreas(documentGrid)) { var key = Tuple.Create(tuple.Item1.IdentityPath, tuple.Item2.FilePath); string message = key.ToString(); ResultFile resultFile = tuple.Item2; double? unnormalizedArea; Assert.IsTrue(unnormalizedAreas.TryGetValue(key, out unnormalizedArea), message); if (!unnormalizedArea.HasValue) { Assert.IsNull(tuple.Item3, message); } else { Assert.IsNotNull(tuple.Item3, message); var expectedArea = unnormalizedArea * medianTicArea / resultFile.TicArea; Assert.IsNotNull(expectedArea, message); Assert.AreEqual(expectedArea.Value, tuple.Item3.Value, 1e-4, message); } } RunUI(() => SkylineWindow.ShowPeakAreaCVHistogram()); var graphHistogram = FindGraph <AreaCVHistogramGraphPane>(); Assert.IsNotNull(graphHistogram); RunUI(() => { var areaCvToolbar = (AreaCVToolbar)graphHistogram.Toolbar; int indexTic = areaCvToolbar.NormalizationMethods.ToList() .IndexOf(NormalizationMethod.TIC.NormalizeToCaption); Assert.IsTrue(indexTic >= 0); areaCvToolbar.SetNormalizationIndex(indexTic); SkylineWindow.UpdateGraphPanes(); }); WaitForGraphs(); AreaCVHistogramGraphPane areaCvHistogramGraphPane; Assert.IsTrue(graphHistogram.TryGetGraphPane(out areaCvHistogramGraphPane)); WaitForConditionUI(() => areaCvHistogramGraphPane.CurrentData != null); foreach (var cvData in areaCvHistogramGraphPane.CurrentData.Data) { foreach (var peptideAnnotationPair in cvData.PeptideAnnotationPairs) { var values = new List <double>(); var results = peptideAnnotationPair.TransitionGroup.Results; for (int replicateIndex = 0; replicateIndex < results.Count; replicateIndex++) { foreach (var transitionGroupChromInfo in results[replicateIndex]) { if (!transitionGroupChromInfo.Area.HasValue) { continue; } var fileInfo = SkylineWindow.Document.MeasuredResults.Chromatograms[replicateIndex] .GetFileInfo(transitionGroupChromInfo.FileId); Assert.IsNotNull(fileInfo); Assert.IsNotNull(fileInfo.TicArea); values.Add(transitionGroupChromInfo.Area.Value / fileInfo.TicArea.Value); } } var stats = new Statistics(values); var expectedCV = stats.StdDev() / stats.Mean(); Assert.AreEqual(expectedCV, peptideAnnotationPair.CVRaw, .001, "TransitionGroup: {0}", peptideAnnotationPair.TransitionGroup); } } }
public PrecursorResult(Precursor precursor, ResultFile file) : base(precursor, file) { _chromInfo = CachedValue.Create(DataSchema, ()=>GetResultFile().FindChromInfo(precursor.DocNode.Results)); }
public IActionResult CompletedProcess(string scanId, [FromBody] CompletedCallback scanResults) { // Do something with the scan results ResultFile.SaveResults(scanResults, scanId); return(Ok()); }
protected Result(SkylineDocNode docNode, ResultFile resultFile) : base(docNode.DataSchema) { SkylineDocNode = docNode; _resultFile = resultFile; }
public PeptideResult(Peptide peptide, ResultFile file) : base(peptide, file) { _chromInfo = CachedValue.Create(DataSchema, () => ResultFile.FindChromInfo(peptide.DocNode.Results)); _quantificationResult = CachedValue.Create(DataSchema, GetQuantification); }
public ProteinResult(Protein protein, ResultFile resultFile) : base(protein, resultFile) { }
public void WriteFile() { Stream stream = new MemoryStream(); bool haveFailedTests = target.WriteFile(files, stream); Assert.IsTrue(haveFailedTests); stream.Position = 0; ResultFile result = parser.Parse(stream); Assert.AreEqual(111, result.Summary.Total); Assert.AreEqual(222, result.Summary.Executed); Assert.AreEqual(333, result.Summary.Passed); Assert.AreEqual(444, result.Summary.Failed); Assert.AreEqual(555, result.Summary.Error); Assert.AreEqual(666, result.Summary.Timeout); Assert.AreEqual(777, result.Summary.Aborted); Assert.AreEqual(888, result.Summary.Inconclusive); Assert.AreEqual(999, result.Summary.PassedButRunAborted); Assert.AreEqual(1110, result.Summary.NotRunnable); Assert.AreEqual(2220, result.Summary.NotExecuted); Assert.AreEqual(3330, result.Summary.Disconnected); Assert.AreEqual(4440, result.Summary.Warning); Assert.AreEqual(5550, result.Summary.Completed); Assert.AreEqual(6660, result.Summary.InProgress); Assert.AreEqual(7770, result.Summary.Pending); Assert.AreEqual("Failed", result.Summary.Outcome); Assert.AreEqual(new DateTime(2001, 1, 21), result.Summary.StartTime); Assert.AreEqual(new DateTime(2003, 1, 22), result.Summary.FinishTime); Assert.IsNotNull(result.Results); Assert.AreEqual(9, result.Results.Count); TestResult item; item = result.Results[0]; Assert.AreEqual("TEST_A1", item.TestName); Assert.AreEqual("CLASS_A1", item.ClassName); Assert.AreEqual("DURATION_A1", item.Duration); Assert.AreEqual("OUTCOME_A1", item.Outcome); Assert.IsNull(item.ErrorMessage); Assert.IsNull(item.StackTrace); item = result.Results[1]; Assert.AreEqual("TEST_A2", item.TestName); Assert.AreEqual("CLASS_A2", item.ClassName); Assert.AreEqual("DURATION_A2", item.Duration); Assert.AreEqual("OUTCOME_A2", item.Outcome); Assert.AreEqual("ERROR_A2", item.ErrorMessage); Assert.AreEqual("STACK_TRACE_A2", item.StackTrace); item = result.Results[2]; Assert.AreEqual("TEST_A3", item.TestName); Assert.AreEqual("CLASS_A3", item.ClassName); Assert.AreEqual("DURATION_A3", item.Duration); Assert.AreEqual("OUTCOME_A3", item.Outcome); Assert.IsNull(item.ErrorMessage); Assert.IsNull(item.StackTrace); item = result.Results[3]; Assert.AreEqual("TEST_B1", item.TestName); Assert.AreEqual("CLASS_B1", item.ClassName); Assert.AreEqual("DURATION_B1", item.Duration); Assert.AreEqual("OUTCOME_B1", item.Outcome); Assert.IsNull(item.ErrorMessage); Assert.IsNull(item.StackTrace); item = result.Results[4]; Assert.AreEqual("TEST_B2", item.TestName); Assert.AreEqual("CLASS_B2", item.ClassName); Assert.AreEqual("DURATION_B2", item.Duration); Assert.AreEqual("OUTCOME_B2", item.Outcome); Assert.AreEqual("ERROR_B2", item.ErrorMessage); Assert.AreEqual("STACK_TRACE_B2", item.StackTrace); item = result.Results[5]; Assert.AreEqual("TEST_B3", item.TestName); Assert.AreEqual("CLASS_B3", item.ClassName); Assert.AreEqual("DURATION_B3", item.Duration); Assert.AreEqual("OUTCOME_B3", item.Outcome); Assert.IsNull(item.ErrorMessage); Assert.IsNull(item.StackTrace); item = result.Results[6]; Assert.AreEqual("TEST_C1", item.TestName); Assert.AreEqual("CLASS_C1", item.ClassName); Assert.AreEqual("DURATION_C1", item.Duration); Assert.AreEqual("OUTCOME_C1", item.Outcome); Assert.IsNull(item.ErrorMessage); Assert.IsNull(item.StackTrace); item = result.Results[7]; Assert.AreEqual("TEST_C2", item.TestName); Assert.AreEqual("CLASS_C2", item.ClassName); Assert.AreEqual("DURATION_C2", item.Duration); Assert.AreEqual("OUTCOME_C2", item.Outcome); Assert.AreEqual("ERROR_C2", item.ErrorMessage); Assert.AreEqual("STACK_TRACE_C2", item.StackTrace); item = result.Results[8]; Assert.AreEqual("TEST_C3", item.TestName); Assert.AreEqual("CLASS_C3", item.ClassName); Assert.AreEqual("DURATION_C3", item.Duration); Assert.AreEqual("OUTCOME_C3", item.Outcome); Assert.IsNull(item.ErrorMessage); Assert.IsNull(item.StackTrace); }
public override int GetHashCode() { int result = 17; unchecked { if (AnalysisTarget != null) { result = (result * 31) + AnalysisTarget.GetHashCode(); } if (ResultFile != null) { result = (result * 31) + ResultFile.GetHashCode(); } if (LogicalLocation != null) { foreach (var value_0 in LogicalLocation) { result = result * 31; if (value_0 != null) { result = (result * 31) + value_0.GetHashCode(); } } } if (FullyQualifiedLogicalName != null) { result = (result * 31) + FullyQualifiedLogicalName.GetHashCode(); } if (Properties != null) { // Use xor for dictionaries to be order-independent. int xor_0 = 0; foreach (var value_1 in Properties) { xor_0 ^= value_1.Key.GetHashCode(); if (value_1.Value != null) { xor_0 ^= value_1.Value.GetHashCode(); } } result = (result * 31) + xor_0; } if (Tags != null) { foreach (var value_2 in Tags) { result = result * 31; if (value_2 != null) { result = (result * 31) + value_2.GetHashCode(); } } } } return(result); }
private async Task <string> UploadSingleAuditFile(SubscriptionScanDetails details, string folder, CancellationToken cancellation, ResultFile resultFile) { var auditPath = $"{folder}/{resultFile.FileName}"; Logger.Information("Uploading scan result for {AzureSubscription} to {AuditPath}", details.Subscription, auditPath); var resultUrl = new Uri($"{this.blobCfg.BasePath}/{auditPath}?{this.blobCfg.Sas}"); var resultBlob = new CloudBlockBlob(resultUrl); await resultBlob.UploadFromFileAsync( resultFile.FullPath, AccessCondition.GenerateEmptyCondition(), new BlobRequestOptions { RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(10), 3), }, new OperationContext(), cancellation); return(auditPath); }
protected override void Render(HtmlTextWriter writer) { base.Render(writer); if (File.Exists(GeneralConfig.Instance.PaperResultTempSavePath + fileId+".rst")) { result = ResultFile.Load(fileId); if (result == null) { writer.WriteLine("���ؽ���ļ�ʧ�ܣ�"); return; } paper = PaperFile.Load(result.SN); if (String.IsNullOrEmpty(industry)) { industry = result.UserInfo.Industry; } if (showDetails>0 && (result.Status == ResultStatus.None || result.Status == ResultStatus.Cancled)) { if (Member.TempInfo == null) { Member.SetTempInfo(); } MemberTempInfo.Set(result.SN.ToString(), result.FileId, result.LastModule.Id, result.LastQuestion.Id); writer.WriteLine("<p style=\"line-height:100px;\" class=\"alignCenter\"><img src=\"/images/bmce_unfinish.jpg\" /><br/>���ʾ���δ��ɣ���<a href=\"/bmce\">��������������ʾ�</a></p>"); return; } //��ʾͼ�� string swfParams = "idx=" + result.RelativeScore.ToString() + "&"; swfParams += "com=" + (String.IsNullOrEmpty(result.UserInfo.Name) ? "δ����" : HttpContext.Current.Server.UrlEncode(result.UserInfo.Name)) + "&"; swfParams += "dt=" + result.Update.ToShortDateString() + "&"; for (int i = 0; i < result.Modules.Count; i++) { swfParams += "c" + (i + 1).ToString() + "=" + ((ResultModule)result.Modules[i]).RelativeScore.ToString() + "&"; } writer.WriteLine("<div class=\"chart\">"); writer.WriteLine(" <h1>Ʒ�ƹ�������ָ������</h1>"); writer.WriteLine(" <div class=\"alignCenter\">"); writer.WriteLine(" <script>FlashPlayer('/images/charts/" + paper.SN.ToString() + ".swf?" + swfParams + "',680,450);</script>"); writer.WriteLine(" </div>"); writer.WriteLine("</div>"); if (showDetails == 0) { writer.WriteLine("<div class=\"result\">"); writer.WriteLine(" <h1>��ʼʱ�䣺" + result.Begin.ToString() + " ������ʱ�䣺" + result.Update.ToString() + " ��ǰ״̬:" + result.Status.ToString() + "<br/> ��Դ:" + result.RefUrl + "</h1>"); writer.WriteLine(" <div>��ҵ���ϣ�"); writer.WriteLine(" <ul id=\"COMINFO\" style=\"display:;\">"); writer.WriteLine(" <li><a href=\"../user/companyDetails.aspx?id=" + result.UserInfo.Id.ToString() + "\">�鿴��ҵ��ϸ��Ϣ</a></li>"); writer.WriteLine(" <li>������ҵ��" + IndustryUtil.GetName(result.UserInfo.Industry) + "</li>"); writer.WriteLine(" <li>��ҵ���ʣ�" + CompanyNature.Get(result.UserInfo.Nature) + "</li>"); writer.WriteLine(" <li>Ա����ģ��" + result.UserInfo.Employee.ToString() + " ��</li>"); writer.WriteLine(" <li>��Ӫҵ�" + result.UserInfo.Turnover.ToString() + " ��</li>"); writer.WriteLine(" <li>-------------------------------------</li>"); writer.WriteLine(" <li>��ʼ���ƣ�" + result.UserInfo.Name + "</li>"); writer.WriteLine(" <li>��ʼ�ʼ���" + result.UserInfo.Email + "</li>"); if (result.UserInfo.Id > 0) { writer.WriteLine(" <li>ע���ʼ���" + Member.Get(result.UserInfo.Id).Email + "</li>"); Company com = Company.Get(result.UserInfo.Id); if (com != null) { writer.WriteLine(" <li>ע�����ƣ�" + com.ComName + "</li>"); } } writer.WriteLine(" <li>�� ϵ �ˣ�" + result.UserInfo.Contact + "</li>"); writer.WriteLine(" <li>��ϵ�绰��" + result.UserInfo.Phone + "</li>"); writer.WriteLine(" <li>���ڲ��ţ�" + result.UserInfo.Position + "</li>"); writer.WriteLine(" <li>������飺" + result.UserInfo.Remark + "</li>"); writer.WriteLine(" </ul>"); writer.WriteLine(" </div>"); writer.WriteLine("</div>"); } //�ʾ��ܽ� writer.WriteLine("<div class=\"paper\">"); if (paper.CalcMethod == ScoreCalcMethod.Absolute) { writer.WriteLine(" <h1>�ʾ��" + paper.Title + (!showScore ? "<img src=\"/skin/blank.gif\" class=\"scoreLevel_" + result.GetLevel(paper).ToString() + "\" />" : "[�÷֣�" + result.RealScore.ToString() + "" + (showDetails == 0 ? "(��Է�:" + result.RelativeScore.ToString() + ")" : "") + " <img src=\"../skin/blank.gif\" class=\"scoreLevel_" + result.GetLevel(paper).ToString() + "\" />]") + "</h1>"); } else { writer.WriteLine(" <h1>�ʾ��" + paper.Title + (!showScore ? "<img src=\"/skin/blank.gif\" class=\"scoreLevel_" + result.GetLevel(paper).ToString() + "\" />" : "[�÷֣�" + result.RelativeScore.ToString() + "" + (showDetails == 0 ? "(���Է�:" + result.RealScore.ToString() + ")" : "") + " <img src=\"../skin/blank.gif\" class=\"scoreLevel_" + result.GetLevel(paper).ToString() + "\" />]") + "</h1>"); } ConclusionFile conclusion = result.GetConclusion(paper); if (showDetails >= 0) { writer.WriteLine("<div class=\"conclusion\">���� " + result.Begin.ToString() + " ��ʼ������ԣ��� " + result.Update.ToString() + " ����˲��ԡ�<br/>"); } writer.WriteLine("<div class=\"tag\"><img src=\"/skin/icon_c1.gif\" alt=\"��������\" /></div>"); writer.WriteLine(conclusion == null ? "" : "����" + Util.Utility.UBB2Html(conclusion.Content)); if (conclusion.Additives != null) { foreach (AdditiveConclusion addConclusion in conclusion.Additives) { writer.WriteLine("<p>" + "����" + Util.Utility.UBB2Html(addConclusion.Content) + "</p>"); } } //��ҵ���� if (!String.IsNullOrEmpty(industry)) { string industryConclusion = Conclusion.GetIndustryConclusion(industry); if (!String.IsNullOrEmpty(industryConclusion)) { writer.WriteLine("<p>" + "����" + industryConclusion + "</p>"); } } //������� if (conclusion != null) { if (!String.IsNullOrEmpty(conclusion.Advice)) { writer.WriteLine("<p class=\"tag\"><img src=\"/skin/icon_c2.gif\" alt=\"����\" /></p>"); writer.WriteLine("����" + Util.Utility.UBB2Html(conclusion.Advice)); } } writer.WriteLine("</div>"); writer.WriteLine("</div>"); foreach (ResultModule module in result.Modules) { if (showDetails==0)//��ʾϸ�� { writer.WriteLine("<div class=\"module\">"); writer.WriteLine(" <h1>" + GetModuleTitle(module.Id) + " [ʵ�ʵ÷�:" + module.RealScore.ToString() + " ��Է�:" + module.RelativeScore.ToString() + " <img src=\"../skin/blank.gif\" class=\"scoreLevel_" + module.GetLevel(paper).ToString() + "\" />]</h1>"); writer.WriteLine(" <div class=\"question\">"); foreach (ResultQuestion question in module.Questions) { writer.WriteLine(" <h1>���⣺" + question.Title + "</h1>"); writer.WriteLine(" <ul>"); foreach (ResultAnswer answer in question.Answers) { writer.WriteLine(" <li" + (answer.Checked ? " class=\"checked\"" : "") + ">" + answer.Title + "</li>"); } writer.WriteLine(" </ul>"); } writer.WriteLine(" </div>"); //���ģ����� if (module.Score > 0) { writer.WriteLine(" <div class=\"conclusion\">"); writer.WriteLine(" <h1><img src=\"/skin/icon_c3.gif\" alt=\"����\" /></h1>"); ConclusionFile cf = module.GetConclusion(paper); if (cf != null) { writer.Write("����" + Util.Utility.UBB2Html(cf.Content)); } writer.WriteLine(" </div>"); } writer.WriteLine("</div>"); } else if (showDetails == 1 && module.Score > 0)//������ʾ������module.Score==0��ģ�� { writer.WriteLine("<div class=\"module\">"); if (showScore) { writer.WriteLine(" <h1>" + GetModuleTitle(module.Id) + " [�÷�:" + (paper.CalcMethod == ScoreCalcMethod.Relative ? module.RelativeScore.ToString() : module.RealScore.ToString()) + " <img src=\"../skin/blank.gif\" class=\"scoreLevel_" + module.GetLevel(paper).ToString() + "\" />]</h1>"); } else { writer.WriteLine(" <h1>" + GetModuleTitle(module.Id) + " <img src=\"/skin/blank.gif\" class=\"scoreLevel_" + module.GetLevel(paper).ToString() + "\" /></h1>"); } writer.WriteLine(" <div class=\"question\">"); foreach (ResultQuestion question in module.Questions) { writer.WriteLine(" <h1>���⣺" + question.Title + "</h1>"); writer.WriteLine(" <ul>"); int chkNum = 0; foreach (ResultAnswer answer in question.Answers) { if (answer.Checked) { writer.WriteLine(" <li>" + answer.Title + "</li>"); chkNum++; } } if (chkNum == 0) { writer.WriteLine(" <li><��></li>"); } writer.WriteLine(" </ul>"); } writer.WriteLine(" </div>"); //���ģ����� if (module.Score > 0) { writer.WriteLine(" <div class=\"conclusion\">"); writer.WriteLine(" <h1><img src=\"/skin/icon_c3.gif\" alt=\"����\" /></h1>"); ConclusionFile cf = module.GetConclusion(paper); if (cf != null) { writer.Write("����" + Util.Utility.UBB2Html(cf.Content)); } writer.WriteLine(" </div>"); } writer.WriteLine("</div>"); } else if (showDetails == 2 && module.Score > 0)//�����ʾ������module.Score==0��ģ�� { writer.WriteLine("<div class=\"module\">"); if (showScore) { writer.WriteLine(" <h1>" + GetModuleTitle(module.Id) + " [�÷�:" + (paper.CalcMethod == ScoreCalcMethod.Relative ? module.RelativeScore.ToString() : module.RealScore.ToString()) + " <img src=\"../skin/blank.gif\" class=\"scoreLevel_" + module.GetLevel(paper).ToString() + "\" />]</h1>"); } else { writer.WriteLine(" <h1>" + GetModuleTitle(module.Id) + " <img src=\"/skin/blank.gif\" class=\"scoreLevel_" + module.GetLevel(paper).ToString() + "\" /></h1>"); } //���ģ����� if (module.Score > 0) { writer.WriteLine(" <div class=\"conclusion\">"); writer.WriteLine(" <h1><img src=\"/skin/icon_c3.gif\" alt=\"����\" /></h1>"); ConclusionFile cf = module.GetConclusion(paper); if (cf != null) { writer.Write("����" + Util.Utility.UBB2Html(cf.Content)); } writer.WriteLine(" </div>"); } writer.WriteLine("</div>"); } } if (showDetails > 0 && !disableFeedback) { bool hasRemark = false; if (result.UserInfo != null) { if (!String.IsNullOrEmpty(result.UserInfo.Remark)) { hasRemark = true; } } if (!hasRemark) { writer.WriteLine("<div id=\"RemarkPannel\">"); writer.WriteLine("<div>����������ǵIJ������κ�������߽��飬�Լ��κ����������⣬�����·�����������(300��)��</div>"); writer.WriteLine("<div>"); writer.WriteLine("<textarea name=\"Remark\" rows=\"5\" cols=\"50\"></textarea>"); writer.WriteLine("</div>"); writer.WriteLine("<div class=\"alignCenter\">"); writer.WriteLine("<input type=\"hidden\" name=\"ResultSN\" value=\""+result.SN.ToString()+"\" />"); writer.WriteLine("<input type=\"hidden\" name=\"ResultGuid\" value=\""+result.Guid+"\" />"); writer.WriteLine("<input type=\"hidden\" name=\"AjaxAction\" value=\"saveResultRemark\" />"); writer.WriteLine("<input type=\"button\" name=\"CmdSaveRemark\" value=\"��������\" class=\"cmdConfirm\" onclick=\"saveResultRemark(this);\" />"); writer.WriteLine("</div>"); writer.WriteLine("</div>"); } } } else { writer.WriteLine("δ�ҵ���صĽ���ļ���"); } }
public TransitionResult(Transition transition, ResultFile resultFile) : base(transition, resultFile) { _chromInfo = CachedValue.Create(DataSchema, () => GetResultFile().FindChromInfo(transition.DocNode.Results)); }
public ActionResult FetchZip() { //wtf microsoft use a string array Microsoft.Extensions.Primitives.StringValues _uuid; Microsoft.Extensions.Primitives.StringValues _packageset; Microsoft.Extensions.Primitives.StringValues _channel; Microsoft.Extensions.Primitives.StringValues _packages; Microsoft.Extensions.Primitives.StringValues _client; if (!Request.Headers.TryGetValue("SDSETUP-UUID", out _uuid)) { return(new StatusCodeResult(400)); } if (!Request.Headers.TryGetValue("SDSETUP-PACKAGESET", out _packageset)) { return(new StatusCodeResult(400)); } if (!Request.Headers.TryGetValue("SDSETUP-CHANNEL", out _channel)) { return(new StatusCodeResult(400)); } if (!Request.Headers.TryGetValue("SDSETUP-PACKAGES", out _packages)) { return(new StatusCodeResult(400)); } Request.Headers.TryGetValue("SDSETUP-CLIENT", out _client); // optional, currently only used by homebrew app to specify it only wants SD folder string uuid = _uuid[0]; string packageset = _packageset[0]; string channel = _channel[0]; string packages = _packages[0]; string client = null; if (_client.Count > 0 && !String.IsNullOrWhiteSpace(_client[0])) { client = _client[0]; } if (Program.uuidLocks.Contains(uuid)) { Response.StatusCode = Http.StatusCodes.Status423Locked; return(new ObjectResult("UUID " + uuid + " locked")); } else if (!Program.validChannels.Contains(channel)) { Response.StatusCode = Http.StatusCodes.Status401Unauthorized; return(new ObjectResult("Invalid channel")); } else if (!Directory.Exists((Program.FilesPath + "/" + packageset).AsPath())) { Response.StatusCode = Http.StatusCodes.Status400BadRequest; return(new ObjectResult("Invalid packageset")); } else if (System.IO.File.Exists((Program.FilesPath + "/" + packageset + "/.PRIVILEGED.FLAG").AsPath()) && !Program.IsUuidPriveleged(uuid)) { Response.StatusCode = Http.StatusCodes.Status401Unauthorized; return(new ObjectResult("You do not have access to that packageset")); } else { string tempdir = (Program.TempPath + "/" + uuid).AsPath(); try { Program.uuidLocks.Add(uuid); string[] requestedPackages = packages.Split(';'); //List<KeyValuePair<string, string>> files = new List<KeyValuePair<string, string>>(); OrderedDictionary files = new OrderedDictionary(); foreach (string k in requestedPackages) { //sanitize input if (k.Contains("/") || k.Contains("\\") || k.Contains("..") || k.Contains("~") || k.Contains("%")) { Program.uuidLocks.Remove(uuid); Response.StatusCode = Http.StatusCodes.Status401Unauthorized; return(new ObjectResult("hackerman")); } if (Directory.Exists((Program.FilesPath + "/" + packageset + "/" + k + "/" + channel).AsPath())) { foreach (string f in EnumerateAllFiles((Program.FilesPath + "/" + packageset + "/" + k + "/" + channel).AsPath())) { if (client == "hbswitch") { if (f.StartsWith((Program.FilesPath + "/" + packageset + "/" + k + "/" + channel + "/sd").AsPath())) { files[f.Replace((Program.FilesPath + "/" + packageset + "/" + k + "/" + channel + "/sd").AsPath(), "")] = f; } } else { files[f.Replace((Program.FilesPath + "/" + packageset + "/" + k + "/" + channel).AsPath(), "")] = f; } } } } ResultFile file = ZipFromFilestreams(files, uuid); Program.generatedZips[uuid] = file; Program.uuidLocks.Remove(uuid); return(new ObjectResult("READY")); } catch (Exception e) { Program.uuidLocks.Remove(uuid); Console.WriteLine(e.Message); Response.StatusCode = Http.StatusCodes.Status500InternalServerError; return(new ObjectResult("Internal server error occurred")); } } }
private void SendMail(PaperFile paper, ResultFile result) { if (!Member.IsLogined) { return; } StringBuilder body = new StringBuilder(); ConclusionFile conFile = result.GetConclusion(paper); body.AppendLine("�� " + Member.Instance.Email.Split('@')[0] + " �����ã�\n"); body.AppendLine("��л������BrandQQƷ�ƹ����������ԣ��ֽ����β��Խ���ĸ�Ҫ���ܽᷢ������\n"); body.AppendLine("-----------------------"); body.AppendLine("����Ʒ�ƹ�������ָ�� BMI=" + result.RelativeScore.ToString() + " ��\n"); body.AppendLine("BrandQQ����������"); body.AppendLine("����" + conFile.Content); if (conFile.Additives != null) { foreach (AdditiveConclusion addConclusion in conFile.Additives) { body.AppendLine("����" + Util.Utility.UBB2Html(addConclusion.Content)); } } if (!String.IsNullOrEmpty(result.UserInfo.Industry)) { string industryConclusion = Conclusion.GetIndustryConclusion(result.UserInfo.Industry); if (!String.IsNullOrEmpty(industryConclusion)) { body.AppendLine("����" + industryConclusion); } } if (!String.IsNullOrEmpty(conFile.Advice)) { body.AppendLine("\n\nBrandQQ���飺"); body.AppendLine(conFile.Advice); } body.AppendLine("\n\n�ر���ʾ��"); body.AppendLine("1�������ķ������棬������7��ģ��ķ����������ϸ����ʻ����б��棻"); body.AppendLine("2������������ҵ���ϣ���ѳ�ΪBrandQQ����֤�û����Եõ���Ϊ�꾡�ķ���𰸣������ͼ�ֵ3000Ԫ�������桶�й���ҵƷ�ƹ���������Ƥ�顷 ��"); body.AppendLine("3������������µ�ժҪ�桶�й���ҵƷ�ƹ���������Ƥ�顷 http://brandqq.brandmanager.com.cn/bmi \n"); body.AppendLine("-----------------------"); body.AppendLine("����BrandQQ�ĵ�¼�ʻ��ǣ�" + Member.Instance.Email + "��������������룬������http://brandqq.brandmanager.com.cn/login.aspx�һأ�"); body.AppendLine("\nBrandQQ http://brandqq.brandmanager.com.cn\n\n"); body.AppendLine("BrandQQ���ٷ�Ӧ���� "+DateTime.Now.ToString()); Email.SendMail(Member.Instance.Email, "����BrandQQ��Ʒ�ƹ����������Խ��("+DateTime.Now.ToShortDateString()+")", body.ToString(), false, GeneralConfig.MailSenderInstance); }
public static void Main(string[] args) { ResultFile.CreateResultDirectory(); CreateWebHostBuilder(args).Build().Run(); }