示例#1
0
        private void ASyncDataRecive(IAsyncResult asynResult)
        {
            try
            {
                UserSession css = (UserSession)asynResult.AsyncState;

                if (css.AsynSocket == null)
                {
                    return;
                }
                int i = css.AsynSocket.EndReceive(asynResult);

                if (i == 0)
                {
                    return;
                }

                string Unzipdata = UZip.Unzip(System.Text.ASCIIEncoding.ASCII.GetString(css.AsyncBuffer, 0, i));
                css.AsyncData.Append(Unzipdata);

                if (!css.AsyncData.ToString().Contains("\0"))
                {
                    css.AsynSocket.BeginReceive(css.AsyncBuffer, 0, UserSession.BufferSize, SocketFlags.None, new AsyncCallback(ASyncDataRecive), css);
                }
                else
                {
                    css.AsyncData = FilterData(css);
                    css.AsynSocket.BeginReceive(css.AsyncBuffer, 0, UserSession.BufferSize, SocketFlags.None, new AsyncCallback(ASyncDataRecive), css);
                }
            }
            catch (Exception ex)
            {
                OnServerDownError(ex);
            }
        }
示例#2
0
        private DataSet SyncDataRecive()
        {
            try
            {
                userSession.SyncData = new StringBuilder();

                int i = userSession.SynSocket.Receive(userSession.SyncBuffer);

                while (true)
                {
                    string Unzipdata = UZip.Unzip(System.Text.ASCIIEncoding.ASCII.GetString(userSession.SyncBuffer, 0, i));
                    userSession.SyncData.Append(Unzipdata);

                    if (!userSession.SyncData.ToString().Contains("\0"))
                    {
                        i = userSession.SynSocket.Receive(userSession.SyncBuffer);
                    }
                    else
                    {
                        break;
                    }
                }

                if (UData.IsValidXml(userSession.SyncData.ToString()))
                {
                    return(UData.LoadDataSet(userSession.SyncData.ToString()));
                }
                else
                {
                    DataSet ds = new DataSet();
                    return(ds);
                }
            }
            catch (Exception ex)
            {
                OnServerDownError(ex);

                return(new DataSet());
            }
        }
示例#3
0
 public static DataSet UnzipDataSet(string xsd, string ds)
 {
     return(UData.LoadDataSet(xsd, UZip.Unzip(ds)));
 }
示例#4
0
 public static DataTable UnzipDataTable(string xsd, string dt)
 {
     return(UData.LoadDataTable(xsd, UZip.Unzip(dt)));
 }
示例#5
0
 public void LoadXml(string dt)
 {
     UData.LoadDataTable(this.DataTable, UZip.Unzip(dt));
 }