HttpServerBoxed 0.0.11 alpha
A simple http server for C# and .NET
Loading...
Searching...
No Matches
HSB.Components.FormPart Class Reference

Represents a generic part of a multipart form. More...

Inheritance diagram for HSB.Components.FormPart:
HSB.Components.FilePart

Public Member Functions

 FormPart (byte[] data)
 
override string ToString ()
 

Static Public Member Functions

static FormPart Build (byte[] data)
 

Public Attributes

string ContentDisposition
 
string Name
 
byte[] Data
 

Detailed Description

Represents a generic part of a multipart form.

Definition at line 9 of file FormPart.cs.

Constructor & Destructor Documentation

◆ FormPart()

HSB.Components.FormPart.FormPart ( byte[]  data)

Definition at line 15 of file FormPart.cs.

16 {
17 int offset = Utils.IndexOf(data, Encoding.UTF8.GetBytes("\r\n")) + 2;
18 ContentDisposition = Encoding.UTF8.GetString(data[..offset]);
19 Name = ContentDisposition.Split(";")[1].Split("=")[1].Replace("\"", "");
20 Data = data[offset..^2];
21
22 }

Member Function Documentation

◆ Build()

static FormPart HSB.Components.FormPart.Build ( byte[]  data)
static

Definition at line 29 of file FormPart.cs.

30 {
31 var formPart = new FormPart(data);
32 if (formPart.ContentDisposition.Contains("filename"))
33 {
34 return new FilePart(data);
35 }
36 return formPart;
37 }

◆ ToString()

override string HSB.Components.FormPart.ToString ( )

Definition at line 24 of file FormPart.cs.

25 {
26 return "FormPart : " + ContentDisposition;
27 }

Member Data Documentation

◆ ContentDisposition

string HSB.Components.FormPart.ContentDisposition

Definition at line 11 of file FormPart.cs.

◆ Data

byte [] HSB.Components.FormPart.Data

Definition at line 13 of file FormPart.cs.

◆ Name

string HSB.Components.FormPart.Name

Definition at line 12 of file FormPart.cs.


The documentation for this class was generated from the following file: