Zeus API Reference - MyGeneration Software

ZeusOutput Class

The ZeusOutput object is only available in the template code segment and is very much like a StringBuilder. It contains methods that allow the developer to manipulate the current output buffer.

For a list of all members of this type, see ZeusOutput Members.

System.Object
   Zeus.ZeusOutput

public class ZeusOutput : IZeusOutput

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The ZeusOutput is simply an output buffer. It's primary methods are write() and writeln(), which naturally append string data to the buffer. Using the save and append methods, the buffer can be saved to disk. Code preservation is also supported using the ZeusOutput object. The two methods that enable code preservation are setPreserveSource(), preserve(), getPreservedData(), and getPreserveBlock(). The preserve() method writes directly to the output stream where the getPreserveBlock() returns the entire preserve block as a string. You can then write that string to the output buffer manually. The getPreservedData() method returns the data inside the preserve block without the preserve tags.

Example

Saving the buffer to disk, replacing an existing file: (JScript)

var filename = "c:\testfile.txt";
output.write("Hello World!");
output.save(filename, "o");
Backing up an existing file before overwriting: (JScript)
var filename = "c:\testfile.txt";
output.write("Hello World!");
output.save(filename, "b");
Append the buffer to an existing file before overwriting: (JScript)
var filename = "c:\testfile.txt";
output.write("Hello World!");
output.save(filename, "a");
Save the buffer to an new file with no overwrite (if the file exists, nothing will happen): (JScript)
var filename = "c:\testfile.txt";
output.write("Hello World!");
output.save(filename, "d");
Preserving a region the buffer to an existing file before overwriting: (JScript)
// The Template Code
var filename = "c:\testfile.txt";
output.setPreserveSource(filePath, "/*::", "::*/"); 
output.write("Hello World!");
output.preserve("myCustomProperties");
output.write("Hello World Again!");
output.save(filename, "o");
The existing file before template execution: "c:\testfile.txt"
Hello World!
/*::PRESERVE_BEGIN myCustomProperties::*/ 
preserved data here
/*::PRESERVE_END myCustomProperties::*/ 
Hello World Again!
Note that the preserved data is between the PRESERVE_BEGIN and PRESERVE_END tags. When you set the preserve source, the start and end tags for the PRESERVE tags are defined; is this case, it's "/*::" and "::*/".

Requirements

Namespace: Zeus

Assembly: Zeus (in Zeus.dll)

See Also

ZeusOutput Members | Zeus Namespace