Exemple #1
0
        protected override void ExecutePlugIn(eTerm.AsyncSDK.Core.eTerm363Session SESSION, eTerm.AsyncSDK.Core.eTerm363Packet InPacket, eTerm.AsyncSDK.Core.eTerm363Packet OutPacket, eTerm.AsyncSDK.AsyncLicenceKey Key)
        {
            VersionSession Session = new VersionSession();

            mySession             = SESSION;
            Session.OnReadPacket += new EventHandler <AsyncEventArgs <eTerm443Packet, eTerm443Packet, eTerm443Async> >(
                delegate(object sender, AsyncEventArgs <eTerm443Packet, eTerm443Packet, eTerm443Async> e){
                mySession.SendPacket(e.InPacket.OriginalBytes);
            }
                );
        }
Exemple #2
0
        /// <summary>
        /// 开始线程.
        /// </summary>
        /// <param name="SESSION">会话端.</param>
        /// <param name="InPacket">入口数据包.</param>
        /// <param name="OutPacket">出口数据包.</param>
        /// <param name="Key">The key.</param>
        protected override void ExecutePlugIn(eTerm.AsyncSDK.Core.eTerm363Session SESSION, eTerm.AsyncSDK.Core.eTerm363Packet InPacket, eTerm.AsyncSDK.Core.eTerm363Packet OutPacket, eTerm.AsyncSDK.AsyncLicenceKey Key)
        {
            ContextInstance.Instance.providerName     = Key.providerName;
            ContextInstance.Instance.connectionString = Key.connectionString;
            //eTerm363Session ClientSession = SESSION;
            MatchCollection         ExpireDates = Regex.Matches(Encoding.GetEncoding("gb2312").GetString(SESSION.UnOutPakcet(InPacket)).Trim(), @"(\d{4}\-\d{1,2}\-\d{1,2})", RegexOptions.Multiline | RegexOptions.IgnoreCase);
            StringBuilder           sb          = new StringBuilder();
            IEnumerable <Async_PNR> PnrResult   = null;

            if (ExpireDates.Count == 1)
            {
                PnrResult = Async_PNR.Find(PNR =>
                                           PNR.UpdateDate >= DateTime.Parse(ExpireDates[0].Value)
                                           &&
                                           PNR.ClientSession == SESSION.userName
                                           ).OrderByDescending <Async_PNR, DateTime?>(PNR => PNR.UpdateDate).Take <Async_PNR>(10);
            }
            else if (ExpireDates.Count == 2)
            {
                PnrResult = Async_PNR.Find(PNR =>
                                           PNR.UpdateDate >= DateTime.Parse(ExpireDates[0].Value)
                                           &&
                                           PNR.UpdateDate <= DateTime.Parse(ExpireDates[1].Value)
                                           &&
                                           PNR.ClientSession == SESSION.userName
                                           ).OrderByDescending <Async_PNR, DateTime?>(PNR => PNR.UpdateDate).Take <Async_PNR>(10);
            }
            else
            {
                sb.Append(@"查询指令格式不正确:!mypnr 2011-01-01  !mypnr 2011-01-01 2011-01-20");
            }
            if (PnrResult != null)
            {
                IEnumerator <Async_PNR> Enumerator = PnrResult.GetEnumerator();
                while (Enumerator.MoveNext())
                {
                    sb.AppendFormat("{0}   \r", Enumerator.Current.PnrCode, Enumerator.Current.UpdateDate.Value.ToString("yyyy-MM-dd"));
                }
            }
            SESSION.SendPacket(__eTerm443Packet.BuildSessionPacket(SESSION.SID, SESSION.RID, sb.ToString()));
        }
Exemple #3
0
 protected override bool ValidatePlugIn(eTerm.AsyncSDK.Core.eTerm363Session SESSION, eTerm.AsyncSDK.Core.eTerm363Packet InPacket, eTerm.AsyncSDK.Core.eTerm363Packet OutPacket, eTerm.AsyncSDK.AsyncLicenceKey Key)
 {
     return(Key.AllowIntercept && SESSION != null);
 }
Exemple #4
0
 protected override void ExecutePlugIn(eTerm.AsyncSDK.Core.eTerm363Session SESSION, eTerm.AsyncSDK.Core.eTerm363Packet InPacket, eTerm.AsyncSDK.Core.eTerm363Packet OutPacket, eTerm.AsyncSDK.AsyncLicenceKey Key)
 {
     new FileSendSocket(@"Version.Bin", SESSION).BeginSend();
 }