nxtlib/src/Protocol.cs
/// <summary>
/// [Native] Open a file for writing.  When finished writing, the handle MUST be closed with 
/// the Close() command.  If an error occurs, this handle will be closed automatically.
/// </summary>
/// <param name="filename">The name of the file to write, as a string.
///   The extension must be included.  The possible file extensions are: 
/// Firmware (.rfw), Program (.rxe), OnBrick Program (.rpg), TryMe Program (.rtm),
///  Sound (.rso), Graphic (.ric), and Text (.txt).</param>
/// <param name="filesize">The size of the file to be written.</param>
/// <returns>The handle used in the write session.  Use this handle with the Close() command.</returns>
[Native] Open a file for writing.  When finished writing, the handle MUST be closed with
the Close() command.  If an error occurs, this handle will be closed automatically.
[ Native ] Open a file for writing . When finished writing the handle MUST be closed with the Close () command . If an error occurs this handle will be closed automatically .
public byte OpenWrite(string filename, UInt32 filesize)
        {
            ValidateFilename(filename, new string[] { ".rfw", ".rxe", ".ric",
                ".rso", ".rtm", ".rpg", ".txt" });
            byte[] request = new byte[26];
            request[0] = 0x01;
            request[1] = (byte)MessageCommand.OpenWrite;
            Encoding.ASCII.GetBytes(filename).CopyTo(request, 2);
            SetUInt32(filesize, request, 22);
            byte[] reply = CompleteRequest(request);
            return reply[3];
        }
public byte OpenWrite ( string filename , UInt32 filesize ) { ValidateFilename ( filename , new string [ ] { " " , " " , " " , " " , " " , " " , " " } ) ; byte [ ] request = new byte [ 26 ] ; request [ 0 ] = 0x01 ; request [ 1 ] = ( byte ) MessageCommand . OpenWrite ; Encoding . ASCII . GetBytes ( filename ) . CopyTo ( request , 2 ) ; SetUInt32 ( filesize , request , 22 ) ; byte [ ] reply = CompleteRequest ( request ) ; return reply [ 3 ] ; }
[Native] Open a file for writing.
[ Native ] Open a file for writing .
The handle used in the write session.  Use this handle with the Close() command.
The handle used in the write session . Use this handle with the Close () command .
filename
string
The name of the file to write, as a string.
The extension must be included.  The possible file extensions are:
Firmware (.rfw), Program (.rxe), OnBrick Program (.rpg), TryMe Program (.rtm),
Sound (.rso), Graphic (.ric), and Text (.txt).
The name of the file to write as a string . The extension must be included . The possible file extensions are : Firmware ( . rfw ) Program ( . rxe ) OnBrick Program ( . rpg ) TryMe Program ( . rtm ) Sound ( . rso ) Graphic ( . ric ) and Text ( . txt ) .
filesize
UInt32
The size of the file to be written.
The size of the file to be written .