Class ProjectModuleKinds
Decides what a module of a project is, and reads its text, the way every side of the platform does: a client that shows a project's modules, such as an IDE's add-in, gets the answer the environment host and the language server get.
public static class ProjectModuleKinds
- Inheritance
-
ProjectModuleKinds
- Inherited Members
Remarks
A module whose entry in the project names a document (Super) is a document module, whatever its text and its file name. Any other
module is a class module when its text has a VERSION header, and a standard module otherwise: RD-VBA decides a module's kind from its source, not from
its file's extension.
Methods
Of(RDCoreModule, string?)
The kind of module, from its entry in the project and its text.
public static ProjectModuleKind Of(RDCoreModule module, string? source)
Parameters
moduleRDCoreModuleThe module's entry in the project.
sourcestringThe module's text (ReadText(byte[])), or null when it could not be read.
Returns
Of(DocClassType?, string?)
The kind of a module that the project says is the code of super, or of no document when it is null.
public static ProjectModuleKind Of(DocClassType? super, string? source)
Parameters
superDocClassType?What the project says the module's document is (Super).
sourcestringThe module's text (ReadText(byte[])), or null when it could not be read.
Returns
ReadText(byte[])
The text of a module's file, decoded as the platform decodes it: UTF-8, unless a byte order mark says another Unicode encoding, and without that mark.
public static string ReadText(byte[] bytes)
Parameters
bytesbyte[]The file's bytes.
Returns
Remarks
This is what ReadAllText(string) gives, the way the environment host and the language server read a module, so a client reads the
same VERSION header they do: a header after a UTF-8 or UTF-16 mark is found, and the mark is no part of the text.