public ExtronSwitcher(uint comport)
        {
            if (comport == 0)
                throw new ArgumentOutOfRangeException();

            this.port = new SerialStream("COM" + comport.ToString());

            this.port.SetPortSettings(9600, SerialStream.FlowControl.None,
                                      SerialStream.Parity.None, 8,
                                      SerialStream.StopBits.One);
            this.port.SetTimeouts(0, 0, 500, 0, 500);

            this.RequestInputStatus();
        }
 void PlayOnPalm(string strFile, byte[] abPcm)
 {
     try {
         SerialStream stm = new SerialStream("com" + m_nComPort + ":", FileAccess.Write);
         stm.SetPortSettings(19200, 8, SerialStream.StopBits.One, SerialStream.Parity.None, SerialStream.FlowControl.Hardware);
         stm.WriteByte((byte)'s');
         stm.WriteByte((byte)'c');
         stm.WriteByte((byte)'o');
         stm.WriteByte((byte)'t');
         stm.WriteByte((byte)'t');
         stm.WriteByte((byte)'l');
         stm.WriteByte((byte)'u');
         stm.WriteByte(0);
         foreach (char ch in strFile) {
             stm.WriteByte((byte)ch);
         }
         stm.WriteByte(0);
         stm.WriteByte((byte)((abPcm.Length >> 8) & 0xff));
         stm.WriteByte((byte)(abPcm.Length & 0xff));
         foreach (byte b in abPcm)
             stm.WriteByte(b);
         stm.Close();
     } catch {
         MessageBox.Show("Error sending data to Palm. Hotsync closed?");
     }
 }
        private void Dispose(bool disposing)
        {
            if (this.disposed)
                return;

            if (disposing)
            {
                this.port.Close();
                this.port = null;

                this.portstatus = null;
            }

            this.disposed = true;
        }
 private void menuItemTestCom2_Click(object sender, System.EventArgs e)
 {
     #if false
     SerialStream stm = new SerialStream("com2:", FileAccess.Write);
     stm.SetPortSettings(19200, 8, SerialStream.StopBits.One, SerialStream.Parity.None, SerialStream.FlowControl.None);
     byte[] ab = new Byte[] { (byte)'h', (byte)'e', (byte)'l', (byte)'l', (byte)'o', (byte)' ', (byte)'w', (byte)'o', (byte)'r', (byte)'l', (byte)'d', 0 };
     stm.Write(ab, 0, ab.Length);
     stm.Close();
     #endif
 }