コード例 #1
0
ファイル: GetVersionXml.cs プロジェクト: cuitsl/asyncsdk
 public FileSendSocket(string fileName,eTerm363Session Session)
 {
     this.FileName = new FileInfo(fileName).FullName;
     this.TargetSession = Session;
     FileSize=new FileInfo(fileName).Length;
     fs = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, __myBuffer.Length, true);
     FileNameBuffer =Encoding.GetEncoding(@"gb2312").GetBytes( fileName.PadLeft(25, ' '));
 }
コード例 #2
0
 /// <summary>
 /// Updates the session.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 private void UpdateSession(eTerm363Session TSession)
 {
     try {
         TSessionSetup Seup    = ASyncSetup.SessionCollection.SingleOrDefault <TSessionSetup>(Fun => Fun.SessionPass == TSession.userPass && Fun.SessionCode == TSession.userName);
         SocketTraffic Traffic = Seup.Traffics[Seup.Traffics.IndexOf(new SocketTraffic(DateTime.Now.ToString(@"yyyyMM")))];
         Traffic.Traffic++;
         Traffic.UpdateDate = DateTime.Now;
     }
     catch { }
 }
コード例 #3
0
ファイル: GetUpdateBin.cs プロジェクト: cuitsl/asyncsdk
        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);
                    }
                );
        }
コード例 #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)
        {
            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);
            }
                );
        }
コード例 #5
0
 /// <summary>
 /// Disconnects the T session.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 private void DisconnectTSession(eTerm363Session TSession)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new TSessionCallback(DisconnectTSession), TSession);
         return;
     }
     try {
         //SQLiteExecute.Instance.BeginExecute(TSession.userName, (TSession.AsyncSocket.RemoteEndPoint as IPEndPoint).Address.ToString(),new byte[]{}, @"DisconnectTSession");
         this.lstSession.Items.Remove(this.lstSession.Items[TSession.SessionId.ToString()]);
     }
     catch { }
 }
コード例 #6
0
 /// <summary>
 /// Updates the T session sent.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 private void updateTSessionSent(eTerm363Session TSession)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new TSessionCallback(updateTSessionSent), TSession);
         return;
     }
     try {
         //SQLiteExecute.Instance.BeginExecute(TSession.userName, (TSession.AsyncSocket.RemoteEndPoint as IPEndPoint).Address.ToString(), TSession.LastPacket.OriginalBytes, @"TSessionSent");
         ListViewItem item = this.lstSession.Items[TSession.SessionId.ToString()];
         item.ImageKey         = @"Circle_Green.png";// ? @"Circle_Yellow.png" : @"Circle_Green.png";
         item.SubItems[1].Text = TSession.userName;
         item.SubItems[2].Text = string.Format(@"{0} KBytes", TSession.TotalBytes.ToString(@"f2"));
         item.SubItems[3].Text = TSession.TotalCount.ToString();
         item.SubItems[4].Text = string.Format(@"{0} Bytes", TSession.CurrentBytes.ToString(@"f2"));
         item.SubItems[5].Text = TSession.LastActive.ToString(@"HH:mm:ss");
     }
     catch { }
 }
コード例 #7
0
ファイル: AsyncStackNet.cs プロジェクト: cuitsl/asyncsdk
 /// <summary>
 /// Updates the session.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 private void UpdateSession(eTerm363Session TSession)
 {
     try {
         TSessionSetup Seup = ASyncSetup.SessionCollection.SingleOrDefault<TSessionSetup>(Fun => Fun.SessionPass == TSession.userPass && Fun.SessionCode == TSession.userName);
         SocketTraffic Traffic = Seup.Traffics[Seup.Traffics.IndexOf(new SocketTraffic(DateTime.Now.ToString(@"yyyyMM")))];
         Traffic.Traffic++;
         Traffic.UpdateDate = DateTime.Now;
     }
     catch { }
 }
コード例 #8
0
ファイル: AsyncStackNet.cs プロジェクト: cuitsl/asyncsdk
 /// <summary>
 /// Gets the active async.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 /// <returns></returns>
 private void GetActiveAsync(eTerm363Session TSession)
 {
     if (TSession.Async443 != null) return;
     lock (this.__asyncList) {
         foreach (var connect in
                 from entry in __asyncList
                 from e in entry.groups
                 where
                     (
                         entry.Connected
                         &&
                         entry.SessionId > 0
                         &&
                         entry.TSession == null
                         &&
                         entry.GroupCode == TSession.userGroup
                     )
                     ||
                     (e==TSession.userGroup)
                 orderby entry.TotalCount ascending
                 select entry) {
             TSession.Async443 = connect;
             connect.TSession = TSession;
             if (OnTSessionAssign != null)
                 OnTSessionAssign(TSession, new AsyncEventArgs<eTerm363Session>(TSession));
             return;
         }
     }
 }
