Ejemplo n.º 1
0
        //public static string GetSubstringBetween(string Text, string FirstString, string LastString)
        //{
        //    string STR = Text;
        //    string STRFirst = FirstString;
        //    string STRLast = LastString;
        //    string FinalString;
        //    string TempString;

        //    int Pos1 = STR.IndexOf(FirstString) + FirstString.Length;
        //    int Pos2 = STR.IndexOf(LastString);

        //    FinalString = STR.Substring(Pos1, Pos2 - Pos1);

        //    return FinalString;
        //}

        public static string HideTokenInJson(string inputJson)
        {
            string retJson = "";

            JObject json = JObject.Parse(inputJson);

            try
            {
                if (json["arguments"]["InventorDoc"] != null)
                {
                    json["arguments"]["InventorDoc"]["Headers"]["Authorization"] = "***";
                }

                if (json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputIpt()] != null)
                {
                    json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputIpt()]["Headers"]["Authorization"] = "***";
                }

                if (json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputIam()] != null)
                {
                    json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputIam()]["Headers"]["Authorization"] = "***";
                }

                if (json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputDwg()] != null)
                {
                    json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputDwg()]["Headers"]["Authorization"] = "***";
                }

                if (json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputZip()] != null)
                {
                    json["arguments"][ConfigUtilities.GetDAWorkItemParamsOutputZip()]["Headers"]["Authorization"] = "***";
                }

                retJson = json.ToString();
            }
            catch
            {
                retJson = inputJson;
            }

            return(retJson);
        }