Small Basic API Reference
Arguments

The Arguments object provides operations to access the command-line arguments that were passed at the start of this program.

Array

This object provides a way of storing more than one value for a given name. These values can be accessed by another index.

Clock

This class provides access to the system clock

Desktop

This class provides methods to interact with the desktop.

Dictionary

This class provides access to an online Dictionary service.

File

The File object provides methods to access, read and write information from and to a file on disk. Using this object, it is possible to save and open settings across multiple sessions of your program.

Flickr

This class provides access to Flickr photo services.

GraphicsWindow

The GraphicsWindow provides graphics related input and output functionality. For example, using this class, it is possible to draw and fill circles and rectangles.

ImageList

This class helps to load and store images in memory.

Math

The Math class provides lots of useful mathematics related methods

Mouse

The mouse class provides accessors to get or set the mouse related properties, like the cursor position, pointer, etc.

Network

This private helper class provides network access methods

Program

The Program class provides helpers to control the program execution.

Shapes

The Shape object allows you to add, move and rotate shapes to the Graphics window.

Sound

The Sound object provides operations that allow the playback of sounds. Some sample sounds are provided along with the library.

Stack

This object provides a way of storing values just like stacking up a plate. You can push a value to the top of the stack and pop it off. You can only pop the values one by one off the stack and the last pushed value will be the first one to pop out.

Text

The Text object provides helpful operations for working with Text.

TextWindow

The TextWindow provides text-related input and output functionalities. For example using this class, it is possible to write or read some text or number to and from the text-based text window.

Timer

The Timer object provides an easy way for doing something repeatedly with a constant interval between.

Turtle

The Turtle provides Logo-like functionality to draw shapes by manipulating the properties of a pen and drawing primitives.


File

The File object provides methods to access, read and write information from and to a file on disk. Using this object, it is possible to save and open settings across multiple sessions of your program.

Properties

LastError

File.LastError

Gets or sets the last encountered file operation based error message. This property is useful for finding out when some method fails to execute.

Methods

AppendContents

File.AppendContents(filePath, contents)

Opens the specified file and appends the contents to the end of the file.

filePath

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

contents

The contents to append to the end of the file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

CopyFile

File.CopyFile(sourceFilePath, destinationFilePath)

Copies the specified source file to the destination file path. If the destination points to a location that doesn't exist, the method will attempt to create it automatically. Existing files will be overwritten. It is always best to check if the destination file exists if you don't want to overwrite existing files.

sourceFilePath

The full path of the file that needs to be copied. An example of a full path will be c:\temp\settings.data.

destinationFilePath

The destination location or the file path.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

CreateDirectory

File.CreateDirectory(directoryPath)

Creates the specified directory.

directoryPath

The full path of the directory to be created.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

DeleteDirectory

File.DeleteDirectory(directoryPath)

Deletes the specified directory.

directoryPath

The full path of the directory to be deleted.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

DeleteFile

File.DeleteFile(filePath)

Deletes the specified file.

filePath

The destination location or the file path. An example of a full path will be c:\temp\settings.data.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

GetDirectories

File.GetDirectories(directoryPath)

Gets the path of all the directories in the specified directory path.

directoryPath

The directory to look for subdirectories.

Returns

If the operation was successful, this will return the list of directories as an array. Otherwise, it will return "FAILED".

GetFiles

File.GetFiles(directoryPath)

Gets the path of all the files in the specified directory path.

directoryPath

The directory to look for files.

Returns

If the operation was successful, this will return the files as an array. Otherwise, it will return "FAILED".

GetSettingsFilePath

File.GetSettingsFilePath()

Gets the full path of the settings file for this program. The settings file name is based on the program's name and is present in the same location as the program.

Returns

The full path of the settings file specific for this program.

GetTemporaryFilePath

File.GetTemporaryFilePath()

Creates a new temporary file in a temporary directory and returns the full file path.

Returns

The full file path of the temporary file.

InsertLine

File.InsertLine(filePath, lineNumber, contents)

Opens the specified file and inserts the contents at the specified line number. This operation will not overwrite any existing content at the specifid line.

filePath

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

lineNumber

The line number of the text to insert.

contents

The contents to insert into the file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

ReadContents

File.ReadContents(filePath)

Opens a file and reads the entire file's contents. This method will be fast for small files that are less than an MB in size, but will start to slow down and will be noticeable for files greater than 10MB.

filePath

The full path of the file to read. An example of a full path will be c:\temp\settings.data.

Returns

The entire contents of the file.

ReadLine

File.ReadLine(filePath, lineNumber)

Opens the specified file and reads the contents at the specified line number.

filePath

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

lineNumber

The line number of the text to be read.

Returns

The text at the specified line of the specified file.

WriteContents

File.WriteContents(filePath, contents)

Opens a file and writes the specified contents into it, replacing the original contents with the new content.

filePath

The full path of the file to write to. An example of a full path will be c:\temp\settings.data.

contents

The contents to write into the specified file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

WriteLine

File.WriteLine(filePath, lineNumber, contents)

Opens the specified file and write the contents at the specified line number. This operation will overwrite any existing content at the specified line.

filePath

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

lineNumber

The line number of the text to write.

contents

The contents to write at the specified line of the specified file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".
(c) Copyright 2009, Microsoft Corporation. All rights reserved.