Public Member Functions | |
int | CompareTo (object o) |
ContentFile | DestinationOfExternalResource (string dirOfUsingAssembly) |
bool | DoNotCopyIfExternalReference (string dirOfUsingAssembly) |
override bool | Equals (object obj) |
bool | Execute (BuildToolFamilyEnv env, DateTime validityOfBuildSystem) |
override int | GetHashCode () |
ICollection < RefToProject > | GetProjects () |
System.Xml.Schema.XmlSchema | GetSchema () |
ICollection < IBuildProduct > | GetTargets () |
DateTime | GetValidity () |
DateTime | GetValidityDemand () |
void | ReadXml (System.Xml.XmlReader reader) |
ResourceDesignator (ContentFile resourceFile, string name, bool isThisPrivate) | |
ResourceDesignator (ContentFile resourceFile, string name) | |
ResourceDesignator (ContentType t, string originalFilename, string internalName) | |
ResourceDesignator (ISingleFileProduct resourceFile) | |
ResourceDesignator () | |
override string | ToString () |
void | WriteXml (System.Xml.XmlWriter writer) |
Static Public Member Functions | |
static ICollection < ResourceDesignator > | SelectExternalResources (ContentType t, string srcDirectoryPath, string searchPattern, string destDirPath) |
Properties | |
bool | IsPrivate [get] |
string | Name [get] |
ContentFile | ResourceFile [get] |
ISingleFileProduct | ResourceFileProject [get] |
If the resource has been compiled into the assembly, either ZipResource or the ManifestResourceInfo may be used to read it. Use the ResourceDesignator.Name
to designate the resource. Assume the following project definition.
wx.Build.Net.CSharpAssemblyProject project = new wx.Build.Net.CSharpAssemblyProject(ProjectPreference.Default, "ResourceDesignatorSample", "program.exe", "Exemplifies declaration and use of resources."); project.Resources=new wx.Build.ResourceDesignator[] { new wx.Build.ResourceDesignator(new wx.Build.ContentFile(wx.Build.ContentType.PNG, "APicture.png"), "APicture_PNG") };
ManifestResourceInfo rsInfo = callingAssembly.GetManifestResourceInfo("APicture_PNG"); if (rsInfo != null) { Stream resourceStream = resourceAssembly.GetManifestResourceStream(derivate); BinaryReader reader = new BinaryReader(resourceStream); byte[] resourceBytes = reader.ReadBytes((int)resourceStream.Length); }
The following example contains a declaration for both of the abovementioned use cases.
wx.Build.Net.CSharpAssemblyProject project = new wx.Build.Net.CSharpAssemblyProject(ProjectPreference.Default, "ResourceDesignatorSample", "program.exe", "Exemplifies declaration and use of resources."); project.ExternalResources = new ResourceDesignator[] { new ResourceDesignator(ContentType.PNG, "..\\Images\\APictureToCopy.PNG", "Images\\APictureCopied.PNG") new ResourceDesignator(ContentType.PNG, "Images\\APictureAlreadyAtTheDesiredPlace.PNG") };
wx.Build.ResourceDesignator.ResourceDesignator | ( | ) |
Creates an empty resource. Use this CTor only to create an instance that reads its properties from an XML stream using ReadXml().
wx.Build.ResourceDesignator.ResourceDesignator | ( | ISingleFileProduct | resourceFile | ) |
This will assign an automatically created name to the provided resourceFile
. The name will consist of the base file name without extension plus underscrore "_" plus extension of the file.
resourceFile | Typically a content file but maybe also a project implementing ISingleFileProduct. |
wx.Build.ResourceDesignator.ResourceDesignator | ( | ContentType | t, | |
string | originalFilename, | |||
string | internalName | |||
) |
This creates an instance referring to a resource of the provided type that will be read from the provided filename. The program code will refer to the specified internal name.
t | Type of the resource. | |
originalFilename | Filename of the resource. | |
internalName | The internal name that will be used bythe program code to refer to the resource. There are 2 uswe cases:
|
wx.Build.ResourceDesignator.ResourceDesignator | ( | ContentFile | resourceFile, | |
string | name | |||
) |
This designates a resource consisting of the content of resourceFile
that may be retrieved by the internal name
.
resourceFile | The resource file. | |
name | This defines the name that will be used to refer to the represented resource. 2 Use cases:
|
wx.Build.ResourceDesignator.ResourceDesignator | ( | ContentFile | resourceFile, | |
string | name, | |||
bool | isThisPrivate | |||
) |
This designates a resource consisting of the content of resourceFile
that may be retrieved by the internal name
.
resourceFile | The source file that this instance designates. | ||||
name | The internal name that will be used bythe program code to refer to the resource. There are 2 uswe cases:
|
int wx.Build.ResourceDesignator.CompareTo | ( | object | o | ) |
ContentFile wx.Build.ResourceDesignator.DestinationOfExternalResource | ( | string | dirOfUsingAssembly | ) |
Use this to get the filename that a program will expect this resource to have, if this is used as external resource.
dirOfUsingAssembly | The directory where the program resides that uses this resource. This method will expect that the program uses the internal name relatively to this directory. |
bool wx.Build.ResourceDesignator.DoNotCopyIfExternalReference | ( | string | dirOfUsingAssembly | ) |
True iff DestinationOfExternalResource() is equal to the resource file. In this case, the resource shall not be copied in order to build a runnable version of the program.
dirOfUsingAssembly | The directory where the program resides that uses this resource. This method will expect that the program uses the internal name relatively to this directory. |
override bool wx.Build.ResourceDesignator.Equals | ( | object | obj | ) |
bool wx.Build.ResourceDesignator.Execute | ( | BuildToolFamilyEnv | env, | |
DateTime | validityOfBuildSystem | |||
) |
Simply return true
.
override int wx.Build.ResourceDesignator.GetHashCode | ( | ) |
ICollection<RefToProject> wx.Build.ResourceDesignator.GetProjects | ( | ) |
Returns an array containing the resource of the resource is a project.
Implements wx.Build.IBuildProduct.
System.Xml.Schema.XmlSchema wx.Build.ResourceDesignator.GetSchema | ( | ) |
ICollection<IBuildProduct> wx.Build.ResourceDesignator.GetTargets | ( | ) |
This is a target on itself.
DateTime wx.Build.ResourceDesignator.GetValidity | ( | ) |
Returns validity timstamp of this object. Whenever this is equal or later than all prerequisites, this is considered consistent with the prerequisites on rebuilding.
Implements wx.Build.IBuildObject.
DateTime wx.Build.ResourceDesignator.GetValidityDemand | ( | ) |
This is the counterpart of the Validity
. If this occurs as a prerequisite, this shall be compared with the Validity of the target in order to assess whether rebuild is necessary or not.
Implements wx.Build.IBuildObject.
void wx.Build.ResourceDesignator.ReadXml | ( | System.Xml.XmlReader | reader | ) |
static ICollection<ResourceDesignator> wx.Build.ResourceDesignator.SelectExternalResources | ( | ContentType | t, | |
string | srcDirectoryPath, | |||
string | searchPattern, | |||
string | destDirPath | |||
) | [static] |
This produces a collection of resource designators that refer to files in a particular directory. The files will be selected according to a search pattern according to System.IO.Directory.GetFiles(). The internal name will be created due to the provided destination path. Refer to , Net.CSharpAssemblyProject.ExternalResources.
Example: Assume, that directory "..\\Images" contains the files "img01.png" and "img02.jpg".
ICollection< ResourceDesignator > resultPNG=ResourceDesignator.SelectExternalResources(ContentType.PNG, "..\\Images", "*.png", "..\\Images"); ICollection< ResourceDesignator > resultJPG=ResourceDesignator.SelectExternalResources(ContentType.JPEG, "..\\Images", "*.jpg", "..\\Images"); ICollection< ResourceDesignator > resultERROR=ResourceDesignator.SelectExternalResources(ContentType.PNG, "..\\Images", "*.*", "..\\Images");
resultPNG
will contain exactly on resource designator referring to file "..\\Images\\img01.png" and declaring the internal name "..\\Images\\img01.png". resultJPG
will contain exactly on resource designator referring to file "..\\Images\\img02.jpg" and declaring the internal name "..\\Images\\img02.jpg". resultERROR
will contain two resource designators referring to the files "..\\Images\\img01.png" and "..\\Images\\img02.jpg" but assuming content type PNG for both files. This is likely to get you in trouble because the logic of the build system will assume the wrong content type for the JPEG file "img2.jpg".
t | The content type that will be assumed for the resulting resources. | |
srcDirectoryPath | The directory, where the resources will be searched. | |
searchPattern | The search pattern including wild cards that can be interpreted by System.IO.Directory.GetFiles(). | |
destDirPath | This is the directory that will be used to create the resource name. This must be a relative path. "." or "" will cause the build procedure to place the resource side by side with the created assembly. |
override string wx.Build.ResourceDesignator.ToString | ( | ) |
void wx.Build.ResourceDesignator.WriteXml | ( | System.Xml.XmlWriter | writer | ) |
bool wx.Build.ResourceDesignator.IsPrivate [get] |
True iff this is will be private to the assembly.
string wx.Build.ResourceDesignator.Name [get] |
Returns the name that the resource will have in the assembly. If this resource will be compiled into the assembly, this is usually a flat name consisting excusively of lower case letters without dots, slashes, and backslashes. If this is an external resource, this is a relative path the will be used to compute a target position of the resource.
ContentFile wx.Build.ResourceDesignator.ResourceFile [get] |
This is the file that provides the content.
ISingleFileProduct wx.Build.ResourceDesignator.ResourceFileProject [get] |
The resource is in fact a ISingleFileProduct. This is the instance actually representing the resource. This will differ from ResourceFile
iff the resource is a project rather like an explicitely known file.