public void DumpAndLogLocals(Desharp.Level logLevel) { Delegates.TestBaseDelegate(delegate(object o, EventArgs e) { Console.Write("Handler first"); }, logLevel); Delegates.TestTypedDelegate(delegate(object o, CustomEventArgs e) { }, logLevel); }
public void DumpAndLogLocals(Desharp.Level logLevel) { Func <int, int, int, string, bool?> fn1 = (a, b, c, d) => { return(false); }; Func <int> fn2 = () => { return(1); }; Desharp.Debug.Dump(fn1); Desharp.Debug.Dump(fn2); Desharp.Debug.Log(fn1, logLevel); Desharp.Debug.Log(fn2, logLevel); }
public void DumpAndLogLocals(Desharp.Level logLevel) { System.DateTimeOffset a = DateTimeOffset.Now; System.DateTime b = DateTime.Now; System.TimeSpan c = TimeSpan.FromTicks(DateTime.Now.Ticks); System.DBNull d = System.DBNull.Value; System.Guid e = this.GetType().GUID; System.Text.StringBuilder f = new System.Text.StringBuilder("String builder test value"); Desharp.Debug.Dump(a, b, c, d, e, f); Desharp.Debug.Log(a, logLevel); Desharp.Debug.Log(b, logLevel); Desharp.Debug.Log(c, logLevel); Desharp.Debug.Log(d, logLevel); Desharp.Debug.Log(e, logLevel); Desharp.Debug.Log(f, logLevel); }
//------------------------------------------------------------- public void Write(string msg, LogType logType = LogType.Info) //------------------------------------------------------------- { // frame 1, true for source info StackFrame frame = new StackFrame(1, true); var method = frame.GetMethod(); var fileName = System.IO.Path.GetFileNameWithoutExtension(frame.GetFileName()); var lineNumber = frame.GetFileLineNumber(); //------------------------------------------------------------- //Log to Desharp //------------------------------------------------------------- Desharp.Level desharpLevel = Desharp.Level.DEBUG; if (logType == LogType.Info) { desharpLevel = Desharp.Level.INFO; } if (logType == LogType.Warning) { desharpLevel = Desharp.Level.WARNING; } if (logType == LogType.Error) { desharpLevel = Desharp.Level.ERROR; } Desharp.Debug.Log(msg, desharpLevel); //------------------------------------------------------------- //Log to Console //------------------------------------------------------------- if (logType == LogType.Error) //Always log errors //------------------------------------------------------------- { Debug.WriteLine(msg); kobberLan.Invoke(new Action(() => { if (kobberLan != null) { kobberLan.SetErrors(++errors); } })); } //------------------------------------------------------------- else if (logType == LogType.Warning) //Always log warnings //------------------------------------------------------------- { Debug.WriteLine(msg); kobberLan.Invoke(new Action(() => { if (kobberLan != null) { kobberLan.SetWarnings(++warnings); } })); } //------------------------------------------------------------- else //Information //------------------------------------------------------------- { } }
public sbyte?CP = null; // @ public void DumpAndLogLocals(Desharp.Level logLevel) { Int16 aa = -1; UInt16 ab = 2; Int32 ac = -3; UInt32 ad = 4; Int64 ae = -5; UInt64 af = 6; IntPtr ag = new IntPtr(-7); UIntPtr ah = new UIntPtr(8); float ai = -9.5E+10F; double aj = -10.5E+10; decimal ak = -11.5E+10M; char al = '@'; string am = "Hi"; bool an = true; byte ao = 0x40; // @ sbyte ap = -0x25; // % Desharp.Debug.Dump( aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap ); Desharp.Debug.Log(aa, logLevel); Desharp.Debug.Log(ab, logLevel); Desharp.Debug.Log(ac, logLevel); Desharp.Debug.Log(ad, logLevel); Desharp.Debug.Log(ae, logLevel); Desharp.Debug.Log(af, logLevel); Desharp.Debug.Log(ag, logLevel); Desharp.Debug.Log(ah, logLevel); Desharp.Debug.Log(ai, logLevel); Desharp.Debug.Log(aj, logLevel); Desharp.Debug.Log(ak, logLevel); Desharp.Debug.Log(al, logLevel); Desharp.Debug.Log(am, logLevel); Desharp.Debug.Log(an, logLevel); Desharp.Debug.Log(ao, logLevel); Desharp.Debug.Log(ap, logLevel); Int16? ba = -10; UInt16? bb = 20; Int32? bc = -30; UInt32? bd = 40; Int64? be = -50; UInt64? bf = 60; IntPtr? bg = new IntPtr(-70); UIntPtr?bh = new UIntPtr(80); float? bi = -90.5E+10F; double? bj = -100.5E+10; decimal?bk = -101.5E+10M; char?bl = '@'; //string? bm = '@'; bool? bn = true; byte? bo = 0x25; // % sbyte?bp = -0x40; // @ Desharp.Debug.Dump( ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, /*bm,*/ bn, bo, bp ); Desharp.Debug.Log(ba, logLevel); Desharp.Debug.Log(bb, logLevel); Desharp.Debug.Log(bc, logLevel); Desharp.Debug.Log(bd, logLevel); Desharp.Debug.Log(be, logLevel); Desharp.Debug.Log(bf, logLevel); Desharp.Debug.Log(bg, logLevel); Desharp.Debug.Log(bh, logLevel); Desharp.Debug.Log(bi, logLevel); Desharp.Debug.Log(bj, logLevel); Desharp.Debug.Log(bk, logLevel); Desharp.Debug.Log(bl, logLevel); //Desharp.Debug.Log(bm, logLevel); Desharp.Debug.Log(bn, logLevel); Desharp.Debug.Log(bo, logLevel); Desharp.Debug.Log(bp, logLevel); Int16? ca = null; UInt16? cb = null; Int32? cc = null; UInt32? cd = null; Int64? ce = null; UInt64? cf = null; IntPtr? cg = null; UIntPtr?ch = null; float? ci = null; double? cj = null; decimal?ck = null; char?cl = null; //string? cm = null; bool? cn = null; byte? co = null; // % sbyte?cp = null; // @ Desharp.Debug.Dump( ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, /*cm,*/ cn, co, cp ); Desharp.Debug.Log(ca, logLevel); Desharp.Debug.Log(cb, logLevel); Desharp.Debug.Log(cc, logLevel); Desharp.Debug.Log(cd, logLevel); Desharp.Debug.Log(ce, logLevel); Desharp.Debug.Log(cf, logLevel); Desharp.Debug.Log(cg, logLevel); Desharp.Debug.Log(ch, logLevel); Desharp.Debug.Log(ci, logLevel); Desharp.Debug.Log(cj, logLevel); Desharp.Debug.Log(ck, logLevel); Desharp.Debug.Log(cl, logLevel); //Desharp.Debug.Log(cm, logLevel); Desharp.Debug.Log(cn, logLevel); Desharp.Debug.Log(co, logLevel); Desharp.Debug.Log(cp, logLevel); }
public void DumpAndLogLocals(Desharp.Level logLevel) { Int16[] aa = new Int16[] { 1, -1 }; UInt16[] ab = new UInt16[] { 2, 22 }; Int32[] ac = new Int32[] { -3, 3 }; UInt32[] ad = new UInt32[] { 4, 44 }; Int64[] ae = new Int64[] { -5, 5 }; UInt64[] af = new UInt64[] { 6, 66 }; IntPtr[] ag = new IntPtr[] { new IntPtr(-7), new IntPtr(7) }; UIntPtr[] ah = new UIntPtr[] { new UIntPtr(8), new UIntPtr(88) }; float[] ai = new float[] { -9.5E+10F, 9.5E+10F }; double[] aj = new double[] { -10.5E+10, 10.5E+10 }; decimal[] ak = new decimal[] { -11.5E+10M, 11.5E+10M }; char[] al = new char[] { '@', '#' }; string[] am = new string[] { "Hi", "how", "are", "you?" }; bool[] an = new bool[] { true, false }; byte[] ao = new byte[] { 0x40, 0x23 }; // @, # sbyte[] ap = new sbyte[] { -0x25, -0x24 }; // %, $ int[][] aJaggedArr = new int[][] { new int[] { 1, 2, 3 }, new int[] { 10, 20, 30 } }; Desharp.Debug.Dump( aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aJaggedArr ); Desharp.Debug.Log(aa, logLevel); Desharp.Debug.Log(ab, logLevel); Desharp.Debug.Log(ac, logLevel); Desharp.Debug.Log(ad, logLevel); Desharp.Debug.Log(ae, logLevel); Desharp.Debug.Log(af, logLevel); Desharp.Debug.Log(ag, logLevel); Desharp.Debug.Log(ah, logLevel); Desharp.Debug.Log(ai, logLevel); Desharp.Debug.Log(aj, logLevel); Desharp.Debug.Log(ak, logLevel); Desharp.Debug.Log(al, logLevel); Desharp.Debug.Log(am, logLevel); Desharp.Debug.Log(an, logLevel); Desharp.Debug.Log(ao, logLevel); Desharp.Debug.Log(ap, logLevel); Desharp.Debug.Log(aJaggedArr, logLevel); Int16?[] ba = new Int16?[] { null, 1, -1 }; UInt16?[] bb = new UInt16?[] { 2, null, 22 }; Int32?[] bc = new Int32?[] { -3, 3, null }; UInt32?[] bd = new UInt32?[] { null, 4, 44 }; Int64?[] be = new Int64?[] { -5, null, 5 }; UInt64?[] bf = new UInt64?[] { 6, 66, null }; IntPtr?[] bg = new IntPtr?[] { null, new IntPtr(-7), new IntPtr(7) }; UIntPtr?[] bh = new UIntPtr?[] { new UIntPtr(8), null, new UIntPtr(88) }; float?[] bi = new float?[] { -9.5E+10F, 9.5E+10F, null }; double?[] bj = new double?[] { null, -10.5E+10, 10.5E+10 }; decimal?[] bk = new decimal?[] { -11.5E+10M, null, 11.5E+10M }; char?[] bl = new char?[] { '@', '#', null }; string[] bm = new string[] { "Hi", null, "are", "you?" }; bool?[] bn = new bool?[] { true, false, null }; byte?[] bo = new byte?[] { 0x40, null, 0x23 }; // @, # sbyte?[] bp = new sbyte?[] { null, -0x25, 0x24 }; // %, $ int?[][] bJaggedArrNullable = new int?[][] { new int?[] { 1, 2, 3, null }, new int?[] { 10, 20, null, 30 } }; Desharp.Debug.Dump( ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp, bJaggedArrNullable ); Desharp.Debug.Log(ba, logLevel); Desharp.Debug.Log(bb, logLevel); Desharp.Debug.Log(bc, logLevel); Desharp.Debug.Log(bd, logLevel); Desharp.Debug.Log(be, logLevel); Desharp.Debug.Log(bf, logLevel); Desharp.Debug.Log(bg, logLevel); Desharp.Debug.Log(bh, logLevel); Desharp.Debug.Log(bi, logLevel); Desharp.Debug.Log(bj, logLevel); Desharp.Debug.Log(bk, logLevel); Desharp.Debug.Log(bl, logLevel); Desharp.Debug.Log(bm, logLevel); Desharp.Debug.Log(bn, logLevel); Desharp.Debug.Log(bo, logLevel); Desharp.Debug.Log(bp, logLevel); Desharp.Debug.Log(bJaggedArrNullable, logLevel); }
public static void TestTypedDelegate(CustomHandler handler, Desharp.Level logLevel) { Desharp.Debug.Dump(handler); Desharp.Debug.Log(handler, logLevel); }
public static void TestBaseDelegate(EventHandler handler, Desharp.Level logLevel) { Desharp.Debug.Dump(handler); Desharp.Debug.Log(handler, logLevel); }