BatchGuy.App.Shared.Services.AudioService.GetAudioTypeByName C# (CSharp) Method

GetAudioTypeByName() public method

public GetAudioTypeByName ( string name ) : EnumAudioType
name string
return EnumAudioType
        public EnumAudioType GetAudioTypeByName(string name)
        {
            EnumAudioType audioType = EnumAudioType.AC3;
            switch (name)
            {
                case "AC3":
                    audioType = EnumAudioType.AC3;
                    break;
                case "FLAC":
                    audioType = EnumAudioType.FLAC;
                    break;
                case "TrueHD":
                    audioType = EnumAudioType.TrueHD;
                    break;
                case "DTSMA":
                    audioType = EnumAudioType.DTSMA;
                    break;
                case "LPCM":
                    audioType = EnumAudioType.LPCM;
                    break;
                case "MPA":
                    audioType = EnumAudioType.MPA;
                    break;
                case "DTS Express":
                    audioType = EnumAudioType.DTSEXPRESS;
                    break;
                case "M4A":
                    audioType = EnumAudioType.M4A;
                    break;
                default:
                    throw new Exception("Invalid Audio Type");
            }
            return audioType;
        }

Usage Example

Example #1
0
 public void audioservice_can_get_dtsexpress_audio_type_by_name()
 {
     //given
     string name = "DTS Express";
     IAudioService service = new AudioService();
     //when
     EnumAudioType audioType = service.GetAudioTypeByName(name);
     //then
     audioType.Should().Be(EnumAudioType.DTSEXPRESS);
 }
All Usage Examples Of BatchGuy.App.Shared.Services.AudioService::GetAudioTypeByName