void TestModeForReceiveOperation(XModemProtocol.XModemMode mode) { var randomData = _rdg.GetRandomData(40000).ToList(); var communicator = new ComSendCollection(); var context = new Context { Mode = mode, Data = randomData, Communicator = communicator, }; var cts = new List <List <byte> >(context.Packets); cts.Add(new List <byte> { context.Options.EOT }); var expectedData = new List <List <byte> > { new List <byte> { context.Mode == XModemProtocol.XModemMode.Checksum ? context.Options.NAK : context.Options.C }, }; expectedData.AddRange(Enumerable.Repeat(new List <byte> { context.Options.ACK }, cts.Count).ToList()); IOperation operation = new ReceiveOperation(); context.Data = new List <byte>(); communicator.CollectionToSend = cts; operation.Go(context); Assert.AreEqual(expectedData, communicator.BytesRead); }
public KeepAliveJob(String endPoint, ReceiveLogin receiveLogin, ReceiveOperation[] receiveOperation) { this.isManual = false; this.EndPoint = endPoint; this.receiveLogin = receiveLogin; this.receiveOperation = receiveOperation; }
public DataTable GetReceive(string voucherID, string tablename) { IReceiveOperation receiveDAL = Recieve_Facotry.CreateRecive(tablename); ReceiveOperation taskOperation = new ReceiveOperation(receiveDAL); return(taskOperation.GetReceive(voucherID)); }
private IOperation ReceiveSetup() { IOperation operation = new ReceiveOperation(); operation.PacketReceived += (s, e) => PacketReceived?.Invoke(this, e); _context.Data = new List <byte>(); return(operation); }
/// <summary> /// 一般车辆 物料无PTA ,判断是否有等级规则 /// 多次过磅车辆 煤 EG 等 /// 用户自定义的创建 原辅料的检查单,基本信息在 RecieveGeneral /// table /// </summary> /// <param name="Receive"></param> /// <param name="Doc"></param> /// <param name="msg"></param> /// <returns></returns> public bool InsertReceive(DOCReceive receive, ReceiveGeneral general, out string msg) { string TableName = "MIGO"; if (!string.IsNullOrEmpty(receive.TableName)) { Console.WriteLine("receive" + receive.TableName); string voucherid = CreateVoucherIDByReceive(); receive.VoucherID = voucherid; Console.WriteLine(receive.VoucherID + receive.TableName); TableName = receive.TableName; } IReceiveOperation receiveDAL = Recieve_Facotry.CreateRecive(TableName); ReceiveOperation taskOperation = new ReceiveOperation(receiveDAL); return(taskOperation.InsertRecieve(receive, general, out msg)); }
public static Func <Socket, ArraySegment <byte>, SocketFlags, AsyncOperationTask <int> > MakeReceiveOperation() { var op = new ReceiveOperation(); return(op.Run); }
public KeepAliveJob(String endPoint, ReceiveOperation receiveOperation) { this.EndPoint = endPoint; this.receiveOperation = receiveOperation; }