// ***** String based **** / /// <summary> Adds a command argument. </summary> /// <param name="argument"> The argument. </param> public void AddArgument(string argument) { if (argument != null) { _lazyArguments.Add(() => CmdArgs.Add(argument)); } }
public void AddTest() { string key = "eden"; string value = "zhong"; CmdArgs arg = new CmdArgs(); KeyValuePair <string, string> kv = new KeyValuePair <string, string>(key, value); arg.Add(kv); Assert.AreEqual(arg.ArgPairs.Keys.Count, 1); Assert.IsTrue(arg.ArgPairs.Keys.Contains(key)); Assert.AreEqual(arg.ArgPairs[key], value); }
/// <summary> Adds a command argument. </summary> /// <param name="argument"> The argument. </param> public void AddArgument(Double argument) { _lazyArguments.Add(() => { if (CommunicationManager.BoardType == BoardType.Bit16) { // Not completely sure if this is needed for plain text sending. var floatArg = (float)argument; CmdArgs.Add(floatArg.ToString("R", CultureInfo.InvariantCulture)); } else { CmdArgs.Add(argument.ToString("R", CultureInfo.InvariantCulture)); } }); }
public new void AddArgument(string arg) { base.AddArgument(arg); CmdArgs.Add(arg); }
/// <summary> Adds a binary command argument. </summary> /// <param name="argument"> The argument. </param> public void AddBinArgument(bool argument) { _lazyArguments.Add(() => CmdArgs.Add(BinaryConverter.ToString(argument ? (byte)1 : (byte)0))); }
/// <summary> Adds a binary command argument. </summary> /// <param name="argument"> The argument. </param> public void AddBinArgument(UInt32 argument) { _lazyArguments.Add(() => CmdArgs.Add(BinaryConverter.ToString(argument))); }
/// <summary> Adds a binary command argument. </summary> /// <param name="argument"> The argument. </param> public void AddBinArgument(Double argument) { _lazyArguments.Add(() => CmdArgs.Add(CommunicationManager.BoardType == BoardType.Bit16 ? BinaryConverter.ToString((float)argument) : BinaryConverter.ToString(argument))); }
// ***** Binary **** / /// <summary> Adds a binary command argument. </summary> /// <param name="argument"> The argument. </param> public void AddBinArgument(string argument) { _lazyArguments.Add(() => CmdArgs.Add(Escaping.Escape(argument))); }
/// <summary> Adds a command argument. </summary> /// <param name="argument"> The argument. </param> public void AddArgument(UInt32 argument) { // Make sure the other side can read this: on a 16 processor, read as Long _lazyArguments.Add(() => CmdArgs.Add(argument.ToString(CultureInfo.InvariantCulture))); }
/// <summary> Adds a command argument. </summary> /// <param name="argument"> The argument. </param> public void AddArgument(UInt16 argument) { _lazyArguments.Add(() => CmdArgs.Add(argument.ToString(CultureInfo.InvariantCulture))); }
/// <summary> Adds a command argument. </summary> /// <param name="argument"> The argument. </param> public void AddArgument(float argument) { _lazyArguments.Add(() => CmdArgs.Add(argument.ToString("R", CultureInfo.InvariantCulture))); }