Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Internal / SapiAttributeParser.cs / 1 / SapiAttributeParser.cs
//------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System; using System.Collections.Generic; using System.Globalization; using System.Speech.Internal.SapiInterop; #if !SPEECHSERVER using System.Speech.AudioFormat; #endif namespace System.Speech.Internal { internal static class SapiAttributeParser { //******************************************************************* // // Internal Methods // //******************************************************************* #region Internal Methods static internal CultureInfo GetCultureInfoFromLanguageString (string valueString) { string [] strings = valueString.Split (';'); string langStringTrim = strings [0].Trim (); if (!string.IsNullOrEmpty (langStringTrim)) { try { return new CultureInfo (Int32.Parse (langStringTrim, NumberStyles.HexNumber, CultureInfo.InvariantCulture), false); } catch (ArgumentException) { return null; // If we have an invalid language id ignore it. Otherwise enumerating recognizers or voices would fail. } } return null; } #if !SPEECHSERVER static internal ListGetAudioFormatsFromString(string valueString) { List formatList = new List (); string [] strings = valueString.Split (';'); for (int i = 0; i < strings.Length; i++) { string formatString = strings [i].Trim (); if (!string.IsNullOrEmpty (formatString)) { SpeechAudioFormatInfo formatInfo = AudioFormatConverter.ToSpeechAudioFormatInfo (formatString); if (formatInfo != null) // Skip cases where a Guid is used. { formatList.Add (formatInfo); } } } return formatList; } #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.Globalization; using System.Speech.Internal.SapiInterop; #if !SPEECHSERVER using System.Speech.AudioFormat; #endif namespace System.Speech.Internal { internal static class SapiAttributeParser { //******************************************************************* // // Internal Methods // //******************************************************************* #region Internal Methods static internal CultureInfo GetCultureInfoFromLanguageString (string valueString) { string [] strings = valueString.Split (';'); string langStringTrim = strings [0].Trim (); if (!string.IsNullOrEmpty (langStringTrim)) { try { return new CultureInfo (Int32.Parse (langStringTrim, NumberStyles.HexNumber, CultureInfo.InvariantCulture), false); } catch (ArgumentException) { return null; // If we have an invalid language id ignore it. Otherwise enumerating recognizers or voices would fail. } } return null; } #if !SPEECHSERVER static internal ListGetAudioFormatsFromString(string valueString) { List formatList = new List (); string [] strings = valueString.Split (';'); for (int i = 0; i < strings.Length; i++) { string formatString = strings [i].Trim (); if (!string.IsNullOrEmpty (formatString)) { SpeechAudioFormatInfo formatInfo = AudioFormatConverter.ToSpeechAudioFormatInfo (formatString); if (formatInfo != null) // Skip cases where a Guid is used. { formatList.Add (formatInfo); } } } return formatList; } #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
- TypedElement.cs
- XmlNamespaceDeclarationsAttribute.cs
- ProviderException.cs
- ActiveXHelper.cs
- HttpGetProtocolReflector.cs
- RedirectionProxy.cs
- ContentValidator.cs
- EntitySetBaseCollection.cs
- LogEntry.cs
- DataGridTableCollection.cs
- SqlBuffer.cs
- TraceEventCache.cs
- ImageUrlEditor.cs
- SettingsPropertyWrongTypeException.cs
- QuaternionConverter.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- ApplicationCommands.cs
- SecurityManager.cs
- Events.cs
- LongCountAggregationOperator.cs
- AttachmentCollection.cs
- HandledMouseEvent.cs
- FileLevelControlBuilderAttribute.cs
- CodeGeneratorOptions.cs
- AsymmetricSignatureDeformatter.cs
- ProgressBarRenderer.cs
- MimeWriter.cs
- IChannel.cs
- ColorConverter.cs
- SizeAnimationClockResource.cs
- InArgument.cs
- ExpressionValueEditor.cs
- CommonDialog.cs
- FlowDocumentScrollViewer.cs
- FontFamily.cs
- WebPartEditVerb.cs
- LinkedList.cs
- DateTimeFormat.cs
- FilterInvalidBodyAccessException.cs
- WebDisplayNameAttribute.cs
- DataGridViewLayoutData.cs
- DataGridViewCellStyle.cs
- DesignerGenericWebPart.cs
- DbMetaDataCollectionNames.cs
- PanelDesigner.cs
- FormViewModeEventArgs.cs
- DataProtection.cs
- StylusButtonCollection.cs
- DiagnosticsConfigurationHandler.cs
- TextElementAutomationPeer.cs
- ObjectItemCollection.cs
- OperatingSystem.cs
- CellParagraph.cs
- ExtendedPropertyInfo.cs
- CodeAttributeArgumentCollection.cs
- CopyOnWriteList.cs
- Oid.cs
- PersonalizationStateQuery.cs
- SplitterPanelDesigner.cs
- XmlNamespaceDeclarationsAttribute.cs
- EnvironmentPermission.cs
- BamlRecords.cs
- ItemsChangedEventArgs.cs
- DateTimeParse.cs
- ObjectParameter.cs
- ActivityCollectionMarkupSerializer.cs
- IPPacketInformation.cs
- SerialPort.cs
- MenuItemBinding.cs
- BookmarkManager.cs
- Brush.cs
- SolidColorBrush.cs
- IdentitySection.cs
- ScrollEventArgs.cs
- DataServiceRequestException.cs
- HasCopySemanticsAttribute.cs
- CurrencyWrapper.cs
- ServiceManagerHandle.cs
- MatrixConverter.cs
- Point3DValueSerializer.cs
- RemotingConfigParser.cs
- XmlNodeComparer.cs
- LinqDataSourceUpdateEventArgs.cs
- WorkflowWebHostingModule.cs
- BamlRecordHelper.cs
- RegisteredArrayDeclaration.cs
- BamlRecordWriter.cs
- NodeLabelEditEvent.cs
- PanelDesigner.cs
- FirstMatchCodeGroup.cs
- WebSysDescriptionAttribute.cs
- IntSecurity.cs
- Debug.cs
- HelloMessageCD1.cs
- XmlSchemaImporter.cs
- TimeoutException.cs
- StylusButtonCollection.cs
- JsonCollectionDataContract.cs
- ItemContainerGenerator.cs
- ScrollChrome.cs