SapiAttributeParser.cs source code in C# .NET

Source code for the .NET framework in C#

                        

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 List GetAudioFormatsFromString(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 List GetAudioFormatsFromString(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

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK