コード例 #1
0
 /// <summary>
 /// clear specific key
 /// </summary>
 /// <param name="key"></param>
 /// <param name="onPublic"></param>
 /// <param name="onPrivate"></param>
 public void ClearKey(string key, bool onPublic = true, bool onPrivate = true)
 {
     if (onPublic && PublicArguments?.ContainsKey(key) == true)
     {
         PublicArguments.Remove(key);
     }
     if (onPrivate && PrivateArguments?.ContainsKey(key) == true)
     {
         PrivateArguments.Remove(key);
     }
 }
コード例 #2
0
        /// <summary>
        /// expand "output" in public arguments
        /// </summary>
        /// <returns></returns>
        public WorkingArguments ExpandOutputs()
        {
            // process output
            var outputKeys = PublicArguments.Where(x => "output".Equals(x.Key, StringComparison.CurrentCultureIgnoreCase))?.Select(x => x.Key)?.ToList();

            if (outputKeys?.Any() == true)
            {
                foreach (var outputKey in outputKeys)
                {
                    if (PublicArguments.Remove(outputKey, out string outputValue))
                    {
                        var output = JsonConvert.DeserializeObject <Dictionary <string, string> >(outputValue);
                        foreach (var kvp in output)
                        {
                            PublicArguments[kvp.Key] = kvp.Value;
                        }
                    }
                }
            }

            return(this);
        }