Example #1
0
 public CommandCalculatePi(ITransportMedium medium, int nDecimalPlaces) : base(medium, 3)
 {
     if (nDecimalPlaces < 0 || nDecimalPlaces > 255)
     {
         throw new ArgumentException("Decimal Places must be bebetween 0 and 255.");
     }
     decimalPlaces = nDecimalPlaces;
 }
Example #2
0
 public CommandBase(ITransportMedium medium, int commandType)
 {
     CommandType = (byte)commandType;
     if (CommandType < 1 || CommandType > 4)
     {
         throw new ArgumentException($@"Invalid command type [ {CommandType} ]");
     }
     Medium = medium;
 }
Example #3
0
 /// <summary>
 /// Connects the socket to the server.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnConnect_Click(object sender, EventArgs e)
 {
     try
     {
         Medium = new SocketMedium();
         Medium.Connect(tbHost.Text, (int)nudPort.Value);
         if (Medium.Connected)
         {
             MessageBox.Show("Connected to the server.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Connection failed to the server.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Connection failed to the server: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #4
0
 public void setTransportMedium(ITransportMedium transportMedium)
 {
     this._transportMedium = transportMedium;
 }
Example #5
0
 public Transport(ITransportMedium transportMedium)
 {
     this._transportMedium = transportMedium;
 }
 public CommandReverseInteger(ITransportMedium medium, Func <uint, uint> reverseFunction) : base(medium, 2)
 {
     ReverseFunction = reverseFunction;
 }
 public CommandAddTwoIntegers(ITransportMedium medium, ushort value1, ushort value2)
     : base(medium, 4)
 {
     val1 = value1;
     val2 = value2;
 }
Example #8
0
 public CommandReverseString(ITransportMedium medium, string parameter) : base(medium, 1)
 {
     param = parameter;
 }