Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>2006-02-22 02:33:47 +0300
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>2006-02-22 02:33:47 +0300
commit57ae6892c021efd484279080c565774db0e2b28f (patch)
treef9cb7c30eb65c5ab0ef3716c0c94f37acb4c8c61 /mcs/class/System/System.IO.Ports/SerialPort.cs
parent6ad83ea46246e8089d8d9a75faf1ec29f25e603d (diff)
2006-02-21 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* SerialPort.cs: Little work on support the Read methods. svn path=/trunk/mcs/; revision=57117
Diffstat (limited to 'mcs/class/System/System.IO.Ports/SerialPort.cs')
-rw-r--r--mcs/class/System/System.IO.Ports/SerialPort.cs25
1 files changed, 24 insertions, 1 deletions
diff --git a/mcs/class/System/System.IO.Ports/SerialPort.cs b/mcs/class/System/System.IO.Ports/SerialPort.cs
index 153e845f024..f14e673f079 100644
--- a/mcs/class/System/System.IO.Ports/SerialPort.cs
+++ b/mcs/class/System/System.IO.Ports/SerialPort.cs
@@ -516,12 +516,35 @@ namespace System.IO.Ports
public int Read (byte[] buffer, int offset, int count)
{
+ if (!isOpen)
+ throw new InvalidOperationException ();
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+ if (offset < 0 || offset >= buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+ if (count < 0 || count > buffer.Length)
+ throw new ArgumentOutOfRangeException ("count");
+ if (count > buffer.Length - offset)
+ throw new ArgumentException ("count > buffer.Length - offset");
+
return read_serial (unixFd, buffer, offset, count, readTimeout);
}
public int Read (char[] buffer, int offset, int count)
{
- throw new NotImplementedException ();
+ if (!isOpen)
+ throw new InvalidOperationException ();
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+ if (offset < 0 || offset >= buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+ if (count < 0 || count > buffer.Length)
+ throw new ArgumentOutOfRangeException ("count");
+ if (count > buffer.Length - offset)
+ throw new ArgumentException ("count > buffer.Length - offset");
+
+ byte [] bytes = encoding.GetBytes (buffer, offset, count);
+ return read_serial (unixFd, bytes, 0, bytes.Length, readTimeout);
}
byte[] read_buffer = new byte[4096];