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
- EnumValidator.cs
- BrushValueSerializer.cs
- CmsUtils.cs
- PathFigureCollection.cs
- Int32RectValueSerializer.cs
- _DomainName.cs
- StylusPointPropertyInfoDefaults.cs
- PackageDigitalSignature.cs
- CompoundFileStreamReference.cs
- RelationshipEndCollection.cs
- SubMenuStyle.cs
- SerializationEventsCache.cs
- ValueTable.cs
- TextContainer.cs
- XamlVector3DCollectionSerializer.cs
- BordersPage.cs
- ChangesetResponse.cs
- IdleTimeoutMonitor.cs
- LicFileLicenseProvider.cs
- WebPartConnectionsCloseVerb.cs
- TerminateSequence.cs
- FtpWebResponse.cs
- LogEntrySerialization.cs
- HttpDebugHandler.cs
- ContextMenuStrip.cs
- DataPagerFieldItem.cs
- StyleXamlTreeBuilder.cs
- DataSourceSelectArguments.cs
- HandlerWithFactory.cs
- PriorityQueue.cs
- OleDbReferenceCollection.cs
- Unit.cs
- DoubleStorage.cs
- UIElement.cs
- IArgumentProvider.cs
- WebPartVerbsEventArgs.cs
- XmlTextReader.cs
- TextDecoration.cs
- RoleService.cs
- ConfigXmlAttribute.cs
- ManifestResourceInfo.cs
- Button.cs
- Update.cs
- Matrix3DStack.cs
- XamlToRtfWriter.cs
- RadioButtonBaseAdapter.cs
- Command.cs
- RenderDataDrawingContext.cs
- ProtocolException.cs
- Timer.cs
- _ConnectOverlappedAsyncResult.cs
- PlainXmlDeserializer.cs
- SqlDataSourceStatusEventArgs.cs
- CurrencyManager.cs
- BuilderInfo.cs
- SHA1.cs
- XmlSchemaSimpleTypeRestriction.cs
- EnumMemberAttribute.cs
- LiteralTextParser.cs
- SqlException.cs
- AgileSafeNativeMemoryHandle.cs
- WebPartCancelEventArgs.cs
- Rotation3DAnimation.cs
- SQLDecimalStorage.cs
- GestureRecognizer.cs
- GeometryGroup.cs
- XmlDeclaration.cs
- NodeLabelEditEvent.cs
- MachinePropertyVariants.cs
- Simplifier.cs
- CodeExporter.cs
- UrlMappingsModule.cs
- XmlCustomFormatter.cs
- TransformerTypeCollection.cs
- OdbcStatementHandle.cs
- InputLanguageEventArgs.cs
- IERequestCache.cs
- XmlTextEncoder.cs
- RelOps.cs
- CalendarDateRange.cs
- CngAlgorithm.cs
- TextParentUndoUnit.cs
- _NestedMultipleAsyncResult.cs
- ValueConversionAttribute.cs
- OleDbConnectionInternal.cs
- PublishLicense.cs
- SafeBitVector32.cs
- StylusCaptureWithinProperty.cs
- ReachDocumentPageSerializer.cs
- TemplateInstanceAttribute.cs
- GridEntryCollection.cs
- dbenumerator.cs
- AddingNewEventArgs.cs
- WebPermission.cs
- HttpSessionStateBase.cs
- AdapterUtil.cs
- ConstraintConverter.cs
- AuthorizationSection.cs
- SqlInternalConnection.cs
- ComMethodElement.cs