예제 #1
0
파일: JArray.cs 프로젝트: trifox/evolution
        public override List <T> ToList <T>(IJsonDecoder <T> decode)
        {
            var result = new List <T>();

            for (int i = 0; i < elements.Length; i++)
            {
                result.Add(decode(elements[i] as JObject));
            }
            return(result);
        }
예제 #2
0
파일: JArray.cs 프로젝트: trifox/evolution
        public override T[] ToArray <T>(IJsonDecoder <T> decode)
        {
            var result = new T[elements.Length];

            for (int i = 0; i < elements.Length; i++)
            {
                result[i] = decode(elements[i] as JObject);
            }
            return(result);
        }
예제 #3
0
        public VoicesClient(string azureRegion, string azureSubscriptionKey, IJsonDecoder <Voice[]> voiceListDecoder, CachingStrategy cache)
        {
            if (string.IsNullOrEmpty(azureRegion))
            {
                throw new ArgumentException("Must provide a service region", nameof(azureRegion));
            }

            if (string.IsNullOrEmpty(azureSubscriptionKey))
            {
                throw new ArgumentException("Must provide a subscription key", nameof(azureSubscriptionKey));
            }

            if (voiceListDecoder is null ||
                voiceListDecoder.InputContentType != MediaType.Application_Json)
            {
                throw new ArgumentException("Must provide a JSON deserializer for the voice list data", nameof(voiceListDecoder));
            }

            Cache       = cache ?? new CachingStrategy();
            AzureRegion = azureRegion;
            this.azureSubscriptionKey = azureSubscriptionKey;
            this.voiceListDecoder     = voiceListDecoder;
        }
예제 #4
0
 public VoicesClient(string azureRegion, string azureSubscriptionKey, IJsonDecoder <Voice[]> voiceListDecoder)
     : this(azureRegion, azureSubscriptionKey, voiceListDecoder, null)
 {
 }
예제 #5
0
 public TextToSpeechClient(string azureRegion, string azureSubscriptionKey, string azureResourceName, IJsonDecoder <Voice[]> voiceListDecoder, AudioFormat outputFormat, IAudioDecoder audioDecoder)
     : this(azureRegion, azureSubscriptionKey, azureResourceName, voiceListDecoder, outputFormat, audioDecoder, null)
 {
 }
예제 #6
0
        public TextToSpeechClient(string azureRegion, string azureSubscriptionKey, string azureResourceName, IJsonDecoder <Voice[]> voiceListDecoder, AudioFormat outputFormat, IAudioDecoder audioDecoder, CachingStrategy cache)
            : base(azureRegion, azureSubscriptionKey, azureResourceName, voiceListDecoder, outputFormat, cache)
        {
            this.audioDecoder = audioDecoder
                                ?? throw new ArgumentException("Must provide an audio decoder", nameof(audioDecoder));

            CheckDecoderFormat();
        }
예제 #7
0
파일: JToken.cs 프로젝트: trifox/evolution
 public virtual T Decode <T>(IJsonDecoder <T> decoder)
 {
     throw new System.InvalidCastException("Decode only works on JObject instances!");
 }
예제 #8
0
파일: JToken.cs 프로젝트: trifox/evolution
 public virtual List <T> ToList <T>(IJsonDecoder <T> decoder)
 {
     throw new System.InvalidCastException("Cannot cast this to a list!");
 }
예제 #9
0
파일: JToken.cs 프로젝트: trifox/evolution
 public virtual T[] ToArray <T>(IJsonDecoder <T> decoder)
 {
     throw new System.InvalidCastException("Cannot cast this to an array!");
 }
예제 #10
0
        public TextToSpeechStreamClient(string azureRegion, string azureSubscriptionKey, string azureResourceName, IJsonDecoder <Voice[]> voiceListDecoder, AudioFormat outputFormat, CachingStrategy cache)
            : base(azureRegion, azureSubscriptionKey, voiceListDecoder, cache)
        {
            if (string.IsNullOrEmpty(azureResourceName))
            {
                throw new ArgumentException("Must provide a resource name that is tied to the subscription", nameof(azureResourceName));
            }

            this.azureResourceName = azureResourceName;

            OutputFormat = outputFormat
                           ?? throw new ArgumentException("Must provide an audio output format", nameof(outputFormat));
        }
예제 #11
0
파일: JObject.cs 프로젝트: trifox/evolution
 public override T Decode <T>(IJsonDecoder <T> decoder)
 {
     return(decoder(this));
 }