C# 클래스 Sage.ResourceManagement.PathResolver

Provides a class that resolves physical file paths based on current category, locale and any fallback scenario currently in place.
파일 보기 프로젝트 열기: igorfrance/sage

공개 메소드들

메소드 설명
Expand ( string relativePath ) : string

Expands the specified relativePath to a physical path in the the current context category.

Expand ( string relativePath, string category ) : string

Expands the specified relativePath to a physical path in the specified category.

GetAssetPath ( string category ) : string

Returns the path to the assets folder of the specified category.

GetClosestLocaleSuffix ( string path, string locale ) : string

Gets the suffix of an existing file most closely matching the specified locale.

If the resource name suffix fallback hierarchy is configured to be: ch,de,default, while the specified locale is ch, given the path g:\projects\p1\resources\image.png, the method looks for files in this order: g:\projects\p1\resources\image-ch.png g:\projects\p1\resources\image-de.png g:\projects\p1\resources\image-default.png g:\projects\p1\resources\image.png As soon as a match is found, the search is over and the found file's suffix (e.g. 'de') is returned.

GetDictionaryPath ( string locale = null, string category = null ) : string

Gets the path to the dictionary, either using the current context's locale and category, or if specified, using the locale and category arguments.

GetModulePath ( Type moduleType, string childPath ) : string

Expands the specified childPath to its full path within the module specified with moduleType.

GetModulePath ( string moduleName ) : string

Gets the expanded and resolved path to the module with the specified moduleName.

GetModulePath ( string moduleKey, string childPath ) : string

Expands the specified childPath to its full path within the module with the specified moduleKey.

GetPhysicalCategoryPath ( string category = null ) : string

Returns the physical path to the assets folder of the specified category.

GetPhysicalViewPath ( string category = null ) : string

Returns the physical path to the views folder of the specified category.

GetPluginPath ( string pluginName, string childPath ) : string

Expands the specified childPath to its full path within the module with the specified pluginName.

GetRelativeWebPath ( string path, bool prependApplicationPath = false ) : string

Converts, if possible, an absolute path to it's equivalent web accessible location (relative to the application path).

GetViewPath ( string category = null ) : string

Returns the path to the views folder of the specified category.

Localize ( string path ) : string

Returns a localized version of the path, if such a file exists, searching for the name that most closely matches the current locale.

Localize ( string path, bool mapPath ) : string

Returns a localized version of the path, if such a file exists, searching for the name that most closely matches the current locale.

Localize ( string path, string locale, bool mapPath = false ) : string

Returns a localized version of the path, if such a file exists, searching for the name that most closely matches the current locale.

If the resource name suffix fallback hierarchy is configured to be: ch,de,default, while the specified locale is ch, given the path g:\projects\p1\resources\image.png, the method looks for files in this order: g:\projects\p1\resources\image-ch.png g:\projects\p1\resources\image-de.png g:\projects\p1\resources\image-default.png g:\projects\p1\resources\image.png As soon as a match is found, the search is over and the found file's path is returned.

The resulting path will not be mapped from a web to a physical path, it will be localized as-is.

PathResolver ( SageContext context ) : System

Initializes a new instance of the PathResolver class using the specified SageContext to retrieve current category and locale information.

