/// <exception cref="System.IO.IOException" /> protected internal NovacomDeviceList(INovacomStream stream) { string line; devices = new List<NovaDeviceInfo>(); while (true) { line = stream.ReadLine(); if (line == string.Empty) { break; } devices.Add(new NovaDeviceInfo(line)); } }
/// <exception cref="System.IO.IOException" /> /// <exception cref="Palm.Novacom.NovacomException" /> internal void StreamToFile(string hostFileName, INovacomStream deviceStream) { FileStream fileStream = new FileStream(hostFileName, FileMode.Create, FileAccess.Write); byte[] buffer = new byte[1024 * 1024]; long total = 0; while (true) { int count = deviceStream.Read(buffer); if (count == -1) { break; } fileStream.Write(buffer, 0, count); total += count; if (count < buffer.Length) { break; } } fileStream.Close(); }