Changeset 1619
- Timestamp:
- 1/19/2010 9:20:54 AM (3 years ago)
- Location:
- branches/eraser6/CodeReview/Eraser.Util
- Files:
-
- 2 edited
-
BlackBox.cs (modified) (3 diffs)
-
PostDataBuilder.cs (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser.Util/BlackBox.cs
r1618 r1619 550 550 { 551 551 PostDataBuilder builder = new PostDataBuilder(); 552 builder.AddPart(new FormField("action", "status"));552 builder.AddPart(new PostDataField("action", "status")); 553 553 AddStackTraceToRequest(Report.StackTrace, builder); 554 554 … … 654 654 //Build the POST request 655 655 PostDataBuilder builder = new PostDataBuilder(); 656 builder.AddPart(new FormField("action", "upload"));657 builder.AddPart(new FormFileField("crashReport", "Report.tbz", bzipFile));656 builder.AddPart(new PostDataField("action", "upload")); 657 builder.AddPart(new PostDataFileField("crashReport", "Report.tbz", bzipFile)); 658 658 AddStackTraceToRequest(Report.StackTrace, builder); 659 659 … … 720 720 { 721 721 foreach (string stackFrame in exceptionStack.StackTrace) 722 builder.AddPart(new FormField(722 builder.AddPart(new PostDataField( 723 723 string.Format("stackTrace[{0}][]", exceptionIndex), stackFrame)); 724 builder.AddPart(new FormField(string.Format(724 builder.AddPart(new PostDataField(string.Format( 725 725 "stackTrace[{0}][exception]", exceptionIndex), exceptionStack.ExceptionType)); 726 726 ++exceptionIndex; -
branches/eraser6/CodeReview/Eraser.Util/PostDataBuilder.cs
r1618 r1619 40 40 } 41 41 42 public void AddPart( FormField field)42 public void AddPart(PostDataField field) 43 43 { 44 44 //Generate a random part boundary … … 58 58 StringBuilder currentBoundary = new StringBuilder(); 59 59 currentBoundary.AppendFormat("--{0}\r\n", Boundary); 60 if (field is FormFileField)60 if (field is PostDataFileField) 61 61 { 62 62 currentBoundary.AppendFormat( 63 63 "Content-Disposition: file; name=\"{0}\"; filename=\"{1}\"\r\n", 64 field.FieldName, (( FormFileField)field).FileName);64 field.FieldName, ((PostDataFileField)field).FileName); 65 65 currentBoundary.AppendLine("Content-Type: application/octet-stream"); 66 66 } … … 147 147 } 148 148 149 class FormField149 public class PostDataField 150 150 { 151 151 /// <summary> … … 154 154 /// <param name="fieldName">The name of the field.</param> 155 155 /// <param name="stream">The stream containing the field data.</param> 156 public FormField(string fieldName, Stream stream)156 public PostDataField(string fieldName, Stream stream) 157 157 { 158 158 FieldName = fieldName; … … 165 165 /// <param name="fieldName">The name of the field.</param> 166 166 /// <param name="stream">The content of the field.</param> 167 public FormField(string fieldName, string content)167 public PostDataField(string fieldName, string content) 168 168 : this(fieldName, new MemoryStream(Encoding.UTF8.GetBytes(content))) 169 169 { … … 181 181 } 182 182 183 class FormFileField : FormField183 public class PostDataFileField : PostDataField 184 184 { 185 185 /// <summary> … … 189 189 /// <param name="fileName">The name of the file.</param> 190 190 /// <param name="stream">The stream containing the field data.</param> 191 public FormFileField(string fieldName, string fileName, Stream stream)191 public PostDataFileField(string fieldName, string fileName, Stream stream) 192 192 : base(fieldName, stream) 193 193 {
Note: See TracChangeset
for help on using the changeset viewer.
