private static object Union(CommonPowerShellData thisCommon, CommonPowerShellData thatCommon) { if (thatCommon == null) { return(thisCommon); } if (thisCommon == null) { return(thatCommon.Clone()); } thisCommon.ParameterAliases = StringDictionaryUnion(thisCommon.ParameterAliases, thatCommon.ParameterAliases); thisCommon.Parameters = StringDictionaryUnion(thisCommon.Parameters, thatCommon.Parameters, Union); return(thisCommon); }
private void ValidateCommonData(CommonPowerShellData commonData) { if (commonData == null) { _errAcc.AddError("CommonData is null"); return; } if (commonData.Parameters == null) { _errAcc.AddError("CommonData.Parameters is null"); } else { foreach (string commonParameter in s_commonParameters) { if (!commonData.Parameters.TryGetValue(commonParameter, out ParameterData parameter)) { _errAcc.AddError($"Common parameter {commonParameter} is not present"); } else if (parameter == null) { _errAcc.AddError($"Common parameter {commonParameter} present but null"); } } } if (commonData.ParameterAliases == null) { _errAcc.AddError("CommonData.ParameterAliases is null"); } else { foreach (string commonParameterAlias in s_commonParameterAliases) { if (!commonData.ParameterAliases.TryGetValue(commonParameterAlias, out ParameterData parameter)) { _errAcc.AddError($"Common parameter alias {commonParameterAlias} not present"); } else if (parameter == null) { _errAcc.AddError($"Common parameter alias {commonParameterAlias} present but null"); } } } }