コード例 #1
0
        public void LogParameters()
        {
            if (!Cmdlet.IsVerbose)
            {
                return;
            }

            var parms = new ParameterDictionary(Cmdlet);

            if (parms.ContainsKey("Password") && parms["Password"] != null)
            {
                parms["Password"] = "******";
            }

            Log($"Running cmdlet with parameter set '{parms.Get<string>("ParameterSetName")}' and the following arguments:");

            Log(JObject.FromObject(parms)
                .ToString(Formatting.None)
                .Replace("\":", "\" = ")
                .Replace(",\"", "; \"")
                .Trim('{', '}')
                );
        }
コード例 #2
0
        public (Models.Connection, WebApiTeamProject, WebApiTeam) GetCollectionProjectAndTeam(CmdletBase cmdlet, ParameterDictionary parameters = null)
        {
            var parms = new ParameterDictionary(cmdlet, parameters);

            if (parms.Get <object>("Team") is WebApiTeam t)
            {
                parms["Project"] = t.ProjectId;
            }

            var(tpc, tp) = GetCollectionAndProject(cmdlet, parms);

            parms["Collection"] = tpc;
            parms["Project"]    = tp;

            var team = GetDataService <Models.Team>(cmdlet, parms).GetItem();

            if (team == null)
            {
                throw new ArgumentException("No TFS team information available. Either supply a valid -Team argument or use Connect-TfsTeam prior to invoking this cmdlet.");
            }

            return(tpc, tp, team);
        }