Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / 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
- UniqueID.cs
- ScriptingScriptResourceHandlerSection.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- TimeSpanStorage.cs
- WebBrowserDocumentCompletedEventHandler.cs
- QilInvokeLateBound.cs
- QueryableDataSourceHelper.cs
- WorkflowInspectionServices.cs
- DesignerActionGlyph.cs
- VScrollProperties.cs
- PerfService.cs
- EntitySetDataBindingList.cs
- LinqDataSourceDisposeEventArgs.cs
- SelectManyQueryOperator.cs
- SqlWebEventProvider.cs
- SamlAuthorityBinding.cs
- Root.cs
- ListViewInsertedEventArgs.cs
- InputLanguageCollection.cs
- WebPartDisplayModeCollection.cs
- GC.cs
- DbProviderSpecificTypePropertyAttribute.cs
- ProviderSettingsCollection.cs
- DefaultAssemblyResolver.cs
- StateMachineSubscription.cs
- DataControlPagerLinkButton.cs
- NameValueCollection.cs
- XmlAttributeHolder.cs
- DecimalFormatter.cs
- TextElementEditingBehaviorAttribute.cs
- EntityObject.cs
- PathTooLongException.cs
- InvalidCastException.cs
- InputProviderSite.cs
- SwitchLevelAttribute.cs
- PingReply.cs
- DataSvcMapFile.cs
- IOThreadTimer.cs
- SqlAliasesReferenced.cs
- ScriptIgnoreAttribute.cs
- NumericPagerField.cs
- MultiPageTextView.cs
- XamlNamespaceHelper.cs
- CheckBoxRenderer.cs
- RoutedPropertyChangedEventArgs.cs
- MinimizableAttributeTypeConverter.cs
- PostBackOptions.cs
- SliderAutomationPeer.cs
- Component.cs
- XmlDsigSep2000.cs
- MenuItemStyle.cs
- GeometryDrawing.cs
- AssemblySettingAttributes.cs
- StyleModeStack.cs
- DataServiceHost.cs
- XDRSchema.cs
- DataGridViewRow.cs
- AppDomainFactory.cs
- DecimalAnimationBase.cs
- ClientBuildManagerCallback.cs
- Wow64ConfigurationLoader.cs
- FieldTemplateFactory.cs
- DesignTimeVisibleAttribute.cs
- LinearKeyFrames.cs
- DeobfuscatingStream.cs
- EventItfInfo.cs
- EntityStoreSchemaFilterEntry.cs
- SubtreeProcessor.cs
- WindowsListViewItemCheckBox.cs
- TileBrush.cs
- ConfigurationSection.cs
- NotImplementedException.cs
- CqlIdentifiers.cs
- AsyncOperationManager.cs
- WebConvert.cs
- AppSettingsReader.cs
- SqlCacheDependency.cs
- MenuItem.cs
- PackWebResponse.cs
- MultilineStringEditor.cs
- hresults.cs
- AgileSafeNativeMemoryHandle.cs
- XmlBinaryReader.cs
- DesignerAdapterUtil.cs
- CollectionBase.cs
- WebBrowserHelper.cs
- TargetParameterCountException.cs
- ILGen.cs
- CDSsyncETWBCLProvider.cs
- RelatedImageListAttribute.cs
- AssemblyResourceLoader.cs
- HttpConfigurationSystem.cs
- PathSegmentCollection.cs
- RemoteWebConfigurationHostServer.cs
- DeviceOverridableAttribute.cs
- SecurityCriticalDataForSet.cs
- Profiler.cs
- IndexingContentUnit.cs
- ParsedRoute.cs
- Assert.cs