Ejemplo n.º 1
0
        public override string ToString()
        {
            var result = new StringBuilder();

            TfsHelpers.AppendUrl(result, "api-version", apiVersion);
            TfsHelpers.AppendUrl(result, "searchCriteria.toId", searchCriteriatoId.ToString());
            TfsHelpers.AppendUrl(result, "searchCriteria.fromId", searchCriteriafromId.ToString());

            // if (searchCriteriaAuthor != null)
            //{
            TfsHelpers.AppendUrl(result, "searchCriteria.author", searchCriteriaAuthor);
            //}

            if (searchCriteriaFromDate != null)
            {
                TfsHelpers.AppendUrl(result, "searchCriteria.fromDate", WebUtility.UrlEncode(TfsHelpers.FormatDateForSonarIso8601(searchCriteriaFromDate.Value)));
            }

            if (searchCriteriaToDate != null)
            {
                TfsHelpers.AppendUrl(result, "searchCriteria.toDate", WebUtility.UrlEncode(TfsHelpers.FormatDateForSonarIso8601(searchCriteriaToDate.Value)));
            }

            TfsHelpers.AppendUrl(result, "$top", top.ToString());
            TfsHelpers.AppendUrl(result, "$skip", skip.ToString());

            return(result.Length > 0 ? "?" + result : string.Empty);
        }
        public override string ToString()
        {
            var result = new StringBuilder();

            TfsHelpers.AppendUrl(result, "api-version", apiVersion);
            return(result.Length > 0 ? "?" + result : string.Empty);
        }
        private void ReadSolutionInfo()
        {
            SolutionState state          = SolutionState.NoSolution;
            string        workspaceName  = string.Empty;
            string        branchLocation = string.Empty;
            string        solutionFile   = string.Empty;
            string        errorMessage   = string.Empty;

            Solution4 sol = (Solution4)_dte2.Solution;

            try
            {
                if (sol.IsOpen == false)
                {
                    state = SolutionState.NoSolution;
                    _trace.TraceEvent(TraceEventType.Verbose, 0, "No Solution Opened");
                }
                else
                {
                    solutionFile = sol.FileName;

                    _trace.TraceEvent(TraceEventType.Information, 0, "Opened Solution: {0}", sol.FullName);

                    if (_vcExt == null)
                    {
                        _trace.TraceEvent(TraceEventType.Information, 0, "No TFS object");
                        state = SolutionState.TfsNotPresent;
                    }
                    else if (_vcExt.SolutionWorkspace == null)
                    {
                        _trace.TraceEvent(TraceEventType.Information, 0, "No TFS Workspace for this Solution ");
                        state = SolutionState.NotInTfs;
                    }
                    else
                    {
                        VersionControlServer vcServer = _vcExt.SolutionWorkspace.VersionControlServer;
                        _trace.TraceEvent(TraceEventType.Verbose, 0, "Connected to TFS Collection: {0}", vcServer.TeamProjectCollection.Name);

                        // find out where the TFS info is.
                        string serverSol = _vcExt.SolutionWorkspace.GetServerItemForLocalItem(sol.FullName);
                        if (string.IsNullOrEmpty(serverSol) == true)
                        {
                            _trace.TraceEvent(TraceEventType.Warning, 0, "Solution file is NOT in TFS");
                            state = SolutionState.NotInTfs;
                        }
                        else
                        {
                            workspaceName  = _vcExt.SolutionWorkspace.Name;
                            branchLocation = TfsHelpers.GetBranchLocationForItem(vcServer, serverSol);
                            _trace.TraceEvent(TraceEventType.Information, 0, "Solution is in Branch: {0}", branchLocation);
                            state = SolutionState.InTfs;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                state = SolutionState.Error;
                _infoService.CurrentSolutionInfo = new TfsInfo(ex);
            }

            if (state != SolutionState.Error)
            {
                _infoService.CurrentSolutionInfo = new TfsInfo(state, solutionFile, branchLocation, workspaceName);
            }
        }