Detailed Description

Retrieves a block of text for use on the UI.

Public Member Functions

 TextPackage (string src, string relativeTo)
 Creates a new text package for the named file to get. You must then call PowerUI.TextPackage.Get to perform the request. More...
 
void Get (OnTextReady textReady)
 Sends the request off and defines a callback to run when the result is ready. More...
 
void GotText (string text)
 Got text is called by the file handler when the response is received. More...
 
void GotText (string text, string error)
 Got text is called by the file handler when the response is received. More...
 

Public Attributes

string Text
 The text that was retrieved. You must check if it is PowerUI.TextPackage.Ok first. More...
 
string Error
 Any error that occured whilst retrieving the text. More...
 
FilePath File
 The file that was requested. More...
 
string FileType
 The type of file that was requested (e.g. "txt" or "html") More...
 
object ExtraData
 A custom data object for passing anything else when the callback runs. More...
 

Properties

string Url [get]
 The fully resolved URL requested. More...
 
bool Ok [get]
 True if there is no error and the text is ok. More...
 
bool Errored [get]
 True if there was an error and the text is not ok. More...
 

Events

OnTextReady TextReady
 The callback to run when the text has been retrieved (or an error occured). More...
 

Private Member Functions

void SetPath (string src, string relativeTo)
 Sets up the filepath to the given url which may be relative to a given location. More...
 

Constructor & Destructor Documentation

PowerUI.TextPackage.TextPackage ( string  src,
string  relativeTo 
)
inline

Creates a new text package for the named file to get. You must then call PowerUI.TextPackage.Get to perform the request.

Parameters
srcThe file to get.
relativeToThe path the file to get is relative to, if any (may be null).

Member Function Documentation

void PowerUI.TextPackage.Get ( OnTextReady  textReady)
inline

Sends the request off and defines a callback to run when the result is ready.

Parameters
textReadyThe callback to run when the text has been retrieved. Note that the callback must check if the result is PowerUI.TextPackage.Ok.
void PowerUI.TextPackage.GotText ( string  text)
inline

Got text is called by the file handler when the response is received.

Parameters
textThe text that was recieved.
void PowerUI.TextPackage.GotText ( string  text,
string  error 
)
inline

Got text is called by the file handler when the response is received.

Parameters
textThe text that was recieved, if any.
errorAn error that occured, if any.
void PowerUI.TextPackage.SetPath ( string  src,
string  relativeTo 
)
inlineprivate

Sets up the filepath to the given url which may be relative to a given location.

Parameters
srcThe file to get.
relativeToThe path the file to get is relative to, if any. May be null.

Member Data Documentation

string PowerUI.TextPackage.Error

Any error that occured whilst retrieving the text.

object PowerUI.TextPackage.ExtraData

A custom data object for passing anything else when the callback runs.

FilePath PowerUI.TextPackage.File

The file that was requested.

string PowerUI.TextPackage.FileType

The type of file that was requested (e.g. "txt" or "html")

string PowerUI.TextPackage.Text

The text that was retrieved. You must check if it is PowerUI.TextPackage.Ok first.

Property Documentation

bool PowerUI.TextPackage.Errored
get

True if there was an error and the text is not ok.

bool PowerUI.TextPackage.Ok
get

True if there is no error and the text is ok.

string PowerUI.TextPackage.Url
get

The fully resolved URL requested.

Event Documentation

OnTextReady PowerUI.TextPackage.TextReady

The callback to run when the text has been retrieved (or an error occured).