/// <summary> /// 用户App或工具用此函数可向Debug流写入一条消息。 /// </summary> /// <param name="source"></param> /// <param name="type"></param> /// <param name="id"></param> /// <param name="severity"></param> /// <param name="length">用-1即可。</param> /// <param name="buf"></param> public static void DebugMessageInsert( CSharpGL.Enumerations.DebugSource source, CSharpGL.Enumerations.DebugType type, uint id, CSharpGL.Enumerations.DebugSeverity severity, int length, StringBuilder buf) { DebugMessageInsert((uint)source, (uint)type, id, (uint)severity, length, buf); }
private void callbackProc(CSharpGL.Enumerations.DebugSource source, CSharpGL.Enumerations.DebugType type, uint id, CSharpGL.Enumerations.DebugSeverity severity, int length, StringBuilder message, IntPtr userParam) { var obj = System.Runtime.InteropServices.Marshal.PtrToStructure(userParam, typeof(UserParamStruct)); DateTime now = DateTime.Now; StringBuilder builder = new StringBuilder(); { builder.AppendLine(string.Format("{0:yyyy-MM-dd HH:mm:ss.ffff}:", now)); builder.Append("source: "); builder.Append(source); builder.Append(", "); builder.Append("type: "); builder.Append(type); builder.Append(", "); builder.Append("id: "); builder.Append(id); builder.Append(", "); builder.Append("severity: "); builder.Append(severity); builder.Append(", "); builder.Append("length: "); builder.Append(length); builder.Append(", "); builder.Append("message: "); if (message != null) { builder.Append(message.ToString()); builder.Append(", "); } else { builder.Append("<null>"); builder.Append(", "); } builder.Append("userParam: "); builder.Append(userParam); builder.AppendLine(); } string text = builder.ToString(); this.frmWhiteBoard.AppendText(text); string filename = string.Format("debuggingAndProfiling{0:yyyyMMddHHmm}.txt", now); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(filename, true)) { sw.Write(text); } }
void CallbackProc( CSharpGL.Enumerations.DebugSource source, CSharpGL.Enumerations.DebugType type, uint id, CSharpGL.Enumerations.DebugSeverity severity, int length, StringBuilder message, IntPtr userParam) { FormTransformFeedback thisForm = FormTransformFeedback.FromHandle(userParam) as FormTransformFeedback; DateTime now = DateTime.Now; StringBuilder builder = new StringBuilder(); { builder.AppendLine(string.Format("{0:yyyy-MM-dd HH:mm:ss.ffff}:", now)); builder.Append("source: "); builder.Append(source); builder.Append(", "); builder.Append("type: "); builder.Append(type); builder.Append(", "); builder.Append("id: "); builder.Append(id); builder.Append(", "); builder.Append("severity: "); builder.Append(severity); builder.Append(", "); builder.Append("length: "); builder.Append(length); builder.Append(", "); builder.Append("message: "); if (message != null) { builder.Append(message.ToString()); builder.Append(", "); } else { builder.Append("<null>"); builder.Append(", "); } builder.Append("userParam: "); builder.Append(userParam); builder.AppendLine(); } string text = builder.ToString(); if (!this.frmWhiteBoard.IsDisposed) { this.frmWhiteBoard.AppendText(text); } }