Code:
/ DotNET / DotNET / 8.0 / untmp / 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 [....]
//---------------------------------------------------------------------------
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
- WbmpConverter.cs
- HttpModuleCollection.cs
- EditorZone.cs
- Imaging.cs
- util.cs
- PropertyCondition.cs
- Unit.cs
- WebPartConnectionsDisconnectVerb.cs
- IgnorePropertiesAttribute.cs
- Enlistment.cs
- CompilerInfo.cs
- DefaultBinder.cs
- DbConnectionFactory.cs
- LayoutTableCell.cs
- ListenerTraceUtility.cs
- WebPartChrome.cs
- CommandID.cs
- BitmapData.cs
- XmlReturnWriter.cs
- BitArray.cs
- XmlAnyElementAttributes.cs
- Pair.cs
- HtmlWindowCollection.cs
- PtsHelper.cs
- LayoutTable.cs
- PKCS1MaskGenerationMethod.cs
- coordinator.cs
- ToolStripArrowRenderEventArgs.cs
- WebEvents.cs
- EventPrivateKey.cs
- OdbcConnectionString.cs
- CodeCatchClause.cs
- BulletChrome.cs
- ExtenderControl.cs
- EntityTypeEmitter.cs
- DragEventArgs.cs
- TimeoutValidationAttribute.cs
- BitmapEffectDrawing.cs
- PrintDialog.cs
- WindowAutomationPeer.cs
- UInt32Converter.cs
- ComAdminInterfaces.cs
- Button.cs
- EntityDataSourceViewSchema.cs
- ReliabilityContractAttribute.cs
- ConfigsHelper.cs
- PreservationFileReader.cs
- WhitespaceRule.cs
- DataServiceException.cs
- SymbolType.cs
- SimpleTableProvider.cs
- ColorAnimation.cs
- AccessDataSource.cs
- ListSortDescriptionCollection.cs
- ProfilePropertySettingsCollection.cs
- DesignerMetadata.cs
- MetadataItem.cs
- Light.cs
- CommonBehaviorsSection.cs
- GlobalEventManager.cs
- filewebrequest.cs
- CapabilitiesUse.cs
- IdentitySection.cs
- BmpBitmapEncoder.cs
- UpdatePanelTriggerCollection.cs
- updatecommandorderer.cs
- RightsManagementPermission.cs
- RangeEnumerable.cs
- ContextStaticAttribute.cs
- HttpResponse.cs
- ModulesEntry.cs
- DocumentViewerAutomationPeer.cs
- DateTimeOffsetConverter.cs
- NativeMethods.cs
- StringConcat.cs
- TreeIterator.cs
- SiteOfOriginPart.cs
- MaskDescriptor.cs
- XmlSchemaChoice.cs
- HttpListenerContext.cs
- DefaultBinder.cs
- ListGeneralPage.cs
- SqlRowUpdatedEvent.cs
- XmlElementAttribute.cs
- Stackframe.cs
- SafeFindHandle.cs
- SafeFileMappingHandle.cs
- ListViewGroupConverter.cs
- FormViewDeletedEventArgs.cs
- Variant.cs
- FormattedText.cs
- PathSegment.cs
- SqlServer2KCompatibilityAnnotation.cs
- PathSegmentCollection.cs
- isolationinterop.cs
- InternalMappingException.cs
- _ProxyRegBlob.cs
- DataGridCellClipboardEventArgs.cs
- OutOfMemoryException.cs
- ObjectCloneHelper.cs