void Context_StateChanged(Pipeline Context, Pipeline.PipelineStates OldState, Pipeline.PipelineStates NewState) { if (!enabled) return; // string builder to construct the data segment string StringBuilder sb = new StringBuilder(); if(Context.Data != null) foreach(KeyValuePair<string, object> kv in Context.Data) sb.AppendFormat("{0}={1}\r\n", kv.Key, kv.Value); else sb.AppendFormat("--- EMPTY DATA SEGMENT ---"); // Write out our data segment to the file TextWriter tw = output == "stdout" ? Console.Out : output == "stderr" ? Console.Error : null; try { if (tw == null) tw = File.AppendText(output); tw.Write(string.Format("{4} - [PIPELINE STATE CHANGE ({0}->{1})]\r\nDATA SEGEMENT SIZE: {2}\r\nDATA SEGMENT DATA:\r\n{3}", OldState.ToString(), NewState.ToString(), Context.Data == null ? 0 : Context.Data.Count, sb.ToString(), DateTime.Now.ToString("dd-MMM-yy HH:mm:ss"))); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.ToString(), "fatal"); } finally { if (tw != null && tw != System.Console.Out) tw.Close(); } }
public PipelineExecutionException(Pipeline FaultingPipeline, Pipeline.PipelineStates ErrorState, Dictionary<string, object> DataSegment, Exception InnerException) : base("Pipeline Execution Failed", InnerException) { this.faultingPipeline = FaultingPipeline; this.errorState = ErrorState; this.dataSegment = DataSegment; }
public void Init(Pipeline Context) { Context.StateChanged += new StateChangeHandler(Context_StateChanged); // Check if we should be turned on enabled = Program.parameters == null ? false : Program.parameters.Extensions.ContainsKey("pipe-sniffer"); if (enabled) output = Program.parameters.Extensions["pipe-sniffer"][0]; }
/// <summary> /// Initialize the pipeline component /// </summary> public void Init(Pipeline Context) { this.context = Context; System.Diagnostics.Trace.WriteLine("Mohawk College MIF Loader Pipeline Component\r\nCopyright(C) 2008/2009 Mohawk College of Applied Arts and Technology", "information"); }
private static void processTranformation() { Pipeline processPipeline = new Pipeline(); // Load all pipeline components and triggers from available assemblies foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) foreach (Type t in a.GetTypes()) { if (t.GetInterface("MohawkCollege.EHR.gpmr.Pipeline.IPipelineComponent") != null && !t.IsAbstract) { processPipeline.Components.Add((IPipelineComponent)a.CreateInstance(t.FullName)); System.Diagnostics.Trace.WriteLine(string.Format("Found pipeline component {0}", t.FullName), "debug"); } else if (t.GetInterface("MohawkCollege.EHR.gpmr.Pipeline.IPipelineTrigger") != null && !t.IsAbstract) { processPipeline.Triggers.Add((IPipelineTrigger)a.CreateInstance(t.FullName)); System.Diagnostics.Trace.WriteLine(string.Format("Found pipeline trigger {0}", t.FullName), "debug"); } } // Initialize the process pipeline processPipeline.Initialize(); // Set data segment processPipeline.Data.Add("EnabledRenderers", new DumpableStringCollection(parameters.Renderers)); processPipeline.Data.Add("CommandParameters", parameters.Extensions); if (parameters.StrictMode && parameters.QuirksMode) { Console.WriteLine("The --quirks and --strict parameters are exclusive and cannot be combined"); return; } processPipeline.Mode = parameters.StrictMode ? Pipeline.OperationModeType.Strict : parameters.QuirksMode ? Pipeline.OperationModeType.Quirks : Pipeline.OperationModeType.Normal; if (processPipeline.Mode == Pipeline.OperationModeType.Quirks) Console.WriteLine("--- WARNING ---\r\n You are executing GPMR in Quirks mode, GPMR will continue to process models that cannot be verified to be correct\r\n--- WARNING ---"); processPipeline.Output = parameters.OutputDirectory; // Saturate the pipeline file list foreach (string filePattern in parameters.Sources) { // See what we are including if (filePattern.Contains("*") || filePattern.Contains("?")) { string path = Path.GetDirectoryName(filePattern); foreach (string file in Directory.GetFiles(path, Path.GetFileName(filePattern))) processPipeline.InputFiles.Push(file); } else processPipeline.InputFiles.Push(filePattern); } // Begin Pipeline Execution try { processPipeline.Execute(); } catch (Exception e) { System.Diagnostics.Trace.WriteLine("The execution of the pipeline has failed. No processing can continue", "fatal"); System.Diagnostics.Trace.WriteLine(e.Message, "fatal"); } }
public void Shown(IWizardStage previous, WizardDirection direction) { if(direction == WizardDirection.Forward) this.m_previousStage = previous; tmrStatus.Enabled = true; this.loadAssemblies(); m_gpmrRenderPipeline = new Pipeline(); //m_gpmrRenderPipeline.StateChanged += new StateChangeHandler(m_gpmrRenderPipeline_StateChanged); bwStatus.RunWorkerAsync(); }
/// <summary> /// Initialize the renderer /// </summary> /// <param name="Context"></param> public virtual void Init(Pipeline Context) { hostContext = Context; }