コード例 #1
0
        //

        #endregion Lister Callbacks

        #region Tracing

#if TRACE
        private static void TraceOut(TraceLevel level, string text, string category)
        {
            if (writeTrace)
            {
                TcTrace.TraceOut(level, text, category);
            }
        }
コード例 #2
0
 private static void TraceOut(string text, string category)
 {
     if (writeTrace)
     {
         if (category.Equals("Start"))
         {
             TcTrace.TraceDelimiter();
         }
         TcTrace.TraceOut(TraceLevel.Warning, text, category);
     }
 }
コード例 #3
0
        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
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
ファイル: WlxWrapper.cs プロジェクト: r-Larch/TcBuild
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 private static void TraceError(string text, string category)
 {
     TcTrace.TraceOut(TraceLevel.Error, text, category);
 }