summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth/Messaging/MessagingUtilities.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-09-02 08:23:29 -0700
committerAndrew <andrewarnott@gmail.com>2008-09-02 08:23:29 -0700
commit202448b1fd4d0c15d009b2c0a6713c8fc41f8854 (patch)
treebd320e8214ab81593c282e24fc8192abf019fdfc /src/DotNetOAuth/Messaging/MessagingUtilities.cs
parent5fc9c66e00bfe654450afd909aca8510e780fb1a (diff)
downloadDotNetOpenAuth-202448b1fd4d0c15d009b2c0a6713c8fc41f8854.zip
DotNetOpenAuth-202448b1fd4d0c15d009b2c0a6713c8fc41f8854.tar.gz
DotNetOpenAuth-202448b1fd4d0c15d009b2c0a6713c8fc41f8854.tar.bz2
Refactored Channel class into two classes.
Diffstat (limited to 'src/DotNetOAuth/Messaging/MessagingUtilities.cs')
-rw-r--r--src/DotNetOAuth/Messaging/MessagingUtilities.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/DotNetOAuth/Messaging/MessagingUtilities.cs b/src/DotNetOAuth/Messaging/MessagingUtilities.cs
index 274aba8..c298b2f 100644
--- a/src/DotNetOAuth/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOAuth/Messaging/MessagingUtilities.cs
@@ -72,6 +72,29 @@ namespace DotNetOAuth.Messaging {
}
/// <summary>
+ /// Adds a set of name-value pairs to the end of a given URL
+ /// as part of the querystring piece. Prefixes a ? or &amp; before
+ /// first element as necessary.
+ /// </summary>
+ /// <param name="builder">The UriBuilder to add arguments to.</param>
+ /// <param name="args">
+ /// The arguments to add to the query.
+ /// If null, <paramref name="builder"/> is not changed.
+ /// </param>
+ internal static void AppendQueryArgs(UriBuilder builder, IDictionary<string, string> args) {
+ if (args != null && args.Count > 0) {
+ StringBuilder sb = new StringBuilder(50 + (args.Count * 10));
+ if (!string.IsNullOrEmpty(builder.Query)) {
+ sb.Append(builder.Query.Substring(1));
+ sb.Append('&');
+ }
+ sb.Append(CreateQueryString(args));
+
+ builder.Query = sb.ToString();
+ }
+ }
+
+ /// <summary>
/// Converts a <see cref="NameValueCollection"/> to an IDictionary&lt;string, string&gt;.
/// </summary>
/// <param name="nvc">The NameValueCollection to convert. May be null.</param>