Exemplo n.º 1
0
        /// <summary>
        /// Executes the log.
        /// </summary>
        /// <param name="TSession">The T session.</param>
        /// <param name="TSessionIp">The T session ip.</param>
        /// <param name="TData">The T data.</param>
        /// <param name="TLogType">Type of the T log.</param>
        private void ExecuteLog(string TSession, string TASync, string TSessionIp, byte[] TInPacket, byte[] TOutPacket)
        {
            DbCommand sqliteCommand = __sqliteDb.GetSqlStringCommand(string.Format(@"
    INSERT INTO {0}([TSession],[TASync],[TargetIp],[TInPacket],[TOutPacket],[TLogDate]) 
                    VALUES(?,?,?,?,?,?)
", this.__CurrentTable));

            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, TSession);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, TASync);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, TSessionIp);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.Binary, TInPacket);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.Binary, TOutPacket);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.DateTime, DateTime.Now);
            sqliteCommand.ExecuteNonQuery();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Executes the log.
        /// </summary>
        /// <param name="TSession">The T session.</param>
        /// <param name="TSessionIp">The T session ip.</param>
        /// <param name="TData">The T data.</param>
        /// <param name="TLogType">Type of the T log.</param>
        private void ExecuteLog(string TSession, string TASync, string TSessionIp, byte[] TInPacket, byte[] TOutPacket)
        {
            if (!(AsyncStackNet.Instance.ASyncSetup.AllowLog ?? false))
            {
                return;
            }
            DbCommand sqliteCommand = __sqliteDb.GetSqlStringCommand(string.Format(@"
    INSERT INTO {0}([TSession],[TASync],[TargetIp],[TInPacket],[TOutPacket],[TLogDate],[IsProcess]) 
                    VALUES(?,?,?,?,?,?,?)
", this.__CurrentTable));

            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, TSession);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, TASync);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, TSessionIp);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, Encoding.GetEncoding("gb2312").GetString(TInPacket));
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.String, Encoding.GetEncoding("gb2312").GetString(TOutPacket));
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.DateTime, DateTime.Now);
            __sqliteDb.AddInParameter(sqliteCommand, System.Data.DbType.Boolean, false);
            sqliteCommand.ExecuteNonQuery();
        }