private IXCResponse <T> Call <T>(string endpoint, CallParameters <T> callParameters) { (IXCResponse <T> result, string statusCode, string message) = apiConsumerHelper .AddCustomHeaders("ixcsoft", "listar") .PostAsync <Dictionary <string, string>, IXCResponse <T> >(endpoint, CallParametersToDictionaryConverter.Converter(callParameters)).Result; return(result); }
public List <T> Get <T>(string endpoint, CallParameters <T> callParameters) { var list = new List <T>(); IXCResponse <T> result = Call <T>(endpoint, callParameters); if (result != null && result.registros != null && result.registros.Count() > 0) { list = result.registros; if (int.TryParse(result.total, out int totalRegistros) && totalRegistros > result.registros.Count()) { var i = 2; while (list.Count() < totalRegistros) { if (result != null && result.registros != null && result.registros.Count() > 0) { callParameters.Page = i.ToString(); result = Call <T>(endpoint, callParameters); if (result != null && result.registros != null && result.registros.Count() > 0) { list.AddRange(result.registros); } i++; } } } } return(list); }
private List <Cliente> GetClientes(ClienteStatus status, string filialId = null, string id = null, string cpf_cnpj = null) { var callParameters = new CallParameters <Cliente> { Qtype = x => x.id, Query = "", Operador = Operadores.Diferente, Page = "1", Rp = "400000", GridParams = new List <GridParameter <Cliente> >() }; if (status.Value != ClienteStatus.Todos.Value) { callParameters.GridParams.Add( new GridParameter <Cliente> { Property = x => x.ativo, Operador = Operadores.Igual, Valor = status.Value } ); } if (!string.IsNullOrEmpty(id)) { callParameters.GridParams.Add( new GridParameter <Cliente> { Property = x => x.id, Operador = Operadores.Igual, Valor = id } ); } if (!string.IsNullOrEmpty(cpf_cnpj)) { callParameters.GridParams.Add( new GridParameter <Cliente> { Property = x => x.cnpj_cpf, Operador = Operadores.Igual, Valor = cpf_cnpj } ); } if (!string.IsNullOrEmpty(filialId)) { callParameters.GridParams.Add( new GridParameter <Cliente> { Property = x => x.filial_id, Operador = Operadores.Igual, Valor = filialId } ); } var clientes = Get <Cliente>("/cliente", callParameters); return(clientes); }
public void DeleteMessageBatchAsync(SQSDeleteMessageBatchRequest request, ServiceCallback <SQSDeleteMessageBatchRequest, SQSDeleteMessageBatchResponse> callback) { string requestJson = JsonConvert.SerializeObject(request); _CallParameters[_CallId] = new CallParameters { Request = request, Callback = callback }; SQS_DeleteMessageBatchAsync(_nativeId, requestJson, DeleteMessageBatchCallback, _CallId++); }
public Task<ResultParameters> Invoke(CallParameters call) { return _next(call).Then(result => { if (!result.Headers.HasHeader("Content-Type")) { result.Headers.SetHeader("Content-Type", _contentType); } return result; }); }
public void DoWithParamsAndReturn(int p, MockServiceDataContract obj, OfflineBehavior behavior) { Request r = new Request(); r.MethodName = "DoWithParamsAndReturn"; r.Endpoint = "MockService"; r.OnlineProxyType = typeof(MockService); r.CallParameters = CallParameters.ToArray(p, obj); r.Behavior = behavior; requestQueue.Enqueue(r); }
private static void DeleteMessageBatchCallback(int callId, string result, int isError) { CallParameters callParameters = _CallParameters[callId]; _CallParameters.Remove(callId); var request = (SQSDeleteMessageBatchRequest)callParameters.Request; var callback = (ServiceCallback <SQSDeleteMessageBatchRequest, SQSDeleteMessageBatchResponse>)callParameters.Callback; callback(new ServiceResult <SQSDeleteMessageBatchRequest, SQSDeleteMessageBatchResponse>( request, isError == 1 ? null : JsonConvert.DeserializeObject <SQSDeleteMessageBatchResponse>(result), isError == 1 ? new WebGLServiceErrorException(JsonConvert.DeserializeObject <WebGLServiceError>(result, _ErrorSerializerSettings)) : null )); }
public static Dictionary <string, string> Converter <T>(CallParameters <T> callParameters) { var param = new Dictionary <string, string> { ["qtype"] = GetPropertyName <T>(callParameters.Qtype), ["query"] = callParameters.Query, ["oper"] = callParameters.Operador.Value, ["page"] = callParameters.Page, ["rp"] = callParameters.Rp, ["sortname"] = GetPropertyName <T>(callParameters.SortName), ["sortorder"] = callParameters.SortOrder?.Value, ["grid_param"] = JsonConvert.SerializeObject(GridParamsConverter <T>(callParameters.GridParams)) }; return(param); }
private DatagramMessage <T> NewDatagram <T>(T message, Action <ICallParameters> p) { var callParameters = new CallParameters(); p?.Invoke(callParameters); return(new DatagramMessage <T>() { RequestId = callParameters.RequestId ?? Guid.NewGuid(), Message = message, ConversationId = callParameters.ConversationId, PublishTimestamp = DateTime.UtcNow, SourceHost = _sourceHost, SourceService = _sourceService }); }
private List <Contrato> GetContratos(ContratoStatus status, string filialId = null, string id = null) { var callParameters = new CallParameters <Contrato> { Qtype = x => x.id, Query = "", Operador = Operadores.Diferente, Page = "1", Rp = "400000", GridParams = new List <GridParameter <Contrato> >() }; if (!string.IsNullOrEmpty(id)) { callParameters.GridParams.Add( new GridParameter <Contrato> { Property = x => x.id, Operador = Operadores.Igual, Valor = id } ); } if (status.Value != ContratoStatus.Todos.Value) { callParameters.GridParams.Add( new GridParameter <Contrato> { Property = x => x.status, Operador = Operadores.Igual, Valor = status.Value } ); } if (!string.IsNullOrEmpty(filialId)) { callParameters.GridParams.Add( new GridParameter <Contrato> { Property = x => x.id_filial, Operador = Operadores.Igual, Valor = filialId } ); } var contratos = Get <Contrato>("/cliente_contrato", callParameters); return(contratos); }
public void CanEnqueueRequestsWithNullParameters() { string tableName = "Requests"; using (SmartClientDatabase database = GetDatabase()) { Assert.IsFalse(database.TableExists(tableName)); IRequestQueue queue = new DatabaseRequestQueue(database, tableName); Request req = CreateRequest(); req.CallParameters = CallParameters.ToArray("Test", null, 123, null); // Throws Exception queue.Enqueue(req); Request result = queue.GetNextRequest(); Assert.IsTrue(AreEqual(req, result)); } }
private Request CreateRequest() { Request request = new Request(); request.Endpoint = "Endpoint"; request.MethodName = "Method"; request.OnlineProxyType = typeof(MemoryRequestQueueFixture); //request.RequestId = Guid.NewGuid(); request.Behavior = new OfflineBehavior(); request.Behavior.ExceptionCallback = new CommandCallback(GetType(), "Exception"); request.Behavior.ReturnCallback = new CommandCallback(GetType(), "Return"); request.Behavior.ProxyFactoryType = typeof(Object); request.Behavior.Stamps = 5; request.Behavior.Tag = "MockRequest"; request.Behavior.MaxRetries = 0; request.Behavior.Expiration = null; request.Behavior.MessageId = Guid.NewGuid(); request.CallParameters = CallParameters.ToArray(1, 2, "Charly", new MockParamClass(7, "seven"), 7.5, new MockParamClass(2, "Two")); return(request); }
public bool Post(CallParameters callParameters) { log.Debug("Request to call. Caller:{0}, Callee:{1}, Profile:{2}", callParameters.Caller, callParameters.Callee, callParameters.Profile); var callerEmail = new SipUri(callParameters.Caller); string callee = callParameters.Callee; // Kan vara telefonnr (som saknar domän) eller sip-adress. if (!callee.IsNumeric()) { // Sip-adress. Tolka. callee = new SipUri(callee).UserAtHost; } var codecInformation = GetCodecInformationBySipAddress(callerEmail.UserAtHost); if (codecInformation == null) { return(false); } return(_codecManager.Call(codecInformation, callee, callParameters.Profile)); }
public bool CallFromCar([FromBody] CallParameters FloorRequest) { return(Elevator.car.RequestServiceToFloor(FloorRequest.Floor)); }
public List <Titulo> GetTitulos(TituloStatus status, TituloLiberado liberado, DateTime initDate = default, DateTime finalDate = default, string filialId = null) { var callParameters = new CallParameters <Titulo> { Qtype = x => x.id_cliente, Query = "", Operador = Operadores.Diferente, Page = "1", Rp = "100000", SortName = x => x.data_vencimento, SortOrder = SortOrder.Ascendente, GridParams = new List <GridParameter <Titulo> >() }; if (status.Value != TituloStatus.Todos.Value) { callParameters.GridParams.Add( new GridParameter <Titulo> { Property = x => x.status, Operador = Operadores.Igual, Valor = status.Value } ); } if (liberado.Value != TituloLiberado.Todos.Value && status.Value != TituloStatus.Pago.Value) { callParameters.GridParams.Add( new GridParameter <Titulo> { Property = x => x.liberado, Operador = Operadores.Igual, Valor = liberado.Value } ); } if (!string.IsNullOrEmpty(filialId)) { callParameters.GridParams.Add( new GridParameter <Titulo> { Property = x => x.filial_id, Operador = Operadores.Igual, Valor = filialId } ); } Expression <Func <Titulo, IComparable> > dateParam = x => x.data_vencimento; if (status.Value == TituloStatus.Pago.Value) { dateParam = x => x.pagamento_data; } if (initDate != default) { callParameters.GridParams.Add( new GridParameter <Titulo> { Property = dateParam, Operador = Operadores.MaiorIgaul, Valor = initDate.ToString("yyyyy-MM-dd") } ); } if (finalDate != default) { callParameters.GridParams.Add( new GridParameter <Titulo> { Property = dateParam, Operador = Operadores.MenorIgual, Valor = finalDate.ToString("yyyyy-MM-dd") } ); } var titulos = Get <Titulo>("/fn_areceber", callParameters); return(titulos); }
public static int SetUpPlugin( CallParameters parameters, System.Threading.CancellationToken cancellationToken ) { var cancellationTaskSource = new CancellationTokenSource(); Task.Run(() => { cancellationToken.WaitHandle.WaitOne(); form.Close(); }, cancellationTaskSource.Token); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string pluginPath = parameters.VstPluginPath; var hostCmdStub = new HostCommandStub(); var ctx = VstPluginContext.Create(pluginPath, hostCmdStub); ctx.PluginCommandStub.Open(); // add custom data to the context ctx.Set("PluginPath", pluginPath); ctx.Set("HostCmdStub", hostCmdStub); ctx.PluginCommandStub.MainsChanged(true); form = new InvisibleForm(ctx); Application.Run(form); ctx.PluginCommandStub.MainsChanged(false); if (cancellationToken.IsCancellationRequested) { // Был затребован выход из программы ctx.PluginCommandStub.Close(); cancellationTaskSource.Cancel(); return(ReturnCodeOffset + 1); } byte[] vstSaveState = null; float[] vstParameters = null; if (!parameters.FxbFileAsParams) { vstSaveState = ctx.PluginCommandStub.GetChunk(true); } else { var vstParametersList = new List <float>(); var paramCount = ctx.PluginInfo.ParameterCount; for (int i = 0; i < paramCount; i++) { vstParametersList.Add(ctx.PluginCommandStub.GetParameter(i)); } vstParameters = vstParametersList.ToArray(); } // VST навм больше не нужен, закрываем ctx.PluginCommandStub.Close(); if (cancellationToken.IsCancellationRequested) { // Был затребован выход из программы cancellationTaskSource.Cancel(); return(ReturnCodeOffset + 1); } int result; switch (parameters.FxbFileFormat.ToLowerInvariant()) { case "fxb": result = SaveStateAsFxb(parameters.FxbFile, vstSaveState, vstParameters, !parameters.FxbFileAsParams, (uint)ctx.PluginInfo.PluginID, (uint)ctx.PluginInfo.PluginVersion); break; case "fxp": result = SaveStateAsFxp(parameters.FxbFile, vstSaveState, vstParameters, !parameters.FxbFileAsParams, (uint)ctx.PluginInfo.PluginID, (uint)ctx.PluginInfo.PluginVersion); break; default: Console.Error.WriteLine("Save state format {0} does not supported", parameters.FxbFileFormat); cancellationTaskSource.Cancel(); return(ReturnCodeOffset + 2); } Console.WriteLine( "VST plugin settings saved to {0} (file format {1}; file subformat: {2})", parameters.FxbFile, parameters.FxbFileFormat, (parameters.FxbFileFormat.ToLowerInvariant() == "fxb") ? "bank param with " + (parameters.FxbFileAsParams ? "preset param" : "preset opaque") : (parameters.FxbFileAsParams ? "preset param" : "preset opaque") ); cancellationTaskSource.Cancel(); return((result > 0) ? ReturnCodeOffset + result : 0); }
public static int ProcessWaveFile( CallParameters parameters, System.Threading.CancellationToken cancellationToken ) { string pluginPath = parameters.VstPluginPath; if (!System.IO.File.Exists(parameters.FxbFile)) { Console.Error.WriteLine("Can not find Bank/Preset file {0}", parameters.FxbFile); return(ReturnCodeOffset + 0); } if (!System.IO.File.Exists(pluginPath)) { Console.Error.WriteLine("Can not find VST-plugin file {0}", pluginPath); return(ReturnCodeOffset + 1); } if (parameters.InputWavFile == null) { Console.Error.WriteLine("InputWavFile param is missing"); return(ReturnCodeOffset + 2); } if (!System.IO.File.Exists(parameters.InputWavFile)) { Console.Error.WriteLine("Can not find wave file {0}", parameters.InputWavFile); return(ReturnCodeOffset + 3); } if (parameters.OutputWavFile == null) { Console.Error.WriteLine("OutputWavFile param is missing"); return(ReturnCodeOffset + 4); } var hostCmdStub = new HostCommandStub(); var vstPlugin = VstPluginContext.Create(pluginPath, hostCmdStub); vstPlugin.PluginCommandStub.Open(); // add custom data to the context vstPlugin.Set("PluginPath", pluginPath); vstPlugin.Set("HostCmdStub", hostCmdStub); #region Draw VST Plugin Information // plugin product Console.WriteLine("{0,-20}\t{1}", "Plugin Name", vstPlugin.PluginCommandStub.GetEffectName()); Console.WriteLine("{0,-20}\t{1}", "Product", vstPlugin.PluginCommandStub.GetProductString()); Console.WriteLine("{0,-20}\t{1}", "Vendor", vstPlugin.PluginCommandStub.GetVendorString()); Console.WriteLine("{0,-20}\t{1}", "Vendor Version", vstPlugin.PluginCommandStub.GetVendorVersion().ToString()); Console.WriteLine("{0,-20}\t{1}", "Vst Support", vstPlugin.PluginCommandStub.GetVstVersion().ToString()); Console.WriteLine("{0,-20}\t{1}", "Plugin Category", vstPlugin.PluginCommandStub.GetCategory().ToString()); // plugin info Console.WriteLine("{0,-20}\t{1}", "Flags", vstPlugin.PluginInfo.Flags.ToString()); Console.WriteLine("{0,-20}\t{1}", "Plugin ID", vstPlugin.PluginInfo.PluginID.ToString()); Console.WriteLine("{0,-20}\t{1}", "Plugin Version", vstPlugin.PluginInfo.PluginVersion.ToString()); #endregion { var t = vstPlugin.PluginCommandStub.CanDo(VstCanDoHelper.ToString(VstPluginCanDo.Offline)); if (t == VstCanDoResult.No) { Console.Error.WriteLine("This VST Plugin does not support offline convertation"); return(ReturnCodeOffset + 6); } if (!vstPlugin.PluginInfo.Flags.HasFlag(VstPluginFlags.CanReplacing) && !vstPlugin.PluginInfo.Flags.HasFlag(VstPluginFlags.CanDoubleReplacing)) { Console.Error.WriteLine("This VST Plugin does not replacing samples"); return(ReturnCodeOffset + 7); } } vstPlugin.PluginCommandStub.MainsChanged(true); int result = FxbReader.ReadFileIntoPluginStub( parameters.FxbFile, (uint)vstPlugin.PluginInfo.PluginID, (uint)vstPlugin.PluginInfo.PluginVersion, parameters.IgnorePluginVersion, vstPlugin.PluginCommandStub ); vstPlugin.PluginCommandStub.MainsChanged(false); if (result != 0) { vstPlugin.PluginCommandStub.Close(); return(result); } if (cancellationToken.IsCancellationRequested) { // Был затребован выход из программы vstPlugin.PluginCommandStub.Close(); return(ReturnCodeOffset + 5); } result = ProcessFile(parameters.InputWavFile, parameters.OutputWavFile, vstPlugin, cancellationToken); vstPlugin.PluginCommandStub.Close(); return(result); }
public GrpcAsyncCallSpecimenBuilder(CallParameters callParameters) { _callParameters = callParameters ?? throw new ArgumentNullException(nameof(callParameters)); }
public bool CallFromFloor([FromBody] CallParameters FloorRequest) { return(Elevator.car.RequestServiceFromFloor(FloorRequest.Floor, FloorRequest.Direction)); }
/// <summary> /// creates a new <see cref="CallNode"/> /// </summary> /// <param name="nodeid">id of workflow node</param> /// <param name="nodeName">name of node</param> /// <param name="parameters">parameters for method call</param> /// <param name="compiler">parser for script code</param> public CallNode(Guid nodeid, string nodeName, CallParameters parameters, IScriptCompiler compiler) : base(nodeid, nodeName, compiler) { Parameters = parameters; }