public FileWithDispositionHttpActionResult(string filePath, string fileName, string mediaType, DispositionType dispositionType) { _fileName = fileName; _mediaType = mediaType; _dispositionType = dispositionType; FilePath = filePath; }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ReferenceNumber != null) { hashCode = hashCode * 59 + ReferenceNumber.GetHashCode(); } if (ItemNumber != null) { hashCode = hashCode * 59 + ItemNumber.GetHashCode(); } if (Quantity != null) { hashCode = hashCode * 59 + Quantity.GetHashCode(); } if (DispositionType != null) { hashCode = hashCode * 59 + DispositionType.GetHashCode(); } if (DispositionInstructions != null) { hashCode = hashCode * 59 + DispositionInstructions.GetHashCode(); } if (Labels != null) { hashCode = hashCode * 59 + Labels.GetHashCode(); } return(hashCode); } }
public FileWithDispositionHttpActionResult(string filePath, string fileName, string mediaType, DispositionType dispositionType) { _fileName = fileName; _mediaType = mediaType; _dispositionType = dispositionType; FilePath = filePath; }
/// <summary>Returns a <see cref="T:System.String" /> representation of this instance.</summary> /// <returns>A <see cref="T:System.String" /> that contains the property values for this instance.</returns> public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DispositionType.ToLower()); if (Parameters != null && Parameters.Count > 0) { bool flag = false; foreach (DictionaryEntry parameter in Parameters) { if (parameter.Value != null && parameter.Value.ToString().Length > 0) { stringBuilder.Append("; "); stringBuilder.Append(parameter.Key); stringBuilder.Append("="); string text = parameter.Key.ToString(); string text2 = parameter.Value.ToString(); flag = (((text == "filename" && text2.IndexOf(' ') != -1) || text.EndsWith("date")) ? true : false); if (flag) { stringBuilder.Append("\""); } stringBuilder.Append(text2); if (flag) { stringBuilder.Append("\""); } } } } return(stringBuilder.ToString()); }
public ActionResult DeleteConfirmed(int id) { DispositionType dispositionType = db.DispositionTypes.Find(id); db.DispositionTypes.Remove(dispositionType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "DispositionTypeID,Name")] DispositionType dispositionType) { if (ModelState.IsValid) { db.Entry(dispositionType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dispositionType)); }
public ActionResult Create([Bind(Include = "DispositionTypeID,Name")] DispositionType dispositionType) { if (ModelState.IsValid) { db.DispositionTypes.Add(dispositionType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dispositionType)); }
public override string ToString() { // the content-disposition header as in RFC 2183 // ex. attachment; filename=genome.jpeg; modification-date="Wed, 12 Feb 1997 16:29:51 -0500"; // the dates must be quoted and in RFC 822 format // // According to RFC 2183, the filename field value follows the definition // given in RFC 1521, which is // // value := token / quoted-string // StringBuilder sb = new StringBuilder(); sb.Append(DispositionType.ToLower()); if (Parameters != null && Parameters.Count > 0) { bool quote = false; string key, value; foreach (var pair in Parameters) { if (pair.Value != null && pair.Value.ToString().Length > 0) { sb.Append("; "); sb.Append(pair.Key); sb.Append("="); key = pair.Key.ToString(); value = pair.Value.ToString(); if ((key == "filename" && value.IndexOf(' ') != -1) || key.EndsWith("date")) { quote = true; } else { quote = false; } if (quote) { sb.Append("\""); } sb.Append(value); if (quote) { sb.Append("\""); } } } } return(sb.ToString()); }
// GET: DispositionTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DispositionType dispositionType = db.DispositionTypes.Find(id); if (dispositionType == null) { return(HttpNotFound()); } return(View(dispositionType)); }
public string GetRandomListening(DispositionType disposition) { switch (disposition) { case DispositionType.Positive: return(_listeningPositive.RandomText); case DispositionType.Neutral: return(_listeningNeutral.RandomText); case DispositionType.Negative: return(_listeningNegative.RandomText); } return(""); }
public string GetRandomGreeting(DispositionType disposition) { switch (disposition) { case DispositionType.Positive: return(_greetingsPositive.RandomText); case DispositionType.Neutral: return(_greetingsNeutral.RandomText); case DispositionType.Negative: return(_greetingsNegative.RandomText); } return(""); }
private string getDispositionType(DispositionType arg) { switch (arg) { case DispositionType.inline: return("inline"); break; case DispositionType.attachment: default: return("attachment"); break; } }
/// <summary> /// Get the access rights of a disposition type. /// </summary> /// <param name="dispositionType">The disposition type.</param> /// <returns>Returns the access right.</returns> public AccessRight GetAccessRightOfDispositionType(DispositionType dispositionType) { if (dispositionType == null) { throw new ArgumentNullException(nameof(dispositionType)); } if (this.lazyAccessMapper.Value.DispositionTypesAccessRightsByCodeName.TryGetValue( dispositionType.CodeName, out AccessRight accessRight)) { return(accessRight); } else { return(nullAccessRight); } }
/// <summary> /// Returns true if ReturnAuthorizationReturnDispositions instances are equal /// </summary> /// <param name="other">Instance of ReturnAuthorizationReturnDispositions to be compared</param> /// <returns>Boolean</returns> public bool Equals(ReturnAuthorizationReturnDispositions other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ReferenceNumber == other.ReferenceNumber || ReferenceNumber != null && ReferenceNumber.Equals(other.ReferenceNumber) ) && ( ItemNumber == other.ItemNumber || ItemNumber != null && ItemNumber.Equals(other.ItemNumber) ) && ( Quantity == other.Quantity || Quantity != null && Quantity.Equals(other.Quantity) ) && ( DispositionType == other.DispositionType || DispositionType != null && DispositionType.Equals(other.DispositionType) ) && ( DispositionInstructions == other.DispositionInstructions || DispositionInstructions != null && DispositionInstructions.SequenceEqual(other.DispositionInstructions) ) && ( Labels == other.Labels || Labels != null && Labels.SequenceEqual(other.Labels) )); }
public string GetDisplayText(DialogueTextData textData, DispositionType disposition) { switch (_displayTextType) { case SpeechType.Greeting: return(textData.GetRandomGreeting(disposition)); case SpeechType.Listening: return(textData.GetRandomListening(disposition)); case SpeechType.FlatterResponse: return(textData.GetRandomFlatteryResponse(disposition == DispositionType.Positive)); case SpeechType.ThreatenResponse: return(textData.GetRandomThreatenResponse(disposition == DispositionType.Positive)); case SpeechType.BribeResponse: return(textData.GetRandomBribeResponse(disposition == DispositionType.Positive)); } return(""); }
public override String ToString() { StringBuilder lSb = new StringBuilder(); lSb.Append(DispositionType.ToLower()); foreach (var lItem in fParameters.GetSequence()) { if (lItem.Value.Length > 0) { lSb.Append("; " + lItem.Key + "="); if ((lItem.Key == "filename" && lItem.Value.IndexOf(' ') >= 0) || lItem.Key.EndsWith("date")) { lSb.Append("\"" + lItem.Value + "\""); } else { lSb.Append(lItem.Value); } } } return(lSb.ToString()); }
protected virtual void ParseBody() { string strFullConentType = _headers["Content-Type"]; if (strFullConentType == null) { strFullConentType = ""; } //string strContentTypeValue = null; Hashtable parametrs; MimeEntry.ParseHeader(strFullConentType, out _contentType, out parametrs); // Step 2. Parse Messagy Body [1/23/2004] if (!_contentType.StartsWith("multipart/")) { _charSet = (string)parametrs["charset"]; if (_charSet == null) { _charSet = Encoding.Default.HeaderName; } string ContentEncoding = _headers["Content-Transfer-Encoding"]; if (ContentEncoding == null) { ContentEncoding = "8bit"; } string strDisposition = _headers["Content-Disposition"]; if (strDisposition != null) { Hashtable DispositionParameters; string DispositionType; MimeEntry.ParseHeader(strDisposition, out DispositionType, out DispositionParameters); DispositionType = DispositionType.ToLower(); if (DispositionType == "attachment") { this._disposition = Disposition.Attachment; } else if (DispositionType == "inline") { this._disposition = Disposition.Inline; } _fileName = (string)DispositionParameters["filename"]; if (_fileName != null) { _fileName = Rfc822HeaderCollection.DeocodeHeaderValue(_fileName); } } //string BodyString = Encoding.Default.GetString(this._BinaryData.GetBuffer(),this._BodyOffset,(int)(this._BinaryData.Length - this._BodyOffset)); Encoding encoding = null; try { encoding = Encoding.GetEncoding(CharSet); } catch { encoding = Encoding.Default; } string BodyString = encoding.GetString(this._BinaryData.GetBuffer(), this._BodyOffset, (int)(this._BinaryData.Length - this._BodyOffset)); //string BodyString = Encoding.ASCII.GetString(this._BinaryData.GetBuffer(),this._BodyOffset,(int)(this._BinaryData.Length - this._BodyOffset)); //string BodyString2 = Encoding.UTF8.GetString(this._BinaryData.GetBuffer(),this._BodyOffset,(int)(this._BinaryData.Length - this._BodyOffset)); switch (ContentEncoding.ToLower()) { case "quoted-printable": _body = encoding.GetBytes(MimeEntry.QDecode(encoding, BodyString)); break; case "7bit": //_body = Encoding.ASCII.GetBytes(BodyString); _body = encoding.GetBytes(BodyString); break; default: case "8bit": _body = encoding.GetBytes(BodyString); break; case "base64": BodyString = BodyString.Trim(); if (BodyString.Length > 0) { int base64FixCount = 0; // Fix If Base 64 is broken while (true) { try { _body = Convert.FromBase64String(BodyString); break; } catch (System.FormatException) { // Remove not supported chars if (base64FixCount == 0) { BodyString = Regex.Replace(BodyString, "[^a-zA-Z0-9+/=]+", string.Empty); } else if (base64FixCount == 1) { BodyString += "="; } else { BodyString = BodyString.Substring(0, BodyString.Length - 1); } if (BodyString.Length == 0 || base64FixCount == 25) // Max 25 Attempts to fix chars { _body = new byte[] { }; break; } base64FixCount++; } } } else { _body = new byte[] {} }; break; case "binary": _body = encoding.GetBytes(BodyString); break; //default: // throw new Pop3ServerIncorectEMailFormatException("Not supported content-encoding " + ContentEncoding + " !"); } } else { DataParseStatus parseStatus = _mimeEntries.ParseMimeEntries(_BinaryData.GetBuffer(), (int)_BinaryData.Length, ref _BodyOffset, this.Headers); } }
public void SetDispositionType(DispositionType argDispositionType) { this.dispositiontype = getDispositionType(argDispositionType); }
public SeaMonster(string name, DispositionType disposition) { _name = name; _disposition = disposition; }