C# 클래스 Westwind.Globalization.DbResXConverter

This class can be used to export resources from the database to ASP.NET compatible resources (Resx). This class takes all the resources in the database and creates RESX files that match these resources. Please note that it will overrwrite any existing resource files if they already exist, so please use this class with care if you have existing ResX resources. Note this class is primarily ASP.NET specific in that it looks at ASP.NET specific directory structures for ResX imports and strongly typed resource creation.
파일 보기 프로젝트 열기: RickStrahl/Westwind.Globalization 1 사용 예제들

공개 메소드들

메소드 설명
DbResXConverter ( ) : System

Creates new instance with the default Web Application base path set to the current Web application's path.

DbResXConverter ( string basePhsyicalPath ) : System

Pass in the base phyiscal path for the project. For Web Projects this will be the Web root dir for non-Web projects this will be the project base path as a string.

FormatResourceSetPath ( string resourceSet ) : string

Returns the path the resource file withouth the resx and localeId extension

FormatWebResourceSetPath ( string ResourceSet, bool LocalResources ) : string

Translates the resource set path ASP.NET WebForms Global or local resource path base (ie. without the .resx and localeId extension).

GenerateGlobalWebResourceResXFiles ( ) : bool

Genereates Local Web Resource ResX files from the DbResourceDataManager

GenerateLocalWebResourceResXFiles ( ) : bool

Genereates Local Web Resource ResX files from the DbResourceDataManager

GenerateResXFiles ( IEnumerable resourceSets = null, bool generateStronglyTypedClasses = false ) : bool

Generates Resx Files for standard non-Web Resource files based on the BasePhysicalPath

GetCompiledResourcesNormalizedForLocale ( string resourceSet, string baseNamespace, string localeId ) : object>.Dictionary

Returns resources for a given resource set in a specific locale

GetResXResourcesNormalizedForLocale ( string baseFile, string LocaleId ) : object>.Dictionary

Returns all resources for a given locale normalized down the hierarchy for a given resource file. The resource file should be specified without the .resx and locale identifier extensions.

GetResourcesNormalizedForLocale ( ResourceManager resourceManager, string localeId ) : object>.Dictionary
ImportDirectoryResources ( string path, string relativePath ) : bool

Imports all resources from a given directory. This method works for any resources. When using LocalResources, make sure to provide an app relative path as the second parameter if the resources live in non root folder. So if you have resources in off an Admin folder use "admin/" as the parameter. Otherwise for web root resources or global or assembly level assemblies pass string.Empty or null.

ImportResourceFile ( string FileName, string ResourceSetName, string LocaleId ) : bool

Imports an individual ResX Resource file into the database

ImportWebResources ( string webPath = null ) : bool

Imports ResX Web Resources of a Web application by parsing through the App_GlobalResources and App_LocalResources directories of a Web site. Note: Requires that WebPhysicalPath is set to point at the Web root directory.

ImportWinResources ( string basePhysicalPath ) : bool

Imports Resources recursively from a non-Web project

IsLocalResourceSet ( string resourceSet ) : bool

Determines if a resourceset is a local resource based on the extension of the resource set

보호된 메소드들

메소드 설명
GenerateWebResourceResXFiles ( bool localResources ) : bool

Dumps resources from the DbResourceProvider database out to Resx resources in an ASP.NET application creating the appropriate APP_LOCAL_RESOURCES/APP_GLOBAL_RESOURCES folders and resx files. IMPORTANT: will overwrite existing files

비공개 메소드들

메소드 설명
GetResXResources ( string FileName ) : List

Gets a specific List of resources as a list of ResxItems. This list only retrieves items for a specific locale. No resource normalization occurs.

메소드 상세

DbResXConverter() 공개 메소드

Creates new instance with the default Web Application base path set to the current Web application's path.
public DbResXConverter ( ) : System
리턴 System

DbResXConverter() 공개 메소드

Pass in the base phyiscal path for the project. For Web Projects this will be the Web root dir for non-Web projects this will be the project base path as a string.
public DbResXConverter ( string basePhsyicalPath ) : System
basePhsyicalPath string /// Optional - allows specifying the virtual path where the resources are loaded and saved to. /// /// If not specified HttpContext.Current.PhysicalPath is used instead. ///
리턴 System

FormatResourceSetPath() 공개 메소드

