private void Log(string app, object args, bool toHex) { if (OnLog.GetInvocationList().Length == 0) { return; } string ept; if (toHex) { ept = HexDigest((byte[])args); } else { ept = (string)args; } OnLog.Invoke(string.Format("[{0}] {1}", app, ept)); }