// #endregion Lister Callbacks #region Tracing #if TRACE private static void TraceOut(TraceLevel level, string text, string category) { if (writeTrace) { TcTrace.TraceOut(level, text, category); } }
private static void TraceOut(string text, string category) { if (writeTrace) { if (category.Equals("Start")) { TcTrace.TraceDelimiter(); } TcTrace.TraceOut(TraceLevel.Warning, text, category); } }
private void ListerPluginEvent(ListerMessage message, int value) { if (ListerHandle != IntPtr.Zero && ParentHandle != IntPtr.Zero) { var wParam = ((int)message * 0x10000) + value; NativeMethods.PostMessage(ParentHandle, NativeMethods.WM_COMMAND, new IntPtr(wParam), ListerHandle); #if TRACE if (WriteTrace) { TcTrace.TraceOut(TraceLevel.Info, $" << Callback: ({ListerHandle}) {message.ToString()} = {value}", null); } #endif } }
private static TPlugin CreatePluginInstance <TPlugin>(Type pluginClass) { TcTrace.TraceDelimiter(); var name = pluginClass.Assembly.GetName().Name; var types = typeof(TPlugin).GetInterfaces().Select(_ => _.Name); TcTrace.TraceOut(TraceLevel.Warning, $"[{name}]{pluginClass.FullName}", $"{string.Join(",", types)} plugin load"); var settings = GetSettings(pluginClass.Assembly); var ctor = pluginClass.GetConstructor(new[] { typeof(Settings) }); var tcPlugin = (TPlugin)ctor.Invoke(new object[] { settings }); return(tcPlugin); }
public static void StatusInfoW([MarshalAs(UnmanagedType.LPWStr)] string remoteDir, int startEnd, int operation) { try { #if TRACE _callSignature = $"{((InfoOperation) operation).ToString()} - '{remoteDir}': {((InfoStartEnd) startEnd).ToString()}"; if (Plugin.WriteStatusInfo) { TcTrace.TraceOut(TraceLevel.Warning, _callSignature, Plugin.TraceTitle, startEnd == (int)InfoStartEnd.End ? -1 : startEnd == (int)InfoStartEnd.Start ? 1 : 0); } #endif Plugin.StatusInfo(remoteDir, (InfoStartEnd)startEnd, (InfoOperation)operation); } catch (Exception ex) { ProcessException(ex); } }
public static IntPtr GetPreviewBitmapInternal(string fileToLoad, int width, int height, byte[] contentBuf) { IntPtr result; _callSignature = $"GetPreviewBitmap '{fileToLoad}' ({width} x {height})"; try { var bitmap = Plugin.GetPreviewBitmap(fileToLoad, width, height, contentBuf); result = bitmap.GetHbitmap(Plugin.BitmapBackgroundColor); TraceCall(TraceLevel.Info, result.Equals(IntPtr.Zero) ? "OK" : "None"); } catch (Exception ex) { #if TRACE TcTrace.TraceOut(TraceLevel.Error, $"{_callSignature}: {ex.Message}", $"ERROR ({Plugin.TraceTitle})"); #endif result = IntPtr.Zero; } return(result); }
public static IntPtr GetPreviewBitmapInternal(string fileToLoad, int width, int height, byte[] contentBuf) { IntPtr result; callSignature = String.Format("GetPreviewBitmap '{0}' ({1} x {2})", fileToLoad, width, height); try { Bitmap bitmap = Plugin.GetPreviewBitmap(fileToLoad, width, height, contentBuf); result = bitmap.GetHbitmap(Plugin.BitmapBackgroundColor); TraceCall(TraceLevel.Info, result.Equals(IntPtr.Zero) ? "OK" : "None"); } catch (Exception ex) { #if TRACE TcTrace.TraceOut(TraceLevel.Error, String.Format("{0}: {1}", callSignature, ex.Message), String.Format("ERROR ({0})", Plugin.TraceTitle)); #endif result = IntPtr.Zero; } return(result); }
private static void TraceError(string text, string category) { TcTrace.TraceOut(TraceLevel.Error, text, category); }