public string GetVennData(string type) { DateTime edDate = DateTime.Now; DateTime stDate = edDate.AddDays(-7); return(DataAnalyze.GetVennData(type, stDate, edDate)); }
public MainWindow() { InitializeComponent(); read = new FileInfoRead(); concenIPText.Text = read.concentratorIP; concenPortText.Text = read.concentratorPORT; concenIPText.IsReadOnly = true; concenIPText.Background = Brushes.Gray; concenPortText.IsReadOnly = true; concenPortText.Background = Brushes.Gray; response = new DataAnalyze(); }
private void buttonAnalyze_Click_1(object sender, EventArgs e) { var st = Stopwatch.StartNew(); if (DataAnalyze.AnalyzeUserPreferredData()) { var m = st.ElapsedMilliseconds; MessageBox.Show("Successfully analyzed!" + m.ToString()); } else { MessageBox.Show("File not found containing user preferrences to analyze."); } }
private void buttonAnalyzeMoreData_Click(object sender, EventArgs e) { DataAnalyze.AnalyzeUserPreferredData(); }
private void ReceiveDataAsync(IAsyncResult Idata) { int recv = _serverSock.EndReceiveFrom(Idata, ref so.remote); if (!isLegal(so.remote)) { so.ClearBuffer(); _serverSock.BeginReceiveFrom(so.buffer, 0, so.buffer.Length, SocketFlags.None, ref so.remote, new AsyncCallback(ReceiveDataAsync), so.remote); return; } string receiveData = Encoding.ASCII.GetString(so.buffer, 0, recv); DataAnalyze op = new DataAnalyze(); string result = op.DataAnalyzeResult(receiveData);//获取数据库操作结果 if (op.GetSqlOrder() != null) { AsyncSocketClientMsg sendMeg = new AsyncSocketClientMsg(so.remote, result); //发送第一个子数据报 byte[] resultByte = Encoding.ASCII.GetBytes(result); byte[] sendData = new byte[1024]; int copylen = (resultByte.Length > 1020) ? 1020 : resultByte.Length; Buffer.BlockCopy(resultByte, 0, sendData, 4, copylen); sendData[0] = (byte)(sendMeg.DgramNum / 256); sendData[1] = (byte)(sendMeg.DgramNum % 256); sendData[2] = 0x00; sendData[3] = 0x01; _serverSock.BeginSendTo(sendData, 0, sendData.Length, SocketFlags.None, so.remote, new AsyncCallback(SendData), so.remote); lock (clientMsg) { clientMsg.Remove(GetClientMsg(clientMsg, so.remote));//删除重复请求客户端信息 clientMsg.Add(sendMeg); } } else { int senOrder = GetDgramOrder(so.buffer); AsyncSocketClientMsg recClient = GetClientMsg(clientMsg, so.remote); if (recClient != null) { if (recClient.DgramNum <= senOrder)//检测是否发送完成:发送完成 { lock (clientMsg) { clientMsg.Remove(recClient); } } else//发送未完成 { byte[] resultByte = Encoding.ASCII.GetBytes(recClient.sendMeg); byte[] sendData = new byte[1024]; int copyLength = (recClient.DgramNum == (senOrder + 1)) ? resultByte.Length % 1020 : 1020;//每次发送的字节数 Buffer.BlockCopy(resultByte, senOrder * 1020, sendData, 4, copyLength); sendData[0] = (byte)(recClient.DgramNum / 256); sendData[1] = (byte)(recClient.DgramNum % 256); sendData[2] = (byte)((senOrder + 1) / 256); sendData[3] = (byte)((senOrder + 1) % 256); _serverSock.BeginSendTo(sendData, 0, sendData.Length, SocketFlags.None, so.remote, new AsyncCallback(SendData), so.remote); } } } so.ClearBuffer(); _serverSock.BeginReceiveFrom(so.buffer, 0, so.buffer.Length, SocketFlags.None, ref so.remote, new AsyncCallback(ReceiveDataAsync), so.remote); }
public static void Main() { var testExample = new DataAnalyze(); testExample.Output(); }