HttpRequestMessage CreateRequest(OutputMode outputMode) { try { var uriBuilder = new UriBuilder(SpeechEndpoint.Protocol, SpeechEndpoint.Host, SpeechEndpoint.Port, SpeechEndpoint.Path); uriBuilder.Path += $"/{RecognitionMode.ToString ().ToLower ()}/cognitiveservices/{ApiVersion}"; uriBuilder.Query = $"language={RecognitionLanguage}&format={outputMode.ToString ().ToLower ()}&profanity={ProfanityMode.ToString ().ToLower ()}"; Debug.WriteLine($"{DateTime.Now} :: Request Uri: {uriBuilder.Uri}"); var request = new HttpRequestMessage(HttpMethod.Post, uriBuilder.Uri); request.Headers.TransferEncodingChunked = true; request.Headers.ExpectContinue = true; request.Headers.Authorization = new AuthenticationHeaderValue(Constants.Keys.Bearer, AuthClient.Token); request.Headers.Accept.ParseAdd(Constants.MimeTypes.Json); request.Headers.Accept.ParseAdd(Constants.MimeTypes.Xml); request.Headers.Host = SpeechEndpoint.Host; return(request); } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } }
void OnRenderImage(RenderTexture source, RenderTexture destination) { mat.shaderKeywords = null; if (outputMode != OutputMode.___) { mat.EnableKeyword(outputMode.ToString()); } mat.SetFloat(P_BLEND, blend); Graphics.Blit(source, destination, mat); }
/// <summary> /// Get XML Stats Data /// </summary> public string GetStats(int id, OutputMode mode = OutputMode.XML) { Dictionary <string, string> Params = new Dictionary <string, string>(); Params.Add("action", "get_stats"); Params.Add("plan", this.plan); Params.Add("user", this.user); Params.Add("pass", this.pass); Params.Add("mode", mode.ToString().ToLower()); //XML or JSON Params.Add("eid", id.ToString()); string bruto = GetResponse(this.urlBase, Params, this.apiMethod); if (bruto.Substring(0, 2) == "KO") { throw new TeenvioException(bruto); } return(GetResponse(this.urlBase, Params, this.apiMethod)); }
public static void AddNetCoreLogging(this IServiceCollection services, LogLevel logLevel, OutputMode outputMode) { switch (outputMode) { case OutputMode.Console: services.AddLogging(opt => { opt.AddConsole(); opt.SetMinimumLevel(logLevel); }); break; case OutputMode.File: throw new NotSupportedException(outputMode.ToString()); default: throw new ArgumentOutOfRangeException(nameof(outputMode), outputMode, null); } }
public string GetJobResults(SplunkDataQuery job, OutputMode mode) { string path = string.Format("{0}/{1}/{2}", "/services/search/jobs", job.RemoteId, "results"); ServerRequest request = new ServerRequest(path, ServerRequest.HttpMethod.GET); //Set count to 0 to get all rows request.Args.Add(new KeyValuePair <string, string>("count", "0")); request.Args.Add(new KeyValuePair <string, string>("output_mode", mode.ToString())); ServerResponse response = this.Send(request); if (response.Status == 204) { return(null); } else { return(response.Content); } }
/** * Starts archiving an OpenTok session. * * <p> * Clients must be actively connected to the OpenTok session for you to successfully start * recording an archive. * <p> * You can only record one archive at a time for a given session. You can only record * archives of sessions that uses the OpenTok Media Router (sessions with the media mode set * to routed); you cannot archive sessions with the media mode set to relayed. * <p> * Note that you can have the session be automatically archived by setting the archiveMode * parameter of the OpenTok.CreateSession() method to ArchiveMode.ALWAYS. * * @param sessionId The session ID of the OpenTok session to archive. * * @param name The name of the archive. You can use this name to identify the archive. It is * a property of the Archive object, and it is a property of archive-related events in the * OpenTok client libraries. * * @param hasVideo Whether the archive will record video (true) or not (false). The default * value is true (video is recorded). If you set both <code>hasAudio</code> and * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method * results in an error. * * @param hasAudio Whether the archive will record audio (true) or not (false). The default * value is true (audio is recorded). If you set both <code>hasAudio</code> and * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method * results in an error. * * @param outputMode Whether all streams in the archive are recorded to a single file * (<code>OutputMode.COMPOSED</code>, the default) or to individual files * (<code>OutputMode.INDIVIDUAL</code>). * * @return The Archive object. This object includes properties defining the archive, * including the archive ID. */ public Archive StartArchive(string sessionId, string name = "", bool hasVideo = true, bool hasAudio = true, OutputMode outputMode = OutputMode.COMPOSED) { if (String.IsNullOrEmpty(sessionId)) { throw new OpenTokArgumentException("Session not valid"); } string url = string.Format("v2/partner/{0}/archive", this.ApiKey); var headers = new Dictionary<string, string> { { "Content-type", "application/json" } }; var data = new Dictionary<string, object>() { { "sessionId", sessionId }, { "name", name }, { "hasVideo", hasVideo }, { "hasAudio", hasAudio }, { "outputMode", outputMode.ToString().ToLower() } }; string response = Client.Post(url, headers, data); return OpenTokUtils.GenerateArchive(response, ApiKey, ApiSecret, OpenTokServer); }
/** * Starts archiving an OpenTok session. * * <p> * Clients must be actively connected to the OpenTok session for you to successfully start * recording an archive. * <p> * You can only record one archive at a time for a given session. You can only record * archives of sessions that uses the OpenTok Media Router (sessions with the media mode set * to routed); you cannot archive sessions with the media mode set to relayed. * <p> * Note that you can have the session be automatically archived by setting the archiveMode * parameter of the OpenTok.CreateSession() method to ArchiveMode.ALWAYS. * * @param sessionId The session ID of the OpenTok session to archive. * * @param name The name of the archive. You can use this name to identify the archive. It is * a property of the Archive object, and it is a property of archive-related events in the * OpenTok client libraries. * * @param hasVideo Whether the archive will record video (true) or not (false). The default * value is true (video is recorded). If you set both <code>hasAudio</code> and * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method * results in an error. * * @param hasAudio Whether the archive will record audio (true) or not (false). The default * value is true (audio is recorded). If you set both <code>hasAudio</code> and * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method * results in an error. * * @param outputMode Whether all streams in the archive are recorded to a single file * (<code>OutputMode.COMPOSED</code>, the default) or to individual files * (<code>OutputMode.INDIVIDUAL</code>). * * @param resolution The resolution for the archive. The default for <code>OutputMode.COMPOSED</code> * is "640x480". You cannot specify the resolution for <code>OutputMode.INDIVIDUAL</code>. * * @return The Archive object. This object includes properties defining the archive, * including the archive ID. */ public Archive StartArchive(string sessionId, string name = "", bool hasVideo = true, bool hasAudio = true, OutputMode outputMode = OutputMode.COMPOSED, string resolution = null) { if (String.IsNullOrEmpty(sessionId)) { throw new OpenTokArgumentException("Session not valid"); } string url = string.Format("v2/project/{0}/archive", this.ApiKey); var headers = new Dictionary <string, string> { { "Content-type", "application/json" } }; var data = new Dictionary <string, object>() { { "sessionId", sessionId }, { "name", name }, { "hasVideo", hasVideo }, { "hasAudio", hasAudio }, { "outputMode", outputMode.ToString().ToLowerInvariant() } }; if (!String.IsNullOrEmpty(resolution) && outputMode.Equals(OutputMode.INDIVIDUAL)) { throw new OpenTokArgumentException("Resolution can't be specified for Individual Archives"); } else if (!String.IsNullOrEmpty(resolution) && outputMode.Equals(OutputMode.COMPOSED)) { data.Add("resolution", resolution); } string response = Client.Post(url, headers, data); return(OpenTokUtils.GenerateArchive(response, ApiKey, ApiSecret, OpenTokServer)); }
/** * Starts archiving an OpenTok session. * * <p> * Clients must be actively connected to the OpenTok session for you to successfully start * recording an archive. * <p> * You can only record one archive at a time for a given session. You can only record * archives of sessions that uses the OpenTok Media Router (sessions with the media mode set * to routed); you cannot archive sessions with the media mode set to relayed. * <p> * Note that you can have the session be automatically archived by setting the archiveMode * parameter of the OpenTok.CreateSession() method to ArchiveMode.ALWAYS. * * @param sessionId The session ID of the OpenTok session to archive. * * @param name The name of the archive. You can use this name to identify the archive. It is * a property of the Archive object, and it is a property of archive-related events in the * OpenTok client libraries. * * @param hasVideo Whether the archive will record video (true) or not (false). The default * value is true (video is recorded). If you set both <code>hasAudio</code> and * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method * results in an error. * * @param hasAudio Whether the archive will record audio (true) or not (false). The default * value is true (audio is recorded). If you set both <code>hasAudio</code> and * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method * results in an error. * * @param outputMode Whether all streams in the archive are recorded to a single file * (<code>OutputMode.COMPOSED</code>, the default) or to individual files * (<code>OutputMode.INDIVIDUAL</code>). * * @return The Archive object. This object includes properties defining the archive, * including the archive ID. */ public Archive StartArchive(string sessionId, string name = "", bool hasVideo = true, bool hasAudio = true, OutputMode outputMode = OutputMode.COMPOSED) { if (String.IsNullOrEmpty(sessionId)) { throw new OpenTokArgumentException("Session not valid"); } string url = string.Format("v2/partner/{0}/archive", this.ApiKey); var headers = new Dictionary <string, string> { { "Content-type", "application/json" } }; var data = new Dictionary <string, object>() { { "sessionId", sessionId }, { "name", name }, { "hasVideo", hasVideo }, { "hasAudio", hasAudio }, { "outputMode", outputMode.ToString().ToLower() } }; string response = Client.Post(url, headers, data); return(OpenTokUtils.GenerateArchive(response, ApiKey, ApiSecret, OpenTokServer)); }
/// <summary> /// Specifies how data of a streaming DataFrame is written to a streaming sink. /// </summary> /// <param name="outputMode">Output mode enum</param> /// <returns>This DataStreamWriter object</returns> public DataStreamWriter OutputMode(OutputMode outputMode) => OutputMode(outputMode.ToString());
/// <summary> /// Get XML Stats Data /// </summary> public string GetStats(int id, OutputMode mode=OutputMode.XML) { Dictionary<string, string> Params = new Dictionary<string, string>(); Params.Add ("action", "get_stats"); Params.Add ("plan", this.plan); Params.Add ("user", this.user); Params.Add ("pass", this.pass); Params.Add ("mode", mode.ToString().ToLower()); //XML or JSON Params.Add ("eid", id.ToString()); string bruto= GetResponse(this.urlBase, Params, this.apiMethod); if (bruto.Substring (0, 2) == "KO") { throw new TeenvioException (bruto); } return GetResponse(this.urlBase, Params, this.apiMethod); }