C# Class DynamicSugar.DS.Resources

显示文件 Open project: fredericaltorres/DynamicSugarNet

Public Methods

Method Description
GetBinaryResource ( string resourceFileName, Assembly assembly ) : byte[]

Return the content of a file embed as a resource. The function takes care of finding the fully qualify name, in the current assembly.

GetBitmapResource ( string resourceFileName, Assembly assembly ) : Bitmap

Return a image embed as a resource. The function takes care of finding the fully qualify name, in the current assembly.

GetTextResource ( System regex, Assembly assembly, bool gzip = false, TextResourceEncoding encoding = TextResourceEncoding.Unicode ) : string>.Dictionary

Return multiple text files embed as a resource in a dictionary. The key in the resource name, the value is the text data The function takes care of finding the fully qualify name, in the passed assembly.

GetTextResource ( string resourceFileName, Assembly assembly, bool gzip = false, TextResourceEncoding encoding = TextResourceEncoding.Unicode ) : string

Return the content of a text file embed as a resource. The function takes care of finding the fully qualify name, in the current assembly.

GetTextResource ( string resourceFileName, List assemblies ) : string

Return the content of a text file embed as a resource. The function takes care of finding the fully qualify name, in the first assembly when the resource is found

SaveBinaryResourceAsFile ( Assembly assembly, string path, string resourceFileName ) : string

Save a resource as a local file

SaveBinaryResourceAsFiles ( Assembly assembly, string path ) : string>.Dictionary

Save resources as a local files

Private Methods

Method Description
ByteArrayToBitMap ( byte b ) : Bitmap

Convert a byte array into a bitmap

GetResourceFullName ( string resourceFileName, Assembly assembly ) : string

Return the fully qualified name of the resource file

SaveByteArrayToFile ( byte byteArray, string fileName ) : bool

Save a buffer of byte into a file

Method Details

GetBinaryResource() public static method

Return the content of a file embed as a resource. The function takes care of finding the fully qualify name, in the current assembly.
public static GetBinaryResource ( string resourceFileName, Assembly assembly ) : byte[]
resourceFileName string
assembly System.Reflection.Assembly
return byte[]

GetBitmapResource() public static method

Return a image embed as a resource. The function takes care of finding the fully qualify name, in the current assembly.
public static GetBitmapResource ( string resourceFileName, Assembly assembly ) : Bitmap
resourceFileName string
assembly System.Reflection.Assembly
return System.Drawing.Bitmap

GetTextResource() public static method

Return multiple text files embed as a resource in a dictionary. The key in the resource name, the value is the text data The function takes care of finding the fully qualify name, in the passed assembly.
public static GetTextResource ( System regex, Assembly assembly, bool gzip = false, TextResourceEncoding encoding = TextResourceEncoding.Unicode ) : string>.Dictionary
regex System The regular expression to filter the resource by name. The file system '\' are replaced with '.'
assembly System.Reflection.Assembly
gzip bool
encoding TextResourceEncoding
return string>.Dictionary

GetTextResource() public static method

Return the content of a text file embed as a resource. The function takes care of finding the fully qualify name, in the current assembly.
public static GetTextResource ( string resourceFileName, Assembly assembly, bool gzip = false, TextResourceEncoding encoding = TextResourceEncoding.Unicode ) : string
resourceFileName string The file name of the resource
assembly System.Reflection.Assembly
gzip bool
encoding TextResourceEncoding
return string

GetTextResource() public static method

Return the content of a text file embed as a resource. The function takes care of finding the fully qualify name, in the first assembly when the resource is found
public static GetTextResource ( string resourceFileName, List assemblies ) : string
resourceFileName string The file name of the resource
assemblies List A list of assemblies in which to search for the resources
return string

SaveBinaryResourceAsFile() public static method

Save a resource as a local file
public static SaveBinaryResourceAsFile ( Assembly assembly, string path, string resourceFileName ) : string
assembly System.Reflection.Assembly Assembly where to get the resource
path string Local folder
resourceFileName string Resource name and filename
return string

SaveBinaryResourceAsFiles() public static method

Save resources as a local files
public static SaveBinaryResourceAsFiles ( Assembly assembly, string path ) : string>.Dictionary
assembly System.Reflection.Assembly Assembly where to get the resource
path string Local folder
return string>.Dictionary