BetterExplorer.Networks.PastebinClient.Send C# (CSharp) Метод

Send() публичный Метод

Thrown if the Body value is blank. Thrown if Private is set to "2" and the user is not logged in. Thrown if an error occurred while making the paste.
public Send ( string Body, string Subj = "", string Private = "0", string Expire = "N", string Format = "none" ) : Uri
Body string The body of the new paste. (Max size is 512 KB.)
Subj string The title of the paste. Not required.
Private string The privacy setting of the paste. 0 = Public, 1 = Unlisted, 2 = Private. Default is Public. Private is only availabe if a username and password were added. Not required.
Expire string The expiration time for this paste. Valid values are "N" (Never), "10M" (10 minutes), "1H" (1 hour), "1D" (1 day), "1W" (1 week), "2W" (2 weeks), "1M" (1 month). Default is "N". Not required.
Format string The syntax highligting format for this paste. Over 200 values are accepted. See http://pastebin.com/api#5 for more details. Default is "none". Not required.
Результат System.Uri
		public Uri Send(string Body, string Subj = "", string Private = "0", string Expire = "N", string Format = "none")
		{
			if (string.IsNullOrEmpty(Body.Trim())) throw new ArgumentNullException("Body", "Cannot have an empty paste.");

			var IQuery = new NameValueCollection()
			{
				{ "api_dev_key", IDevKey },
				{ "api_option", "paste" },
				{ "api_paste_code", Body }
			};

			//IQuery.Add("api_paste_private", "0");
			if (!string.IsNullOrEmpty(Private.Trim())) IQuery.Add("api_paste_private", Private);

			//IQuery.Add("api_paste_name", Subj);
			if (!string.IsNullOrEmpty(Subj.Trim())) IQuery.Add("api_paste_name", Subj);

			//IQuery.Add("api_paste_expire_date", "N");
			if (!string.IsNullOrEmpty(Expire.Trim())) IQuery.Add("api_paste_expire_date", Expire);

			//IQuery.Add("api_paste_format", Format);
			if (!string.IsNullOrEmpty(Format.Trim())) IQuery.Add("api_paste_format", Format);

			//IQuery.Add("api_user_key", IUserKey);
			if (!string.IsNullOrEmpty(UserKey.Trim()))
			{
				IQuery.Add("api_user_key", UserKey);
			}
			else if (Private == "2")
			{
				throw new ArgumentException("Cannot have a private paste while not logged in.", "Private");

			}

			using (var IClient = new WebClient())
			{
				string IResponse = Encoding.UTF8.GetString(IClient.UploadValues(IPostURL, IQuery));

				Uri isValid = null;
				if (!Uri.TryCreate(IResponse, UriKind.Absolute, out isValid))
				{
					throw new WebException("An error occurred while making the paste.", WebExceptionStatus.SendFailure);
				}

				return isValid;
			}
		}