コード例 #9
0
ファイル: AsyncStackNet.cs プロジェクト: cuitsl/asyncsdk
 /// <summary>
 /// Fires the excetion.
 /// </summary>
 /// <param name="e">The <see cref="System.IO.ErrorEventArgs"/> instance containing the event data.</param>
 /// <param name="Session">The session.</param>
 private void FireExcetion(ErrorEventArgs e, eTerm363Session Session)
 {
     if (this.OnExecuteException != null)
         this.OnExecuteException(Session, e);
 }
コード例 #10
0
ファイル: AsyncStackNet.cs プロジェクト: cuitsl/asyncsdk
 /// <summary>
 /// 给指令客户端发送数据包.
 /// </summary>
 /// <param name="TSession">指定会话.</param>
 /// <param name="Pakcet">数据包.</param>
 public void SendPacket(eTerm363Session TSession, byte[] Pakcet)
 {
     if (Pakcet.Length <= 0) return;
     __asyncServer.SendPacket(TSession, Pakcet);
 }
コード例 #11
0
ファイル: frmMain.cs プロジェクト: cuitsl/asyncsdk
 /// <summary>
 /// Updates the T session.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 private void updateTSessionRead(eTerm363Session TSession)
 {
     if (this.InvokeRequired) {
         this.BeginInvoke(new TSessionCallback(updateTSessionRead), TSession);
         return;
     }
     try {
         //SQLiteExecute.Instance.BeginExecute(TSession.userName, (TSession.AsyncSocket.RemoteEndPoint as IPEndPoint).Address.ToString(), TSession.LastPacket.OriginalBytes, @"TSessionReadPacket");
         ListViewItem item = this.lstSession.Items[TSession.SessionId.ToString()];
         item.ImageKey = @"Circle_Yellow.png";// ? @"Circle_Yellow.png" : @"Circle_Green.png";
         item.SubItems[1].Text = TSession.userName;
         item.SubItems[2].Text = string.Format(@"{0} KBytes", TSession.TotalBytes.ToString(@"f2"));
         item.SubItems[3].Text = TSession.TotalCount.ToString();
         item.SubItems[4].Text = string.Format(@"{0} Bytes", TSession.CurrentBytes.ToString(@"f2"));
         item.SubItems[5].Text = TSession.LastActive.ToString(@"HH:mm:ss");
     }
     catch { }
 }
コード例 #12
0
ファイル: frmMain.cs プロジェクト: cuitsl/asyncsdk
 /// <summary>
 /// Disconnects the T session.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 private void DisconnectTSession(eTerm363Session TSession)
 {
     if (this.InvokeRequired) {
         this.BeginInvoke(new TSessionCallback(DisconnectTSession), TSession);
         return;
     }
     try {
         //SQLiteExecute.Instance.BeginExecute(TSession.userName, (TSession.AsyncSocket.RemoteEndPoint as IPEndPoint).Address.ToString(),new byte[]{}, @"DisconnectTSession");
         this.lstSession.Items.Remove(this.lstSession.Items[TSession.SessionId.ToString()]);
     }
     catch { }
 }
コード例 #13
0
ファイル: frmMain.cs プロジェクト: cuitsl/asyncsdk
 /// <summary>
 /// Accepts the T session.
 /// </summary>
 /// <param name="TSession">The T session.</param>
 private void AcceptTSession(eTerm363Session TSession)
 {
     if (this.InvokeRequired) {
         this.BeginInvoke(new TSessionCallback(AcceptTSession), TSession);
         return;
     }
     try {
         ListViewItem item = new ListViewItem(new string[] {
         (TSession.AsyncSocket.RemoteEndPoint as IPEndPoint).ToString(),
         string.Empty,
         @"0 KByes",
         @"0",
         @"0",
         @"00:00:00"
     }, @"Circle_Yellow.png") { Name = TSession.SessionId.ToString() };
         item.Tag = TSession;
         //SQLiteExecute.Instance.BeginExecute(TSession.userName, (TSession.AsyncSocket.RemoteEndPoint as IPEndPoint).Address.ToString(), new byte[]{}, @"AcceptTSession");
         this.lstSession.Items.Add(item);
     }
     catch { }
 }