C# Class SenseNet.ContentRepository.ContentNamingHelper

显示文件 Open project: maxpavlov/FlexNet Class Usage Examples

Private Properties

Property Type Description
CharIsAllowed bool
EnsureContentName string
GetNewPath string
IsUriClean bool
NonStrippingChar bool
Strip string
TailClean string
UriCleanup string

Public Methods

Method Description
EnforceRequiredExtension ( string nameBase, ContentType type ) : string
EnsureExtension ( string nameBase, string reqext ) : string
GetFileExtension ( string fileName ) : string

Gets the extension from a provided filename. Return string contains the '.' character.

GetFileNameWithoutExtension ( string fileName, string extension ) : string

Gets the filename without the provided extension.

GetNameFromDisplayName ( string displayName ) : string

Removes invalid characters from the provided displayname, without enforcing original extension.

GetNameFromDisplayName ( string originalName, string displayName ) : string

Removes invalid characters from the provided displayname, leaving original extension intact.

GetNewName ( string nameBase, ContentType type, Node parent ) : string
GetNoAccents ( string r ) : string

Removes accents from input string.

IncrementNameSuffix ( string name, string &nameBase ) : string
IncrementNameSuffixToLastName ( string currentName, int parentNodeId ) : string
ParseSuffix ( string name, string &nameBase, bool &inValidNumber ) : int

Parses name from format 'name(x)'

RemoveInvalidCharacters ( string s ) : string

Removes invalid characters from the provided displayname.

Private Methods

Method Description
CharIsAllowed ( char c ) : bool
EnsureContentName ( string nameBase, Node container ) : string
GetNewPath ( Node container, string defaultName, int index, string &newName ) : string
IsUriClean ( string s ) : bool
NonStrippingChar ( char c ) : bool
Strip ( string name ) : string
TailClean ( string s ) : string
UriCleanup ( string s ) : string

Method Details

EnforceRequiredExtension() public static method

public static EnforceRequiredExtension ( string nameBase, ContentType type ) : string
nameBase string
type SenseNet.ContentRepository.Schema.ContentType
return string

EnsureExtension() public static method

public static EnsureExtension ( string nameBase, string reqext ) : string
nameBase string
reqext string
return string

GetFileExtension() public static method

Gets the extension from a provided filename. Return string contains the '.' character.
public static GetFileExtension ( string fileName ) : string
fileName string
return string

GetFileNameWithoutExtension() public static method

Gets the filename without the provided extension.
public static GetFileNameWithoutExtension ( string fileName, string extension ) : string
fileName string
extension string
return string

GetNameFromDisplayName() public static method

Removes invalid characters from the provided displayname, without enforcing original extension.
public static GetNameFromDisplayName ( string displayName ) : string
displayName string The input displayname that will be converted to a valid url name.
return string

GetNameFromDisplayName() public static method

Removes invalid characters from the provided displayname, leaving original extension intact.
public static GetNameFromDisplayName ( string originalName, string displayName ) : string
originalName string The original name of the Content, to keep its original extension. If unknown, provide extension only in the form of '.ext'. If original extension is not to be kept, provide null.
displayName string The input displayname that will be converted to a valid url name.
return string

GetNewName() public static method

public static GetNewName ( string nameBase, ContentType type, Node parent ) : string
nameBase string
type SenseNet.ContentRepository.Schema.ContentType
parent Node
return string

GetNoAccents() public static method

Removes accents from input string.
public static GetNoAccents ( string r ) : string
r string
return string

IncrementNameSuffix() public static method

public static IncrementNameSuffix ( string name, string &nameBase ) : string
name string
nameBase string
return string

IncrementNameSuffixToLastName() public static method

public static IncrementNameSuffixToLastName ( string currentName, int parentNodeId ) : string
currentName string
parentNodeId int
return string

ParseSuffix() public static method

Parses name from format 'name(x)'
public static ParseSuffix ( string name, string &nameBase, bool &inValidNumber ) : int
name string name to parse
nameBase string parsed namebase
inValidNumber bool true if correct format is detected but (x) is not a valid number
return int

RemoveInvalidCharacters() public static method

Removes invalid characters from the provided displayname.
public static RemoveInvalidCharacters ( string s ) : string
s string
return string