public void Can_Read_Directory_Rdy_File() { RdyFile rdy; using (var stream = File.OpenRead(@"TestData\dir001.rdy")) { rdy = RdyFile.Read(stream); } Assert.IsNotNull(rdy); Assert.IsTrue(rdy.IsDirectoryFile); Assert.AreEqual('z', rdy.Header.TableType); Assert.AreEqual(1, rdy.Header.TableId); Assert.AreEqual(87, rdy.Header.TotalCharacters); Assert.AreEqual(3, rdy.Records.Count); }
public void Can_Set_Fixed_Clock_Transitions() { var rdy = RdyFile.Read(@"TestData\sys001.rdy"); var sys = new SystemParameters(rdy); Assert.AreEqual(0, sys.ClockTransitions.Count); sys.ClockTransitions = new ClockTransition[] { new FixedClockTransition(1, new DateTime(2013, 3, 10, 2, 0, 0)), new FixedClockTransition(-1, new DateTime(2013, 11, 3, 2, 0, 0)) }; var value = sys.Parameters[5]; Assert.AreEqual("11003130200+110311130200-1", value); }
public void Can_Program_Clock_Transition() { var rdy = RdyFile.Read(@"TestData\sys001.rdy"); var sys = new SystemParameters(rdy); sys.ClockTransitions = new ClockTransition[] { new FixedClockTransition(1, new DateTime(2013, 3, 10, 2, 0, 0)), new FixedClockTransition(-1, new DateTime(2013, 11, 3, 2, 0, 0)) }; using (var client = TestSettings.Connect()) using (var p = client.Terminal.Programming()) { var rdyFile = sys.GetRdyFile(); p.UploadTableFromRdy(rdyFile); } }
public void Can_Parse_System_Parameters_Rdy_File() { var rdy = RdyFile.Read(@"TestData\sys001.rdy"); Assert.IsNotNull(rdy); Assert.IsFalse(rdy.IsDirectoryFile); Assert.AreEqual('p', rdy.Header.TableType); Assert.AreEqual(001, rdy.Header.TableId); var sys = new SystemParameters(rdy); Assert.IsNotNull(sys); Assert.AreEqual(10, sys.Parameters.Count); Assert.AreEqual("05", sys.Parameters[0]); Assert.AreEqual("B", sys.Parameters[1]); Assert.AreEqual("00000", sys.Parameters[2]); Assert.AreEqual("Y", sys.Parameters[3]); Assert.AreEqual("15", sys.Parameters[4]); Assert.AreEqual("", sys.Parameters[5]); Assert.AreEqual("50", sys.Parameters[6]); Assert.AreEqual("N", sys.Parameters[9]); Assert.AreEqual("3", sys.Parameters[11]); Assert.AreEqual("--", sys.Parameters[13]); }
/// <summary> /// Returns an awaitable task that uploads a stream containing an RDY file to the terminal. /// </summary> /// <param name="stream">The stream containing the RDY file content.</param> /// <param name="replace">True to replace any existing table. False to throw an exception if the table exists already. (True by default.)</param> /// <param name="force">True to upload the file even if it fails validation. (False by default.)</param> public async Task UploadTableFromStreamAsync(Stream stream, bool replace = true, bool force = false) { var rdy = RdyFile.Read(stream, force); await UploadTableFromRdyAsync(rdy, replace, force); }
/// <summary> /// Uploads a stream containing an RDY file to the terminal. /// </summary> /// <param name="stream">The stream containing the RDY file content.</param> /// <param name="replace">True to replace any existing table. False to throw an exception if the table exists already. (True by default.)</param> /// <param name="force">True to upload the file even if it fails validation. (False by default.)</param> public void UploadTableFromStream(Stream stream, bool replace = true, bool force = false) { var rdy = RdyFile.Read(stream, force); UploadTableFromRdy(rdy, replace, force); }