Resolve ( string templatePath ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the current SageContext and returns an absolute path.

Resolve ( string templatePath, System.Web.QueryString values ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified values and returns an absolute path.

Resolve ( string templatePath, SageContext context ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified context and returns an absolute path.

Resolve ( string templatePath, string category ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration, the current SageContext and the specified category, and returns an absolute path.

Resolve ( string templatePath, string category, string locale ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration, the current SageContext and the specified category and locale, and returns an absolute path.

Substitute ( string templatePath ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the current SageContext.

Substitute ( string templatePath, System.Web.QueryString values ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified values.

Substitute ( string templatePath, SageContext context ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified context.

Substitute ( string templatePath, string category ) : string

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration, the current SageContext and the specified category.

메소드 상세

Expand() 공개 메소드

Expands the specified relativePath to a physical path in the the current context category.
public Expand ( string relativePath ) : string
relativePath string The path to expand
리턴 string

Expand() 공개 메소드

Expands the specified relativePath to a physical path in the specified category.
public Expand ( string relativePath, string category ) : string
relativePath string The path to expand
category string The category under which to expand the path.
리턴 string

GetAssetPath() 공개 메소드

Returns the path to the assets folder of the specified category.
public GetAssetPath ( string category ) : string
category string The category for which to return the path
리턴 string

GetClosestLocaleSuffix() 공개 메소드

Gets the suffix of an existing file most closely matching the specified locale.
If the resource name suffix fallback hierarchy is configured to be: ch,de,default, while the specified locale is ch, given the path g:\projects\p1\resources\image.png, the method looks for files in this order: g:\projects\p1\resources\image-ch.png g:\projects\p1\resources\image-de.png g:\projects\p1\resources\image-default.png g:\projects\p1\resources\image.png As soon as a match is found, the search is over and the found file's suffix (e.g. 'de') is returned.
public GetClosestLocaleSuffix ( string path, string locale ) : string
path string The path to the file, without any suffix.
locale string The locale for which to search.
리턴 string

GetDictionaryPath() 공개 메소드

Gets the path to the dictionary, either using the current context's locale and category, or if specified, using the locale and category arguments.
public GetDictionaryPath ( string locale = null, string category = null ) : string
locale string Optional locale of the dictionary path to get.
category string Optional category of the dictionary path to get.
리턴 string

GetModulePath() 공개 메소드

Expands the specified childPath to its full path within the module specified with moduleType.
public GetModulePath ( Type moduleType, string childPath ) : string
moduleType System.Type The type of the module for which the path is being expanded.
childPath string The path to expand
리턴 string

GetModulePath() 공개 메소드

Gets the expanded and resolved path to the module with the specified moduleName.
public GetModulePath ( string moduleName ) : string
moduleName string Name of the module whose path to get.
리턴 string

GetModulePath() 공개 메소드

Expands the specified childPath to its full path within the module with the specified moduleKey.
public GetModulePath ( string moduleKey, string childPath ) : string
moduleKey string The name (or combination of category/name) of the module for which the path is being expanded.
childPath string The path to expand
리턴 string

GetPhysicalCategoryPath() 공개 메소드

Returns the physical path to the assets folder of the specified category.
public GetPhysicalCategoryPath ( string category = null ) : string
category string The category for which to return the path
리턴 string

GetPhysicalViewPath() 공개 메소드

Returns the physical path to the views folder of the specified category.
public GetPhysicalViewPath ( string category = null ) : string
category string The category for which to return the path
리턴 string

GetPluginPath() 공개 메소드

Expands the specified childPath to its full path within the module with the specified pluginName.
public GetPluginPath ( string pluginName, string childPath ) : string
pluginName string The name of the plugin for which the path is being expanded.
childPath string The path to expand
리턴 string

GetRelativeWebPath() 공개 메소드

Converts, if possible, an absolute path to it's equivalent web accessible location (relative to the application path).
public GetRelativeWebPath ( string path, bool prependApplicationPath = false ) : string
path string The path to convert, for instance c:\Inetpub\wwwroot\mysite\static\resource.xml
prependApplicationPath bool if set to true, the path returned will be prefixed with the /// application path, if the path doesn't start with it already.
리턴 string

GetViewPath() 공개 메소드

Returns the path to the views folder of the specified category.
public GetViewPath ( string category = null ) : string
category string The category for which to return the path
리턴 string

Localize() 공개 메소드

Returns a localized version of the path, if such a file exists, searching for the name that most closely matches the current locale.
public Localize ( string path ) : string
path string The path, without any localization.
리턴 string

Localize() 공개 메소드

Returns a localized version of the path, if such a file exists, searching for the name that most closely matches the current locale.
public Localize ( string path, bool mapPath ) : string
path string The path, without any localization.
mapPath bool If true, the resulting path will be converted to a physical path.
리턴 string

Localize() 공개 메소드

Returns a localized version of the path, if such a file exists, searching for the name that most closely matches the current locale.
If the resource name suffix fallback hierarchy is configured to be: ch,de,default, while the specified locale is ch, given the path g:\projects\p1\resources\image.png, the method looks for files in this order: g:\projects\p1\resources\image-ch.png g:\projects\p1\resources\image-de.png g:\projects\p1\resources\image-default.png g:\projects\p1\resources\image.png As soon as a match is found, the search is over and the found file's path is returned.

The resulting path will not be mapped from a web to a physical path, it will be localized as-is.

public Localize ( string path, string locale, bool mapPath = false ) : string
path string The path, without any localization.
locale string The locale for which to search.
mapPath bool If true, the resulting path will be converted to a physical path.
리턴 string

PathResolver() 공개 메소드

Initializes a new instance of the PathResolver class using the specified SageContext to retrieve current category and locale information.
public PathResolver ( SageContext context ) : System
context SageContext The current .
리턴 System

Resolve() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the current SageContext and returns an absolute path.
public Resolve ( string templatePath ) : string
templatePath string The path to resolve.
리턴 string

Resolve() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified values and returns an absolute path.
public Resolve ( string templatePath, System.Web.QueryString values ) : string
templatePath string The template path to resolve.
values System.Web.QueryString The name/value collection of values to use
리턴 string

Resolve() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified context and returns an absolute path.
public Resolve ( string templatePath, SageContext context ) : string
templatePath string The template path to resolve.
context SageContext The context to use to get the category.
리턴 string

Resolve() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration, the current SageContext and the specified category, and returns an absolute path.
public Resolve ( string templatePath, string category ) : string
templatePath string The path to resolve.
category string The category to use instead of the current context's category when resolving.
리턴 string

Resolve() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration, the current SageContext and the specified category and locale, and returns an absolute path.
public Resolve ( string templatePath, string category, string locale ) : string
templatePath string The path to resolve.
category string The category to use instead of the current context's category when resolving.
locale string The locale to use instead of the current context's locale when resolving.
리턴 string

Substitute() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the current SageContext.
public Substitute ( string templatePath ) : string
templatePath string The path to resolve.
리턴 string

Substitute() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified values.
public Substitute ( string templatePath, System.Web.QueryString values ) : string
templatePath string The template path to resolve.
values System.Web.QueryString The name/value collection of values to use
리턴 string

Substitute() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration and the specified context.
public Substitute ( string templatePath, SageContext context ) : string
templatePath string The template path to resolve.
context SageContext The context to use to get the category.
리턴 string

Substitute() 공개 메소드

Substitutes any placeholders in the specified templatePath with values from the current ProjectConfiguration, the current SageContext and the specified category.
public Substitute ( string templatePath, string category ) : string
templatePath string The path to resolve.
category string The category to use instead of the current context's category when resolving.
리턴 string