public string CabAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerCab cab) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } if (cab == null) { throw new ArgumentNullException("cab"); } if (cab.CabPathAndFileName == null) { throw new ArgumentException("Cab path is null", "cab"); } BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Cab Added: " + cab.ToString()); // If the SetBugId is set then the plugin should have set the bug reference so subsequent calls using that event should // also contain the bug reference. if (m_Properties["SetBugId"] == "True") { if (theEvent.PlugInBugReference != "TestPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture)) { throw new ArgumentException("Bug ref not set", "theEvent"); } } String bugId = null; if (m_Properties["CabAddedSetBugId"] == "True") { bugId = "TestCabAddedPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture); } if ((m_Properties["ManualCabAddedSetBugId"] == "True") && (reportType != BugTrackerReportType.Automatic)) { if (m_CabsPerEvent.ContainsKey(theEvent.EventId)) { if (!theEvent.PlugInBugReference.StartsWith("ManualCabAddedSetBugId", StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Plug-in bug reference should be set already", "theEvent"); } m_CabsPerEvent[theEvent.EventId]++; } else { m_CabsPerEvent[theEvent.EventId] = 1; } bugId = "ManualCabAddedSetBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture); } m_CabAddedCount++; return(bugId); }
/// <summary> /// If the report type is automatic then this call indicates that a Debug Script Result has been added to the /// StackHash database by way the Cab Analysis task running or the StackHash client manually running a script /// on a cab. /// /// If the report type is manual then this call indicates that an Debug Script Result already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// scriptResult.ToString() can be used to format the string for addition to a Fault Database system. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event to which the cab belongs.</param> /// <param name="cab">The cab to which the debug script result belongs.</param> /// <param name="scriptResult">The result of running a debug script on the cab dump file.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string DebugScriptExecuted(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerCab cab, BugTrackerScriptResult scriptResult) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } if (cab == null) { throw new ArgumentNullException("cab"); } if (scriptResult == null) { throw new ArgumentNullException("scriptResult"); } // Note that all of the interface objects have a built in ToString() which formats the fields suitably. BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, m_Control.PlugInName, "Debug Script Added: " + scriptResult.ToString()); // Don't change the plugin bug reference. return(null); }
/// <summary> /// Get the highest level of the 2 specified report types. /// The heirarchy is... /// Full - Product - File - Event - Cab - Script - Automatic /// </summary> /// <param name="reportType1">First report type to compare.</param> /// <param name="reportType2">Second report type to compare.</param> /// <returns>Highest level report type of the parameters.</returns> private BugTrackerReportType getHigherLevelReport(BugTrackerReportType reportType1, BugTrackerReportType reportType2) { if ((reportType1 == BugTrackerReportType.ManualFull) || (reportType2 == BugTrackerReportType.ManualFull)) { return(BugTrackerReportType.ManualFull); } if ((reportType1 == BugTrackerReportType.ManualProduct) || (reportType2 == BugTrackerReportType.ManualProduct)) { return(BugTrackerReportType.ManualProduct); } if ((reportType1 == BugTrackerReportType.ManualFile) || (reportType2 == BugTrackerReportType.ManualFile)) { return(BugTrackerReportType.ManualFile); } if ((reportType1 == BugTrackerReportType.ManualEvent) || (reportType2 == BugTrackerReportType.ManualEvent)) { return(BugTrackerReportType.ManualEvent); } if ((reportType1 == BugTrackerReportType.ManualCab) || (reportType2 == BugTrackerReportType.ManualCab)) { return(BugTrackerReportType.ManualCab); } if ((reportType1 == BugTrackerReportType.ManualScript) || (reportType2 == BugTrackerReportType.ManualScript)) { return(BugTrackerReportType.ManualScript); } return(BugTrackerReportType.Automatic); }
public string EventNoteAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerNote note) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } if (note == null) { throw new ArgumentNullException("note"); } m_LastEventNote = note.Note; BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Event Note Added: " + note.ToString()); // If the SetBugId is set then the plugin should have set the bug reference so subsequent calls using that event should // also contain the bug reference. if (m_Properties["SetBugId"] == "True") { if (theEvent.PlugInBugReference != "TestPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture)) { throw new ArgumentException("Bug ref not set", "theEvent"); } } m_EventNoteAddedCount++; return(null); }
public void ProductAdded(BugTrackerReportType reportType, BugTrackerProduct product) { m_ProductAddedCount++; if (product == null) { throw new ArgumentNullException("product"); } if (m_Properties["ProductAddedException"] != null) { throw new ArgumentException("Test exception"); } if (m_Properties["UnhandledException"] != null) { // Spawn a new thread to cause the exception. Thread exceptionThread = new Thread(delegate() { throw new ArgumentException("Thread exception"); }); exceptionThread.Start(); Thread.Sleep(2000); return; } BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Product Added: " + product.ToString()); }
public string EventAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } m_EventAddedCount++; String bugId = theEvent.BugReference; if (m_Properties["SetBugId"] == "True") { bugId = "TestPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture); } BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Event Added: " + theEvent.ToString()); return(bugId); }
/// <summary> /// Processes a specific report request. /// </summary> private void processReportRequest(StackHashBugReportData request) { if (this.CurrentTaskState.AbortRequested) { throw new OperationCanceledException("Reporting events to Bug Tracker plug-ins"); } // Determine what the report type is. The report type is reported to the plugin. It indicates // whether this manual report is for a whole product, file, event, cab, script or what. m_ReportType = getReportType(request); if (request.Product == null) { // Loop through all products. StackHashProductCollection allProducts = m_Index.LoadProductList(); foreach (StackHashProduct product in allProducts) { processProduct(request, product); } } else { StackHashProduct product = m_Index.GetProduct(request.Product.Id); if (product != null) { processProduct(request, product); } } }
/// <summary> /// If the report type is automatic then this call indicates that an Event note has been added to the /// StackHash database by a StackHash client. /// /// If the report type is manual then this call indicates that an Event note already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// Note that it is possible that the event note existence has already been reported, so the /// code here should check, if necessary, that this is not a duplicate before creating new items in /// the destination bug tracking system. /// /// Important Note: AN EVENT IS IDENTIFIED BY ITS ID AND EVENTTYPENAME TOGETHER. Therefore it is possible to /// have events with the same ID but different EventTypeName. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event to which the note belongs.</param> /// <param name="note">The event note to add.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string EventNoteAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerNote note) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } if (note == null) { throw new ArgumentNullException("note"); } // Note that all of the interface objects have a built in ToString() which formats the fields suitably. BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, m_Control.PlugInName, "Event Note Added: " + note.ToString()); // Don't change the bug reference. return(null); }
/// <summary> /// This method is called when the processing of an Event has completed. Events have associated Cabs, Scripts and notes which /// may all be reported during a MANUAL Bug Report. This call effectively delimits the reporting of all /// information associated with an event so, if desired, the plug-in can gather all of the information together in one /// go for sending to the fault database. This may improve performance for events with large amounts of stored data. /// /// The plug-in may thus see... /// EventAdded /// EventNoteAdded, EventNoteAdded,... /// CabAdded, CabAdded,... /// CabNoteAdded, CabNoteAdded,... /// ScriptResultAdded, ScriptResultAdded,... /// EventManualUpdateCompleted. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event whose details have now been reported.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string EventManualUpdateCompleted(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent) { if (m_disposed) { throw new ObjectDisposedException("EmailPluginContext"); } if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } // Don't change the plugin bug reference. Setting this to any other value will update the plugin bug reference in the // StackHash database. String pluginBugReference = null; return(pluginBugReference); }
/// <summary> /// Get the total number of events to be reported for this request. /// </summary> /// <param name="request">Full request.</param> /// <param name="reportType">The type of the request.</param> /// <returns>Number of events.</returns> private long getNumberOfEvents(StackHashBugReportData request, BugTrackerReportType reportType) { long totalEvents = 0; StackHashProduct product = null; switch (reportType) { case BugTrackerReportType.ManualFull: totalEvents = m_Index.TotalStoredEvents; break; case BugTrackerReportType.ManualProduct: product = m_Index.GetProduct(request.Product.Id); if (product != null) { totalEvents = product.TotalStoredEvents; } break; case BugTrackerReportType.ManualFile: product = m_Index.GetProduct(request.Product.Id); if (product != null) { totalEvents = product.TotalStoredEvents; } break; default: totalEvents = 1; break; } return(totalEvents); }
/// <summary> /// If the report type is automatic then this call indicates that a Product has been changed in the /// StackHash database by way of a Synchronize with the WinQual web site. /// The change may include the number of events stored has increased. /// /// This method is not currently called for manual reports. /// /// Note that it is possible that an Updated is reported when no Added has been invoked. This can happen if the /// plug-in has been installed after the StackHash database has been created. Performing a manual Bug Report of /// the entire database when the plug-in is installed will limit the likelihood of this case. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product being updated.</param> public void ProductUpdated(BugTrackerReportType reportType, BugTrackerProduct product) { if (product == null) { throw new ArgumentNullException("product"); } // Note that all of the interface objects have a built in ToString() which formats the fields suitably. BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, m_Control.PlugInName, "Product Updated: " + product.ToString()); }
/// <summary> /// If the report type is automatic then this call indicates that a Product has been changed in the /// StackHash database by way of a Synchronize with the WinQual web site. /// The change may include the number of events stored has increased. /// /// This method is not currently called for manual reports. /// /// Note that it is possible that an Updated is reported when no Added has been invoked. This can happen if the /// plug-in has been installed after the StackHash database has been created. Performing a manual Bug Report of /// the entire database when the plug-in is installed will limit the likelihood of this case. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product being updated.</param> public void ProductUpdated(BugTrackerReportType reportType, BugTrackerProduct product) { if (m_disposed) { throw new ObjectDisposedException("EmailPluginContext"); } if (product == null) { throw new ArgumentNullException("product"); } }
public string CabNoteAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerCab cab, BugTrackerNote note) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } if (cab == null) { throw new ArgumentNullException("cab"); } if (note == null) { throw new ArgumentNullException("note"); } if (cab.CabPathAndFileName == null) { throw new ArgumentException("Cab path is null", "cab"); } m_LastCabNote = note.Note; BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Cab Note Added: " + note.ToString()); // If the SetBugId is set then the plugin should have set the bug reference so subsequent calls using that event should // also contain the bug reference. if (m_Properties["SetBugId"] == "True") { if (theEvent.PlugInBugReference != "TestPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture)) { throw new ArgumentException("Bug ref not set", "theEvent"); } } m_CabNoteAddedCount++; String bugId = null; if (m_Properties["CabNoteAddedBugId"] == "True") { bugId = "TestCabNoteAddedPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture); } if ((m_Properties["ManualCabAddedSetBugId"] == "True") && (reportType != BugTrackerReportType.Automatic)) { bugId = "ManualCabAddedSetBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture); } return(bugId); }
/// <summary> /// Get the highest level report in the set of requests. /// </summary> /// <param name="requests">All requests.</param> /// <returns>Highest level report.</returns> private BugTrackerReportType getHighestLevelReport(StackHashBugReportDataCollection requests) { BugTrackerReportType highestReportType = BugTrackerReportType.Automatic; foreach (StackHashBugReportData request in requests) { BugTrackerReportType reportType = getReportType(request); highestReportType = getHigherLevelReport(reportType, highestReportType); } return(highestReportType); }
public void FileAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "File Added: " + file.ToString()); m_FileAddedCount++; }
public void ProductUpdated(BugTrackerReportType reportType, BugTrackerProduct product) { if (product == null) { throw new ArgumentNullException("product"); } BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Product Updated: " + product.ToString()); if (product == null) { throw new ArgumentNullException("product"); } m_ProductUpdatedCount++; }
/// <summary> /// If the report type is automatic then this call indicates that a Product has been added to the /// StackHash database by way of a Synchronize with the WinQual web site. /// /// If the report type is manual then this call indicates that a Product already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// Note that it is therefore possible that the product existence has already been reported, so the /// code here should check, if necessary, that this is not a duplicate before creating new items in /// the destination bug tracking system. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product being added.</param> public void ProductAdded(BugTrackerReportType reportType, BugTrackerProduct product) { if (m_disposed) { throw new ObjectDisposedException("EmailPluginContext"); } if (product == null) { throw new ArgumentNullException("product"); } // report new products during sync (not during manual reporting) if configured to in settings if ((reportType == BugTrackerReportType.Automatic) && (m_Settings.ReportProducts) && (!m_Settings.IsManualOnly)) { try { string subject = string.Format(CultureInfo.CurrentCulture, StackHash.EmailPlugin.Properties.Resources.ProductAdded_SubjectTemplate, product.ProductName, product.ProductVersion); string message = string.Format(CultureInfo.CurrentCulture, StackHash.EmailPlugin.Properties.Resources.ProductAdded_MessageTemplate, product.ProductName, product.ProductVersion, product.ProductId); m_Settings.SendEmail(subject, message); m_EmailsSent++; } catch (Exception ex) { BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.ComponentFatal, m_Control.PlugInName, string.Format(CultureInfo.InvariantCulture, "Failed to send new product email: {0}", ex)); m_FailedEmails++; m_LastException = ex; throw; } } }
/// <summary> /// If the report type is automatic then this call indicates that a File has been added to the /// StackHash database by way of a Synchronize with the WinQual web site. /// /// If the report type is manual then this call indicates that a File already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// Files are mapped to products on the WinQual site. Note that the same file may be mapped to one /// or more products and therefore the same event (associated with a file) may "belong" refer to more /// than one product. /// /// Note that it is therefore possible that the file existence has already been reported, so the /// code here should check, if necessary, that this is not a duplicate before creating new items in /// the destination bug tracking system. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file being added.</param> public void FileAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file) { if (m_disposed) { throw new ObjectDisposedException("EmailPluginContext"); } if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } }
/// <summary> /// Get the level of report that has been requested. /// </summary> /// <param name="request">Full request.</param> /// <returns>Report level.</returns> private BugTrackerReportType getReportType(StackHashBugReportData request) { BugTrackerReportType reportType = BugTrackerReportType.ManualFull; // Determin what the report type is. The report type is reported to the plugin. It indicates // whether this manual report is for a whole product, file, event, cab, script or what. if (request.Product == null) { reportType = BugTrackerReportType.ManualFull; } else { if (request.File == null) { reportType = BugTrackerReportType.ManualProduct; } else { if (request.TheEvent == null) { reportType = BugTrackerReportType.ManualFile; } else { if (request.Cab == null) { m_ReportType = BugTrackerReportType.ManualEvent; } else { if (request.ScriptName == null) { m_ReportType = BugTrackerReportType.ManualCab; } else { // TODO: Support manual script writing. m_ReportType = BugTrackerReportType.ManualScript; } } } } } return(reportType); }
/// <summary> /// If the report type is automatic then this call indicates that a Product has been added to the /// StackHash database by way of a Synchronize with the WinQual web site. /// /// If the report type is manual then this call indicates that a Product already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// Note that it is therefore possible that the product existence has already been reported, so the /// code here should check, if necessary, that this is not a duplicate before creating new items in /// the destination bug tracking system. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product being added.</param> public void ProductAdded(BugTrackerReportType reportType, BugTrackerProduct product) { if (product == null) { throw new ArgumentNullException("product"); } if (reportType == BugTrackerReportType.Automatic) { // Do automatic processing here. i.e. the result of a WinQualSync Task. } else { // Do manual processing here. i.e. the result of a manual BugReport Task. } // Note that all of the interface objects have a built in ToString() which formats the fields suitably. BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, m_Control.PlugInName, "Product Added: " + product.ToString()); }
public override void EntryPoint() { SetTaskStarted(m_TaskParameters.ErrorIndex); StackHashUtilities.SystemInformation.DisableSleep(); m_PlugIns = m_TaskParameters.PlugIns; try { // If a full sync has been requested then stop the BugTrackerTask reporting any events until the // sync is complete. BugTrackerReportType highestReportType = getHighestLevelReport(m_TaskParameters.ReportRequest); if (highestReportType == BugTrackerReportType.ManualFull) { // Disable logging by the BugTrackerManager. m_TaskParameters.ErrorIndex.UpdateTableActive = false; // Clear the update list. m_TaskParameters.ErrorIndex.ClearAllUpdates(); } processAllReportRequests(); } catch (System.Exception ex) { LastException = ex; } finally { try { // Reenable logging by the BugTrackerManager. m_TaskParameters.ErrorIndex.UpdateTableActive = true; } finally { StackHashUtilities.SystemInformation.EnableSleep(); SetTaskCompleted(m_TaskParameters.ErrorIndex); } } }
public string DebugScriptExecuted(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerCab cab, BugTrackerScriptResult scriptResult) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } if (cab == null) { throw new ArgumentNullException("cab"); } if (scriptResult == null) { throw new ArgumentNullException("scriptResult"); } BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Script Added: " + scriptResult.ToString()); // If the SetBugId is set then the plugin should have set the bug reference so subsequent calls using that event should // also contain the bug reference. if (m_Properties["SetBugId"] == "True") { if (theEvent.PlugInBugReference != "TestPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture)) { throw new ArgumentException("Bug ref not set", "theEvent"); } } m_ScriptRunCount++; String bugId = null; if (m_Properties["DebugScriptExecutedBugId"] == "True") { bugId = "TestDebugScriptExecutedPlugInBugId" + theEvent.EventId.ToString(CultureInfo.InvariantCulture); } return(bugId); }
public string EventManualUpdateCompleted(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Event Manual Update Completed: " + theEvent.ToString()); m_EventCompleteCount++; return(theEvent.BugReference); }
/// <summary> /// This method is called when the processing of an Event has completed. Events have associated Cabs, Scripts and notes which /// may all be reported during a MANUAL Bug Report. This call effectively delimits the reporting of all /// information associated with an event so, if desired, the plug-in can gather all of the information together in one /// go for sending to the fault database. This may improve performance for events with large amounts of stored data. /// /// The plug-in may thus see... /// EventAdded /// EventNoteAdded, EventNoteAdded,... /// CabAdded, CabAdded,... /// CabNoteAdded, CabNoteAdded,... /// ScriptResultAdded, ScriptResultAdded,... /// EventManualUpdateCompleted. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event whose details have now been reported.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string EventManualUpdateCompleted(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent) { if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } // Don't change the bug reference. Setting this to any other value will update the bug reference in the // StackHash database. String plugInBugId = null; // Note that all of the interface objects have a built in ToString() which formats the fields suitably. BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, m_Control.PlugInName, "Event Completed: " + theEvent.ToString()); return(plugInBugId); }
/// <summary> /// If the report type is automatic then this call indicates that a Cab has been updated in the /// StackHash database by way of: a Synchronize with the WinQual web site; downloading a cab manually from the /// StackHash client; or a script providing further diagnostic information. /// /// This method is not currently called during a manual BugReport. /// /// A Cab entry indicates that a cab is available on the WinQual site. The cab has not necessarily been /// downloaded yet. Once the cab is downloaded, the CabUpdated method will be called with Cab.CabDownloaded == true. /// /// Cabs are associated with particular events (identified by EventId, EventTypeName). /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event to which the cab belongs.</param> /// <param name="cab">The cab being added.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string CabUpdated(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerCab cab) { return(null); }
/// <summary> /// If the report type is automatic then this call indicates that a Cab Note has been added to the /// StackHash database by way of the StackHash user adding one. /// /// If the report type is manual then this call indicates that an Cab Note already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event to which the cab belongs.</param> /// <param name="cab">The cab to which the note belongs.</param> /// <param name="note">The cab note to add.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string CabNoteAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerCab cab, BugTrackerNote note) { return(null); }
/// <summary> /// If the report type is automatic then this call indicates that a Debug Script Result has been added to the /// StackHash database by way the Cab Analysis task running or the StackHash client manually running a script /// on a cab. /// /// If the report type is manual then this call indicates that an Debug Script Result already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// scriptResult.ToString() can be used to format the string for addition to a Fault Database system. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event to which the cab belongs.</param> /// <param name="cab">The cab to which the debug script result belongs.</param> /// <param name="scriptResult">The result of running a debug script on the cab dump file.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string DebugScriptExecuted(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent, BugTrackerCab cab, BugTrackerScriptResult scriptResult) { return(null); }
/// <summary> /// If the report type is automatic then this call indicates that an Event has been added to the /// StackHash database by way of a Synchronize with the WinQual web site. /// /// If the report type is manual then this call indicates that an Event already exists in the /// StackHash database. This is the result of a BugReport task being run. /// /// A Plugin Bug Reference is stored with the Event data in the StackHash database. This can be manually changed /// by the StackHash client user. The plug-in can also change the plugin bug reference by returning the desired /// bug reference from this call. /// Return null if you do NOT want to change the bug reference stored in the StackHash database. /// Return any other string (including an empty string) and this value will be used to overwrite the /// plugin bug reference in the StackHash database. /// Note that there are 2 bug references: /// The BugReference can be set by the StackHash client user manually. This cannot be changed by the plugin. /// The PlugInBugReference can be set by the StackHash client user manually AND/OR set by the plugin. /// /// Files are mapped to products on the WinQual site. Note that the same file may be mapped to one /// or more products and therefore the same event (associated with a file) may "belong" refer to more /// than one product. /// /// Note that it is therefore possible that the event existence has already been reported, so the /// code here should check, if necessary, that this is not a duplicate before creating new items in /// the destination bug tracking system. /// /// Important Note: AN EVENT IS IDENTIFIED BY ITS ID AND EVENTTYPENAME TOGETHER. Therefore it is possible to /// have events with the same ID but different EventTypeName. /// /// Note also that event IDs can be negative. This is a consequence of the WinQual site storing event numbers as /// 32 bit signed quantities. When the event ID range was exhausted the WinQual events went negative. The StackHash /// database stores event IDs as 64 bit signed quantities to future proof against any future changes in the /// WinQual values. /// /// Automatic reports may arrived interleaved with manual reports. This may happen when, say a WinQual sync /// is happening at the same time as a manual report is requested. /// </summary> /// <param name="reportType">Manual or automatic. If manual identifies what level of report is taking place.</param> /// <param name="product">The product to which the file belongs.</param> /// <param name="file">The file to which the event belongs.</param> /// <param name="theEvent">The event being added.</param> /// <returns>Null - if the plugin bug reference in the StackHash database should not be changed, Otherwise the new value for the plugin bug reference.</returns> public string EventAdded(BugTrackerReportType reportType, BugTrackerProduct product, BugTrackerFile file, BugTrackerEvent theEvent) { if (m_disposed) { throw new ObjectDisposedException("EmailPluginContext"); } if (product == null) { throw new ArgumentNullException("product"); } if (file == null) { throw new ArgumentNullException("file"); } if (theEvent == null) { throw new ArgumentNullException("theEvent"); } // do nothing on an automatic report if we're in manaual mode if ((reportType == BugTrackerReportType.Automatic) && (m_Settings.IsManualOnly)) { return(null); } string subjectTemplate = null; string messageTemplate = null; if (reportType == BugTrackerReportType.Automatic) { subjectTemplate = StackHash.EmailPlugin.Properties.Resources.EventAdded_SubjectTemplate; messageTemplate = StackHash.EmailPlugin.Properties.Resources.EventAdded_MessageTemplate; } else { subjectTemplate = StackHash.EmailPlugin.Properties.Resources.EventManualReport_SubjectTemplate; messageTemplate = StackHash.EmailPlugin.Properties.Resources.EventManaulReport_MessageTemplate; } // build a string containing all event signature parameters StringBuilder eventSignatureBuilder = new StringBuilder(); foreach (string key in theEvent.Signature.Keys) { eventSignatureBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0} = {1}", key, theEvent.Signature[key]); eventSignatureBuilder.AppendLine(); eventSignatureBuilder.AppendLine(); } try { string subject = string.Format(CultureInfo.CurrentCulture, subjectTemplate, product.ProductName, product.ProductVersion, theEvent.EventId); string message = string.Format(CultureInfo.CurrentCulture, messageTemplate, product.ProductName, product.ProductVersion, theEvent.EventId, theEvent.EventTypeName, theEvent.TotalHits, eventSignatureBuilder); m_Settings.SendEmail(subject, message); m_EmailsSent++; } catch (Exception ex) { BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.ComponentFatal, m_Control.PlugInName, string.Format(CultureInfo.InvariantCulture, "Failed to send event email: {0}", ex)); m_LastException = ex; m_FailedEmails++; throw; } // Don't change the plugin bug reference. Setting this to any other value will update the plugin bug reference in the // StackHash database. string pluginBugReference = null; return(pluginBugReference); }