public ContextValidation(ObservableCollection <StackHashScriptFileData> allScriptData, int initialNameIndex, string scriptName, string script, bool runAutomatically, bool isReadOnly, StackHashScriptDumpType dumpType) { this.DumpTypes = DumpTypeWrapper.GetTypeList(); foreach (DumpTypeWrapper dumpWrapper in this.DumpTypes) { if (dumpWrapper.Type == dumpType) { this.DumpType = dumpWrapper; break; } } this.AllScriptData = allScriptData; this.InitialNameIndex = initialNameIndex; this.ScriptName = scriptName; this.Script = script; this.RunAutomatically = runAutomatically; this.CanEdit = !isReadOnly; _invalidScriptNameChars = System.IO.Path.GetInvalidFileNameChars(); }
/// <summary /> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (targetType != typeof(string)) { throw new InvalidOperationException("targetType must be string"); } string displayString = string.Empty; StackHashScriptDumpType dumpType = (StackHashScriptDumpType)value; switch (dumpType) { case StackHashScriptDumpType.UnmanagedOnly: displayString = Properties.Resources.DumpType_Native; break; case StackHashScriptDumpType.ManagedOnly: displayString = Properties.Resources.DumpType_Managed; break; case StackHashScriptDumpType.UnmanagedAndManaged: displayString = Properties.Resources.DumpType_All; break; } return(displayString); }
private bool runAutoScripts(StackHashProduct product, StackHashFile file, StackHashEvent theEvent, StackHashCab cab, StackHashScriptDumpType dumpType) { Collection <AutoScriptBase> autoScripts = m_TaskParameters.TheScriptManager.AutoScripts; ScriptResultsManager scriptRunner = m_TaskParameters.TheScriptResultsManager; bool dumpAnalysisProduced = false; // Analyse the Unmanaged mode autoscripts first - as these determine if the dump is managed or not and hence whether // the managed scripts will be run. The AutoScripts property above returns the autoscripts in the correct order. foreach (AutoScriptBase autoScript in autoScripts) { bool dumpIsManaged = ((cab.DumpAnalysis != null) && (!String.IsNullOrEmpty(cab.DumpAnalysis.DotNetVersion))); if (autoScript.ScriptSettings.DumpType != dumpType) { continue; } if ((autoScript.ScriptSettings.DumpType == StackHashScriptDumpType.ManagedOnly) && (!dumpIsManaged)) { continue; } bool forceAutoScript = false; if ((cab.DumpAnalysis == null) || (cab.DumpAnalysis.MachineArchitecture == null) || (cab.DumpAnalysis.OSVersion == null)) { forceAutoScript = true; } // Run the auto script on the cab if it hasn't already been run. StackHashScriptResult scriptResult = scriptRunner.RunScript(product, file, theEvent, cab, null, autoScript.ScriptName, false, null, forceAutoScript); // Analyze the results. if (scriptResult != null) { cab.DumpAnalysis = autoScript.AnalyzeScriptResults(cab.DumpAnalysis, scriptResult); dumpAnalysisProduced = true; m_ConsecutiveErrors = 0; } } return(dumpAnalysisProduced); }
public DumpTypeWrapper(StackHashScriptDumpType type, string displayName) { this.Type = type; this.DisplayName = displayName; }