コード例 #1
0
        // ***** 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));
            }
        }
コード例 #2
0
ファイル: CmdArgsTests.cs プロジェクト: edenzhong/MyCSLib
        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);
        }
コード例 #3
0
 /// <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);
 }
コード例 #5
0
 /// <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)));
 }
コード例 #6
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)));
 }
コード例 #7
0
 /// <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)));
 }
コード例 #8
0
        // ***** 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)));
        }
コード例 #9
0
 /// <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)));
 }
コード例 #10
0
 /// <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)));
 }
コード例 #11
0
 /// <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)));
 }