Exemple #1
0
 public Database(QueryHandler queryHandler)
 {
     if (queryHandler == null)
     {
         throw new ArgumentNullException(nameof(queryHandler));
     }
     QueryHandler = queryHandler;
     Logger       = new ProxyLogger(this);
     volatileDatabaseItems.CompleteAdding();
 }
        public void TestLogInfoWritesToTraceListener()
        {
            var traceListener = new Mock <ITraceListener>(MockBehavior.Strict);

            traceListener.Setup(t => t.WriteTestOutput("SpecBind Info: Hello World!"));

            var proxyLogger = new ProxyLogger(traceListener.Object);

            proxyLogger.Info("Hello {0}", "World!");

            traceListener.VerifyAll();
        }
Exemple #3
0
        public static void HBHCommonSVAfter(long svID, object result, bool isSucess, string message, string resultValue)
        {
            if (svID > 0)
            {
                if (result != null
                    )
                {
                    //string resultXml = EntitySerialization.EntitySerial(result);
                    string resultXml = Newtonsoft.Json.JsonConvert.SerializeObject(result);

                    ProxyLogger.UpdateTransferSV(svID, resultXml, isSucess, message, resultValue, string.Empty);
                }
            }
        }
Exemple #4
0
        public static long HBHCommonSVBefore(object bpObj)
        {
            long svID = -1;

            if (IsLog)
            {
                svID = ProxyLogger.CreateTransferSV(bpObj.GetType().FullName
                                                    //, EntitySerialization.EntitySerial(bpObj)
                                                    , Newtonsoft.Json.JsonConvert.SerializeObject(bpObj)
                                                    , bpObj.GetType().FullName, string.Empty);
            }

            // 重置上下文
            U9Helper.SetDefaultContext();

            return(svID);
        }
Exemple #5
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build();
        LoadSavedSettings();

        ProxyLogger.Init();
        ProxyLogger.OnLogLine += new ProxyLogger.Log(Logger_OnLogLine);

        tabsMain.Page = 0;

        string font;

        if (PlatformDetection.IsMac)
        {
            txtSummary.ModifyFont(Pango.FontDescription.FromString("monospace bold"));
            font = "monospace";
            IgeMacIntegration.IgeMacMenu.GlobalKeyHandlerEnabled = true;
            IgeMacIntegration.IgeMacMenu.MenuBar = menuMain;
            MenuItem quit = new MenuItem("Quit");
            quit.Activated += (object sender, EventArgs e) => OnExitActionActivated(sender, e);
            IgeMacIntegration.IgeMacMenu.QuitMenuItem = quit;
            menuMain.Hide();
            menuSeparator.Hide();
        }
        else
        {
            txtSummary.ModifyFont(Pango.FontDescription.FromString("monospace bold 9"));
            font = "monospace 9";
        }

        btnLoadPlugin.Sensitive = false;
        txtPort.TextInserted   += (object o, TextInsertedArgs args) =>
        {
            if (args.Length != 1)
            {
                return;
            }
            if (!char.IsDigit(args.Text[0]))
            {
                txtPort.DeleteText(args.Position - 1, args.Position);
            }
        };

        InitProxyFilters();

        txtRequest.ModifyFont(Pango.FontDescription.FromString(font));
        CreateTags(txtRequest.Buffer);
        txtRequestRaw.ModifyFont(Pango.FontDescription.FromString(font));
        txtRequestNotation.ModifyFont(Pango.FontDescription.FromString(font));

        txtResponse.ModifyFont(Pango.FontDescription.FromString(font));
        CreateTags(txtResponse.Buffer);
        txtResponseRaw.ModifyFont(Pango.FontDescription.FromString(font));
        txtResponseNotation.ModifyFont(Pango.FontDescription.FromString(font));


        sessionLogScroller.Add(messages  = new MessageScroller(this));
        scrolledwindowPlugin.Add(plugins = new PluginsScroller());
        messages.CursorChanged          += messages_CursorChanged;
        StatsTimer          = new Timer(1000.0);
        StatsTimer.Elapsed += StatsTimer_Elapsed;
        StatsTimer.Enabled  = true;

        ProxyManager.OnLoginResponse   += ProxyManager_OnLoginResponse;
        ProxyManager.OnPacketLog       += ProxyManager_OnPacketLog;
        ProxyManager.OnCapabilityAdded += new ProxyManager.CapsAddedHandler(ProxyManager_OnCapabilityAdded);
        ProxyManager.OnEventMessageLog += new ProxyManager.EventQueueMessageHandler(ProxyManager_OnEventMessageLog);
        ProxyManager.OnMessageLog      += new ProxyManager.MessageLogHandler(ProxyManager_OnMessageLog);
    }