示例#1
0
        public override String ToString()
        {
            if (Protocol.Equals(TcpProtocol))
            {
                if (Resolved != null)
                {
                    return(Resolved.ToString());
                }
            }
            else if (Protocol.Equals(IpcProtocol))
            {
                if (Resolved != null)
                {
                    return(Resolved.ToString());
                }
            }
            else if (Protocol.Equals(PgmProtocol))
            {
                if (Resolved != null)
                {
                    return(Resolved.ToString());
                }
            }

            if (!string.IsNullOrEmpty(Protocol) && !string.IsNullOrEmpty(AddressString))
            {
                return(Protocol + "://" + AddressString);
            }

            return(null); //TODO: REVIEW - Although not explicitly prohibited, returning null from ToString seems sketchy; return string.Empty?
        }
 public override IDictionary <string, string> ToDictionary()
 {
     return(new Dictionary <string, string>
     {
         { MetadataKeys.Name, Name },
         { MetadataKeys.Version, Version },
         { MetadataKeys.Path, Path },
         { MetadataKeys.Type, Type.ToString() },
         { MetadataKeys.IsImplicitlyDefined, IsImplicitlyDefined.ToString() },
         { MetadataKeys.IsTopLevelDependency, IsTopLevelDependency.ToString() },
         { ResolvedMetadata, Resolved.ToString() },
         { DependenciesMetadata, string.Join(";", Dependencies) }
     });
 }
示例#3
0
        public override string ToString()
        {
            if (Resolved != null)
            {
                switch (Protocol)
                {
                case TcpProtocol: return(Resolved.ToString());

                case IpcProtocol: return(Resolved.ToString());

                case PgmProtocol: return(Resolved.ToString());
                }
            }

            if (!string.IsNullOrEmpty(Protocol) && !string.IsNullOrEmpty(AddressString))
            {
                return(Protocol + "://" + AddressString);
            }

            return(base.ToString());
        }
示例#4
0
        public override string ToString()
        {
            var result = new StringBuilder();

            result.Append(SonarPagingQuery.ToString());

            SonarHelpers.AppendUrl(result, "issues", IssuesKeys);
            if (Assigned != null)
            {
                SonarHelpers.AppendUrl(result, "assigned", Assigned.ToString().ToLowerInvariant());
            }
            SonarHelpers.AppendUrl(result, "statuses", Statuses);
            SonarHelpers.AppendUrl(result, "tags", Tags);
            if (CreatedAfter != null)
            {
                SonarHelpers.AppendUrl(result, "createdAfter", WebUtility.UrlEncode(SonarHelpers.FormatDateForSonarIso8601(CreatedAfter.Value)));
                // when scanning for createdAfter, automatically sort by created date
                SonarHelpers.AppendUrl(result, "s", "CREATION_DATE");
                SonarHelpers.AppendUrl(result, "asc", "true");
            }
            if (CreatedAt != null)
            {
                SonarHelpers.AppendUrl(result, "createdAt", WebUtility.UrlEncode(SonarHelpers.FormatDateForSonarIso8601(CreatedAt.Value)));
            }
            if (CreatedBefore != null)
            {
                SonarHelpers.AppendUrl(result, "createdBefore", WebUtility.UrlEncode(SonarHelpers.FormatDateForSonarIso8601(CreatedBefore.Value)));
            }
            SonarHelpers.AppendUrl(result, "additionalFields", AdditionalFields);
            SonarHelpers.AppendUrl(result, "assignees", Assignees);
            SonarHelpers.AppendUrl(result, "authors", Authors);
            SonarHelpers.AppendUrl(result, "componentKeys", ComponentKeys);
            SonarHelpers.AppendUrl(result, "componentUuids", ComponentUuids);
            SonarHelpers.AppendUrl(result, "severities", Severities);
            SonarHelpers.AppendUrl(result, "rules", Rules);
            SonarHelpers.AppendUrl(result, "projectKeys", ProjectKeys);
            SonarHelpers.AppendUrl(result, "resolved", Resolved.ToString().ToLowerInvariant());

            return(result.Length > 0 ? "?" + result : string.Empty);
        }