Returns the path the resource file withouth the resx and localeId extension
public FormatResourceSetPath ( string resourceSet ) : string
resourceSet string
리턴 string

FormatWebResourceSetPath() 공개 메소드

Translates the resource set path ASP.NET WebForms Global or local resource path base (ie. without the .resx and localeId extension).
public FormatWebResourceSetPath ( string ResourceSet, bool LocalResources ) : string
ResourceSet string
LocalResources bool
리턴 string

GenerateGlobalWebResourceResXFiles() 공개 메소드

Genereates Local Web Resource ResX files from the DbResourceDataManager
public GenerateGlobalWebResourceResXFiles ( ) : bool
리턴 bool

GenerateLocalWebResourceResXFiles() 공개 메소드

Genereates Local Web Resource ResX files from the DbResourceDataManager
public GenerateLocalWebResourceResXFiles ( ) : bool
리턴 bool

GenerateResXFiles() 공개 메소드

Generates Resx Files for standard non-Web Resource files based on the BasePhysicalPath
public GenerateResXFiles ( IEnumerable resourceSets = null, bool generateStronglyTypedClasses = false ) : bool
resourceSets IEnumerable
generateStronglyTypedClasses bool
리턴 bool

GenerateWebResourceResXFiles() 보호된 메소드

Dumps resources from the DbResourceProvider database out to Resx resources in an ASP.NET application creating the appropriate APP_LOCAL_RESOURCES/APP_GLOBAL_RESOURCES folders and resx files. IMPORTANT: will overwrite existing files
protected GenerateWebResourceResXFiles ( bool localResources ) : bool
localResources bool
리턴 bool

GetCompiledResourcesNormalizedForLocale() 공개 메소드

Returns resources for a given resource set in a specific locale
public GetCompiledResourcesNormalizedForLocale ( string resourceSet, string baseNamespace, string localeId ) : object>.Dictionary
resourceSet string
baseNamespace string
localeId string
리턴 object>.Dictionary

GetResXResourcesNormalizedForLocale() 공개 메소드

Returns all resources for a given locale normalized down the hierarchy for a given resource file. The resource file should be specified without the .resx and locale identifier extensions.
public GetResXResourcesNormalizedForLocale ( string baseFile, string LocaleId ) : object>.Dictionary
baseFile string The base Resource file without .resx and locale extensions
LocaleId string
리턴 object>.Dictionary

GetResourcesNormalizedForLocale() 공개 메소드

public GetResourcesNormalizedForLocale ( ResourceManager resourceManager, string localeId ) : object>.Dictionary
resourceManager System.Resources.ResourceManager
localeId string
리턴 object>.Dictionary

ImportDirectoryResources() 공개 메소드

Imports all resources from a given directory. This method works for any resources. When using LocalResources, make sure to provide an app relative path as the second parameter if the resources live in non root folder. So if you have resources in off an Admin folder use "admin/" as the parameter. Otherwise for web root resources or global or assembly level assemblies pass string.Empty or null.
public ImportDirectoryResources ( string path, string relativePath ) : bool
path string Physical Path for the Resources
relativePath string Optional - relative path prefix for Web App_LocalResources (ie. admin/)
리턴 bool

ImportResourceFile() 공개 메소드

Imports an individual ResX Resource file into the database
public ImportResourceFile ( string FileName, string ResourceSetName, string LocaleId ) : bool
FileName string Full path to the the ResX file
ResourceSetName string Name of the file or for local resources the app relative path plus filename (admin/default.aspx or default.aspx)
LocaleId string Locale Id of the file to import. Use "" for Invariant
리턴 bool

ImportWebResources() 공개 메소드

Imports ResX Web Resources of a Web application by parsing through the App_GlobalResources and App_LocalResources directories of a Web site. Note: Requires that WebPhysicalPath is set to point at the Web root directory.
public ImportWebResources ( string webPath = null ) : bool
webPath string
리턴 bool

ImportWinResources() 공개 메소드

Imports Resources recursively from a non-Web project
public ImportWinResources ( string basePhysicalPath ) : bool
basePhysicalPath string The physical path to the directory
리턴 bool

IsLocalResourceSet() 공개 정적인 메소드

Determines if a resourceset is a local resource based on the extension of the resource set
public static IsLocalResourceSet ( string resourceSet ) : bool
resourceSet string
리턴 bool