Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Recognition / RecognizerInfo.cs / 1 / RecognizerInfo.cs
//------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Speech.AudioFormat; using System.Speech.Internal; using System.Speech.Internal.SapiInterop; using System.Speech.Internal.ObjectTokens; using RegistryEntry = System.Collections.Generic.KeyValuePair; namespace System.Speech.Recognition { /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo"]/*' /> // This represents the attributes various speech recognizers may, or may not support. public class RecognizerInfo { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors private RecognizerInfo (ObjectToken token, CultureInfo culture) { // Retrieve the token name _id = token.Name; // Retrieve default display name _description = token.Description; // Store full object token id for internal use. _sapiObjectTokenId = token.Id; _name = token.TokenName (); _culture = culture; // Enum all values and add to custom table foreach (string keyName in token.Attributes.GetValueNames ()) { string attributeValue; if (token.Attributes.TryGetString (keyName, out attributeValue)) { _attributes.InternalDictionary [keyName] = attributeValue; } } #if !SPEECHSERVER string audioFormats; if (token.Attributes.TryGetString ("AudioFormats", out audioFormats)) { _supportedAudioFormats = new ReadOnlyCollection (SapiAttributeParser.GetAudioFormatsFromString (audioFormats)); } else { _supportedAudioFormats = new ReadOnlyCollection (new List ()); } #endif } static internal RecognizerInfo Create (ObjectToken token) { // Token for recognizer should have Attributes. if (token.Attributes == null) { return null; } // Get other attributes string langId; // must have a language id if (!token.Attributes.TryGetString ("Language", out langId)) { return null; } CultureInfo cultureInfo = SapiAttributeParser.GetCultureInfoFromLanguageString (langId); if (cultureInfo != null) { return new RecognizerInfo(token, cultureInfo); } else { return null; } } #endregion //******************************************************************** // // Public Properties // //******************************************************************* #region public Properties /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.Name"]/*' /> public string Id { get { return _id; } } /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.Name"]/*' /> public string Name { get { return _name; } } /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.DisplayName"]/*' /> public string Description { get { return _description; } } /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.CultureInfo"]/*' /> public CultureInfo Culture { get { return _culture; } } #if !SPEECHSERVER /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.SupportedAudioFormats"]/*' /> public ReadOnlyCollection SupportedAudioFormats { get { return _supportedAudioFormats; } } #endif /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.AdditionalInfo"]/*' /> public IDictionary AdditionalInfo { get { return _attributes; } } #endregion //******************************************************************** // // Internal Properties // //******************************************************************** #region Internal Properties internal string SapiObjectTokenId { get { return _sapiObjectTokenId; } } #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields // This table stores each attribute private ReadOnlyDictionary _attributes = new ReadOnlyDictionary (); // Named attributes - these get initialized in constructor private string _id; private string _name; private string _description; private string _sapiObjectTokenId; private CultureInfo _culture; #if !SPEECHSERVER private ReadOnlyCollection _supportedAudioFormats; #endif #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Speech.AudioFormat; using System.Speech.Internal; using System.Speech.Internal.SapiInterop; using System.Speech.Internal.ObjectTokens; using RegistryEntry = System.Collections.Generic.KeyValuePair; namespace System.Speech.Recognition { /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo"]/*' /> // This represents the attributes various speech recognizers may, or may not support. public class RecognizerInfo { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors private RecognizerInfo (ObjectToken token, CultureInfo culture) { // Retrieve the token name _id = token.Name; // Retrieve default display name _description = token.Description; // Store full object token id for internal use. _sapiObjectTokenId = token.Id; _name = token.TokenName (); _culture = culture; // Enum all values and add to custom table foreach (string keyName in token.Attributes.GetValueNames ()) { string attributeValue; if (token.Attributes.TryGetString (keyName, out attributeValue)) { _attributes.InternalDictionary [keyName] = attributeValue; } } #if !SPEECHSERVER string audioFormats; if (token.Attributes.TryGetString ("AudioFormats", out audioFormats)) { _supportedAudioFormats = new ReadOnlyCollection (SapiAttributeParser.GetAudioFormatsFromString (audioFormats)); } else { _supportedAudioFormats = new ReadOnlyCollection (new List ()); } #endif } static internal RecognizerInfo Create (ObjectToken token) { // Token for recognizer should have Attributes. if (token.Attributes == null) { return null; } // Get other attributes string langId; // must have a language id if (!token.Attributes.TryGetString ("Language", out langId)) { return null; } CultureInfo cultureInfo = SapiAttributeParser.GetCultureInfoFromLanguageString (langId); if (cultureInfo != null) { return new RecognizerInfo(token, cultureInfo); } else { return null; } } #endregion //******************************************************************** // // Public Properties // //******************************************************************* #region public Properties /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.Name"]/*' /> public string Id { get { return _id; } } /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.Name"]/*' /> public string Name { get { return _name; } } /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.DisplayName"]/*' /> public string Description { get { return _description; } } /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.CultureInfo"]/*' /> public CultureInfo Culture { get { return _culture; } } #if !SPEECHSERVER /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.SupportedAudioFormats"]/*' /> public ReadOnlyCollection SupportedAudioFormats { get { return _supportedAudioFormats; } } #endif /// TODOC <_include file='doc\RecognizerInfo.uex' path='docs/doc[@for="RecognizerInfo.AdditionalInfo"]/*' /> public IDictionary AdditionalInfo { get { return _attributes; } } #endregion //******************************************************************** // // Internal Properties // //******************************************************************** #region Internal Properties internal string SapiObjectTokenId { get { return _sapiObjectTokenId; } } #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields // This table stores each attribute private ReadOnlyDictionary _attributes = new ReadOnlyDictionary (); // Named attributes - these get initialized in constructor private string _id; private string _name; private string _description; private string _sapiObjectTokenId; private CultureInfo _culture; #if !SPEECHSERVER private ReadOnlyCollection _supportedAudioFormats; #endif #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextFormattingConverter.cs
- EventlogProvider.cs
- CreateUserWizard.cs
- Brush.cs
- ComboBoxAutomationPeer.cs
- Mappings.cs
- EpmContentDeSerializer.cs
- HttpRuntime.cs
- MemberMemberBinding.cs
- SqlInternalConnectionTds.cs
- PresentationTraceSources.cs
- BatchParser.cs
- RankException.cs
- MarginsConverter.cs
- FileUpload.cs
- DataControlFieldHeaderCell.cs
- ManagedIStream.cs
- SystemResourceHost.cs
- DataControlLinkButton.cs
- SqlGenericUtil.cs
- ExpressionEditorAttribute.cs
- UnknownBitmapDecoder.cs
- QuaternionRotation3D.cs
- SecUtil.cs
- PerformanceCounterPermission.cs
- NodeLabelEditEvent.cs
- WindowsIPAddress.cs
- SqlOuterApplyReducer.cs
- ProfessionalColors.cs
- InstanceNotReadyException.cs
- HostedNamedPipeTransportManager.cs
- StringBuilder.cs
- EmptyStringExpandableObjectConverter.cs
- ClientBuildManagerCallback.cs
- WindowsFormsHost.cs
- FutureFactory.cs
- XpsInterleavingPolicy.cs
- ConnectionPoolManager.cs
- XPathNodePointer.cs
- WebPartDisplayModeCollection.cs
- NestPullup.cs
- EpmSourcePathSegment.cs
- DataSetMappper.cs
- TCEAdapterGenerator.cs
- PrimaryKeyTypeConverter.cs
- BindValidationContext.cs
- EntityEntry.cs
- Stylesheet.cs
- InputMethodStateChangeEventArgs.cs
- ServiceChannel.cs
- SystemWebCachingSectionGroup.cs
- X509CertificateCollection.cs
- TextEmbeddedObject.cs
- SystemIPv4InterfaceProperties.cs
- AbandonedMutexException.cs
- SpStreamWrapper.cs
- SingleAnimationUsingKeyFrames.cs
- DataKeyCollection.cs
- WebWorkflowRole.cs
- RenderCapability.cs
- TransformValueSerializer.cs
- SqlUdtInfo.cs
- WithStatement.cs
- X509CertificateStore.cs
- HierarchicalDataTemplate.cs
- Encoder.cs
- TableDetailsRow.cs
- MethodBuilder.cs
- JsonFaultDetail.cs
- QueryStatement.cs
- UpdateProgress.cs
- StoryFragments.cs
- ForeignKeyConstraint.cs
- LinkButton.cs
- Attributes.cs
- OdbcDataReader.cs
- RegionInfo.cs
- AutomationPropertyInfo.cs
- XsdCachingReader.cs
- JournalEntryListConverter.cs
- OleTxTransactionInfo.cs
- SafeEventLogWriteHandle.cs
- ListenDesigner.cs
- SmtpFailedRecipientException.cs
- OdbcUtils.cs
- ReflectionUtil.cs
- XmlDataDocument.cs
- OrderablePartitioner.cs
- HtmlTernaryTree.cs
- Repeater.cs
- StreamWithDictionary.cs
- DocumentStatusResources.cs
- SiteMembershipCondition.cs
- ToolStripStatusLabel.cs
- ContourSegment.cs
- KeyboardNavigation.cs
- CheckBox.cs
- AutomationElementIdentifiers.cs
- MessageHeader.cs
- XmlValidatingReader.cs