C# Класс VisualCaptcha.Captcha

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
PossibleImageOptions string>.ImmutableDictionary
ValidAudioOption string>.KeyValuePair
ValidImageOption string>.KeyValuePair

Открытые методы

Метод Описание
Captcha ( int numberOfImageOptions ) : System

Instantiate a Captcha session with an assortment of possible image selections and an audio option for accessibility

GetAudio ( string type ) : byte[]

Get file content for audio Captcha option

GetFrontEndData ( ) : FrontEndData

Retrieve object containing information needed by client-side library

GetImage ( int index, bool isRetina ) : byte[]

Get file content for image Captcha option

ValidateAnswer ( string answerValue ) : bool

Answer value is valid for either image or audio option

Приватные методы

Метод Описание
GetRandomImageOptions ( int numberOfOptions ) : string>.ImmutableDictionary
GetRandomOption ( string>.ICollection options ) : string>.KeyValuePair
IsValidAudio ( string value ) : bool
IsValidImage ( string hashedPath ) : bool
ReadResource ( string optionPath ) : byte[]

Описание методов

Captcha() публичный Метод

Instantiate a Captcha session with an assortment of possible image selections and an audio option for accessibility
public Captcha ( int numberOfImageOptions ) : System
numberOfImageOptions int
Результат System

GetAudio() публичный Метод

Get file content for audio Captcha option
public GetAudio ( string type ) : byte[]
type string Either mp3 or ogg
Результат byte[]

GetFrontEndData() публичный Метод

Retrieve object containing information needed by client-side library
public GetFrontEndData ( ) : FrontEndData
Результат FrontEndData

GetImage() публичный Метод

Get file content for image Captcha option
public GetImage ( int index, bool isRetina ) : byte[]
index int Image index
isRetina bool Uses Retina display
Результат byte[]

ValidateAnswer() публичный Метод

Answer value is valid for either image or audio option
public ValidateAnswer ( string answerValue ) : bool
answerValue string This could be the hashed value of the image path or the answer to an audio question
Результат bool

Описание свойств

PossibleImageOptions публичное свойство

Dictionary of possible images to be displayed client-side Key: The image name (e.g. "Cloud") Value: The hashed value of the image path (e.g. "Cloud.png" --> "198723lkdjlfiwoekjdlsd")
public ImmutableDictionary PossibleImageOptions
Результат string>.ImmutableDictionary

ValidAudioOption публичное свойство

The correct question/answer pair for audio accessibility option
public KeyValuePair ValidAudioOption
Результат string>.KeyValuePair

ValidImageOption публичное свойство

The correct selection out of the options contained in PossibleImageOptions
public KeyValuePair ValidImageOption
Результат string>.KeyValuePair