Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Internal / ObjectToken / ObjectTokenCategory.cs / 1 / ObjectTokenCategory.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: // Object Token Category // // History: // 7/1/2004 jeanfp //--------------------------------------------------------------------------- using Microsoft.Win32; using System; using System.Collections; using System.Collections.Generic; using System.Globalization; namespace System.Speech.Internal.ObjectTokens { ////// Summary description for ObjectTokenCategory. /// internal class ObjectTokenCategory : RegistryDataKey, IEnumerable{ //******************************************************************* // // Constructors // //******************************************************************* #region Constructors protected ObjectTokenCategory (string keyId, RegistryKey hkey) : base (keyId, hkey) { } static internal ObjectTokenCategory Create (string sCategoryId) { string id; RegistryKey hkey = ObjectToken.CreateKey (sCategoryId, false, out id); if (hkey != null) { return new ObjectTokenCategory (id, hkey); } return null; } #endregion //******************************************************************** // // Internal Methods // //******************************************************************* #region internal Methods internal ObjectToken OpenToken (string keyName) { // Check if the token is for a voice string tokenName = keyName; if (!string.IsNullOrEmpty (tokenName) && tokenName.IndexOf ("HKEY_", StringComparison.Ordinal) != 0) { tokenName = string.Format (CultureInfo.InvariantCulture, @"{0}\Tokens\{1}", Id, tokenName); } bool fVoiceToken = !string.IsNullOrEmpty (tokenName) && tokenName.IndexOf (@"Voices\Tokens", StringComparison.Ordinal) > 0; return fVoiceToken ? VoiceObjectToken.Create (null, tokenName) : ObjectToken.Create (null, tokenName, false); } #if false internal ObjectToken CreateToken (string keyName) { return new ObjectToken (Id, @"Token\" + keyName, true); } internal void DeleteToken (string keyName) { DeleteKey (@"Token\" + keyName); } #endif #region IEnumerable implementation IEnumerator IEnumerable .GetEnumerator () { RegistryDataKey token; if (TryOpenKey ("Tokens", out token)) { foreach (RegistryDataKey key in token) { string id = key.Id; yield return OpenToken (key.Id); key.Dispose (); } token.Dispose (); } } IEnumerator IEnumerable.GetEnumerator () { return ((IEnumerable ) this).GetEnumerator (); } #endregion #endregion //******************************************************************** // // Protected Methods // //******************************************************************** #region Protected Methods protected override void Dispose (bool disposing) { base.Dispose (disposing); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // // Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: // Object Token Category // // History: // 7/1/2004 jeanfp //--------------------------------------------------------------------------- using Microsoft.Win32; using System; using System.Collections; using System.Collections.Generic; using System.Globalization; namespace System.Speech.Internal.ObjectTokens { ////// Summary description for ObjectTokenCategory. /// internal class ObjectTokenCategory : RegistryDataKey, IEnumerable{ //******************************************************************* // // Constructors // //******************************************************************* #region Constructors protected ObjectTokenCategory (string keyId, RegistryKey hkey) : base (keyId, hkey) { } static internal ObjectTokenCategory Create (string sCategoryId) { string id; RegistryKey hkey = ObjectToken.CreateKey (sCategoryId, false, out id); if (hkey != null) { return new ObjectTokenCategory (id, hkey); } return null; } #endregion //******************************************************************** // // Internal Methods // //******************************************************************* #region internal Methods internal ObjectToken OpenToken (string keyName) { // Check if the token is for a voice string tokenName = keyName; if (!string.IsNullOrEmpty (tokenName) && tokenName.IndexOf ("HKEY_", StringComparison.Ordinal) != 0) { tokenName = string.Format (CultureInfo.InvariantCulture, @"{0}\Tokens\{1}", Id, tokenName); } bool fVoiceToken = !string.IsNullOrEmpty (tokenName) && tokenName.IndexOf (@"Voices\Tokens", StringComparison.Ordinal) > 0; return fVoiceToken ? VoiceObjectToken.Create (null, tokenName) : ObjectToken.Create (null, tokenName, false); } #if false internal ObjectToken CreateToken (string keyName) { return new ObjectToken (Id, @"Token\" + keyName, true); } internal void DeleteToken (string keyName) { DeleteKey (@"Token\" + keyName); } #endif #region IEnumerable implementation IEnumerator IEnumerable .GetEnumerator () { RegistryDataKey token; if (TryOpenKey ("Tokens", out token)) { foreach (RegistryDataKey key in token) { string id = key.Id; yield return OpenToken (key.Id); key.Dispose (); } token.Dispose (); } } IEnumerator IEnumerable.GetEnumerator () { return ((IEnumerable ) this).GetEnumerator (); } #endregion #endregion //******************************************************************** // // Protected Methods // //******************************************************************** #region Protected Methods protected override void Dispose (bool disposing) { base.Dispose (disposing); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CompilerParameters.cs
- SecurityProtocolFactory.cs
- TrustSection.cs
- BitConverter.cs
- MatrixAnimationUsingPath.cs
- GPStream.cs
- ThemeDirectoryCompiler.cs
- SqlErrorCollection.cs
- ListView.cs
- TextEditorMouse.cs
- ProcessModelInfo.cs
- ValidateNames.cs
- ItemType.cs
- NumericPagerField.cs
- TypeGeneratedEventArgs.cs
- TextBoxAutoCompleteSourceConverter.cs
- ObjectViewQueryResultData.cs
- BaseDataListActionList.cs
- WebServicesSection.cs
- SqlInfoMessageEvent.cs
- Component.cs
- MarkedHighlightComponent.cs
- relpropertyhelper.cs
- Variant.cs
- ParseChildrenAsPropertiesAttribute.cs
- StylusButtonEventArgs.cs
- ScriptManager.cs
- StateDesigner.Helpers.cs
- MobileComponentEditorPage.cs
- GridViewDesigner.cs
- DrawingVisual.cs
- PageStatePersister.cs
- TextRangeEditLists.cs
- SurrogateSelector.cs
- StateBag.cs
- DataMemberConverter.cs
- TextElementEnumerator.cs
- ValidatedControlConverter.cs
- ComponentChangingEvent.cs
- VisualBasicHelper.cs
- TrailingSpaceComparer.cs
- XmlReturnWriter.cs
- ServiceBusyException.cs
- XmlTypeMapping.cs
- CheckBox.cs
- TargetConverter.cs
- XmlRootAttribute.cs
- PointAnimationClockResource.cs
- PageCodeDomTreeGenerator.cs
- WebPartManagerInternals.cs
- Console.cs
- XmlPropertyBag.cs
- VerificationException.cs
- BitmapFrameDecode.cs
- ChameleonKey.cs
- CodeTypeOfExpression.cs
- CacheRequest.cs
- DbCommandDefinition.cs
- SchemaImporter.cs
- ExtendedPropertyDescriptor.cs
- XmlAnyElementAttributes.cs
- TopClause.cs
- URLIdentityPermission.cs
- DataGridCell.cs
- GradientBrush.cs
- JobInputBins.cs
- TypeForwardedFromAttribute.cs
- Message.cs
- NumberFunctions.cs
- DBPropSet.cs
- ExternalCalls.cs
- FixUp.cs
- XmlHierarchicalDataSourceView.cs
- UnionCqlBlock.cs
- ContainsSearchOperator.cs
- StylusLogic.cs
- DropShadowBitmapEffect.cs
- DesignerSelectionListAdapter.cs
- InstanceCreationEditor.cs
- Size.cs
- DownloadProgressEventArgs.cs
- RectIndependentAnimationStorage.cs
- SeparatorAutomationPeer.cs
- PolyLineSegmentFigureLogic.cs
- DecoderFallback.cs
- ScriptModule.cs
- HttpListener.cs
- XmlSchemas.cs
- HyperLinkDesigner.cs
- TemplateBindingExtensionConverter.cs
- PathFigureCollection.cs
- Panel.cs
- SafeSystemMetrics.cs
- WebPartZone.cs
- StatusBarPanelClickEvent.cs
- InputReport.cs
- HtmlInputText.cs
- BaseValidator.cs
- HostingEnvironmentException.cs
- ScrollBar.cs