EmbeddedResource
Description
The EmbeddedResource class defines a single resource which is embedded in the source code and loaded at runtime via TinmanModule.RegisterResources.
Public / Constructors
Public / Methods
Generate
Builds a Code-X compliant source code file that contains embedded resources as defined by the XML resource listing.
The XML resource listing must be compatible with this DTD:
<!ELEMENT resources (resource*)> <!ATTLIST resources namespace CDATA #REQUIRED> <!ATTLIST resources guid CDATA #REQUIRED> <!ELEMENT resource EMPTY> <!ATTLIST resource file CDATA #REQUIRED> <!ATTLIST resource type (config|file|zip) #REQUIRED>
Use this to associate an XML file with the DTD:
<!DOCTYPE resources PUBLIC "-//TINMAN//CONFIGDOC//EN" "https://dtd.tinman3d.com/EmbeddedResource.dtd">
The namespace
attribute must be set to the namespace name of the generated class. The guid
attribute must be set to the same value as TinmanModule.Guid. The generated class has an internal static
property named Resources
, which must be passed to a call to TinmanModule.RegisterResources from within TinmanModule.DoInitialize, for example:
protected override void DoInitialize() { RegisterResources(MyModule_Resources.Resources); }
The file
attribute must be a path relative to the directory that contains the XML resource listing. The attribute values file
, config
and zip
correspond to the types 0
, 1
and 2
of TinmanModule.RegisterResource, respectively.
- IOException
-
If an I/O error has occurred.
- ValidatingException
-
If the XML content is malformed.
- See also
Register
Registers this embedded resource with the given module in by calling TinmanModule.RegisterResource.