Class ClassFileWriter
A simple file responsible for creating a file with the usings, namespaces and body code.
The file is laid out as so:
- Usings: List of all using statements added by AddUsing(string).
- Namespaces: List of all namespaces added using BeginNamespace(string).
- Body: List of all body code statements added using AddBody(string).
- Namespaces: List of all namespaces closings added using EndNamespace()
Inherited Members
Namespace: LemonEdge.API.Core.Writers
Assembly: LemonEdge.API.dll
Syntax
public class ClassFileWriter
Constructors
ClassFileWriter()
Declaration
public ClassFileWriter()
Methods
AddBody(string)
An actual code block for the file to add
Declaration
public void AddBody(string body)
Parameters
Type | Name | Description |
---|---|---|
string | body | The code to add to the file |
AddIfMissingUsing(string)
Adds the specified using statement to the list if it currently does not exist
Declaration
public void AddIfMissingUsing(string usingStatement)
Parameters
Type | Name | Description |
---|---|---|
string | usingStatement |
AddUsing(string)
Adds the specified using statement to the list.
Declaration
public void AddUsing(string usings)
Parameters
Type | Name | Description |
---|---|---|
string | usings | The using statement to add. This does not need the [using] part of the string, the writer adds that for each using statement as needed |
BeginNamespace(string)
Adds the beginning of a namespace. This should be closed using a corrosponding EndNamespace() call after adding the appropriate body statements
Declaration
public void BeginNamespace(string nameSpace)
Parameters
Type | Name | Description |
---|---|---|
string | nameSpace | The namespace to add body code into. This does not need the [namespace] part of the string, the writer adds that for each namespace statement as needed |
EndNamespace()
Closes a namespace. This should corrospond to a namespace added using BeginNamespace(string)
Declaration
public void EndNamespace()
RemoveUsing(string)
Removes the specified using statement from the fil
Declaration
public void RemoveUsing(string usings)
Parameters
Type | Name | Description |
---|---|---|
string | usings | The using statement to remove. This does not need the [using] part of the string, the writer adds that for each using statement as needed |
WriteFile()
Creates the entire file by putting the usings, namespaces and body code together as appropriate
Declaration
public string WriteFile()
Returns
Type | Description |
---|---|
string | The entire file by putting the usings, namespaces and body code together as appropriate |