Exemplo n.º 1
0
        static void b_TDSMessageReceived(object sender, BridgedConnection bc, Common.Message.TDSMessage msg)
        {
            Console.WriteLine(FormatDateTime() + "|" + msg);
            if (msg is Common.Message.SQLBatchMessage)
            {
                Console.Write("\tSQLBatch message ");
                Common.Message.SQLBatchMessage b = (Common.Message.SQLBatchMessage)msg;
                string strBatchText = b.GetBatchText();
                Console.Write("({0:N0} chars worth of {1:N0} bytes of data)[", strBatchText.Length, strBatchText.Length * 2);
                Console.Write(strBatchText);
                Console.WriteLine("]");
            }
            else if (msg is Common.Message.RPCRequestMessage)
            {
                try
                {
                    Common.Message.RPCRequestMessage rpc = (Common.Message.RPCRequestMessage)msg;
                    byte[] bPayload = rpc.AssemblePayload();

                    #if DEBUG
                    //using (System.IO.FileStream fs = new System.IO.FileStream(
                    //    "C:\\temp\\dev\\" + (iRPC++) + ".raw",
                    //    System.IO.FileMode.Create,
                    //    System.IO.FileAccess.Write,
                    //    System.IO.FileShare.Read))
                    //{
                    //    fs.Write(bPayload, 0, bPayload.Length);
                    //}
                    #endif
                }
                catch (Exception exce)
                {
                    Console.WriteLine("Exception: " + exce.ToString());
                }
            }
        }
Exemplo n.º 2
0
 static void b_TDSPacketReceived(object sender, BridgedConnection bc, Common.Packet.TDSPacket packet)
 {
     Console.WriteLine(FormatDateTime() + "|" + packet);
 }
Exemplo n.º 3
0
 static void b_ConnectionClosed(object sender, BridgedConnection bc, ConnectionType ct)
 {
     Console.WriteLine(FormatDateTime() + "|Connection " + ct + " closed (" + bc.SocketCouple + ")");
 }