protected override void Execute(CodeActivityContext context) { // Get the various inputs var text = Text.Get(context); var apiKey = ApiKey.Get(context); var bundleId = BundleId.Get(context); string tags = JsonConvert.SerializeObject(Tags.Get(context)); // Build the item json var jsonValues = new Dictionary <string, dynamic>() { { "text", text }, { "bundle_id", bundleId } }; // If there are tags to be assigned, add this key/value to the json if (tags.Length > 0) { jsonValues["tags"] = tags; } ; // Serialize the json string json = JsonConvert.SerializeObject(jsonValues); // Build URL content (e.g. api_key etc.) and encode it correctly // classify = true requires Ingenia to return the classification results in real time. var urlContent = new Dictionary <string, string> { { "api_key", apiKey }, { "classify", "true" }, { "json", json } }; var content = new FormUrlEncodedContent(urlContent); // Post to Ingenia Items URL to do item#create try { using (var client = new HttpClient()) { var response = client.PostAsync("https://ingeniapi.com/v2/items", content).Result; if (response.IsSuccessStatusCode) { var responseContent = response.Content; string responseString = responseContent.ReadAsStringAsync().Result; // // This output currently assigns OutArgument IngeniaResponse. // IngeniaResponse.Set(context, responseString); } } } catch (Exception ex) { throw; } }
/// <summary> /// <see cref="ExceptionFilterAttribute.OnException(ExceptionContext)" /> /// </summary> public override void OnException(ExceptionContext context) { /* Récupération de la configuration */ ApplicationConfiguration configuration = (context .HttpContext .RequestServices .GetService(typeof(IOptions <ApplicationConfiguration>)) as IOptions <ApplicationConfiguration>) .Value; /* Récupération du gestionnaire de logs */ ILogger <ManageException> logger = (context .HttpContext .RequestServices .GetService(typeof(ILoggerFactory)) as ILoggerFactory) .CreateLogger <ManageException>(); /* Affectation du code de réponse */ context.HttpContext.Response.StatusCode = context.Exception is AuthenticationException ? 403 : 500; /* Ecriture dans les logs */ logger.LogError(context.Exception, "The following error has been catched by the MVC error handler"); /* Récupération du lot approprié */ BundleId id = (context.Exception as ApiException)?.Display ?? BundleId.ERROR_UNKNOW; BundleDTO bundle = configuration.Bundles[id]; /* Ecriture de la réponse */ context.Result = new JsonResult(new ErrorDTO() { Code = context.HttpContext.Response.StatusCode, Message = bundle }); base.OnException(context); }
public static string GetBundleID(DirectoryReference ProjectDirectory, FileReference ProjectFile) { ConfigHierarchy Ini = GetIni(ProjectDirectory); string BundleId; Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleIdentifier", out BundleId); BundleId = BundleId.Replace("[PROJECT_NAME]", ((ProjectFile != null) ? ProjectFile.GetFileNameWithoutAnyExtensions() : "UE4Game")).Replace("_", ""); return(BundleId); }
public void ToString(StringBuilder builder) { builder.Append(ReceiptRecordTypes.FileDetailRecord); builder.Append(FileRejectReasonCategory.PadRight(57)); builder.Append(Addendums.Count.ToString("D5")); builder.Append(CashLetterId.PadRight(8)); builder.Append(BundleId.PadRight(10)); builder.AppendLine(); Addendums.ForEach(a => a.ToString(builder)); }
public void ToString(StringBuilder builder) { builder.Append(ItemRecordTypes.ItemDetailRecord); builder.Append(ItemSequenceNumber.PadRight(15)); builder.Append(BundleId.PadRight(10)); builder.Append(Amount.ToString("D10")); builder.Append(ItemErrorReason.PadRight(30)); builder.Append(ReportedOverallIqaScore.ToString("D3")); builder.Append(Addendums.Count.ToString("D3")); builder.Append(Reserved.PadRight(7)); builder.AppendLine(); }
protected override void GetContentFromMessage(List <byte> payload) { AppManagerAction messageType = (AppManagerAction)payload[0]; byte[] data = payload.ToArray(); //Get the app/watch guid byte[] AppGuid = new byte[16]; for (int i = 0; i < 16; i++) { AppGuid[i] = payload[i + 1]; } App = new Guid(AppGuid); //Get the bundle id BundleId.Add(payload[17]); BundleId.Add(payload[18]); BundleId.Add(payload[19]); BundleId.Add(payload[20]); }
public override int GetHashCode() { return((BundleId?.GetHashCode() * 17 + DumpId?.GetHashCode()).GetValueOrDefault()); }