Skip to content

Instantly share code, notes, and snippets.

Avatar

Eastman andrueastman

View GitHub Profile
@andrueastman
andrueastman / gist:b2d47d76db68f353ca74bc4271b0a089
Created Feb 28, 2019 — forked from aliostad/gist:3202814
Serialisation and deserialisation of HTTP request and response messages in ASP.NET Web API
View gist:b2d47d76db68f353ca74bc4271b0a089
public interface IHttpMessageSerializer
{
void Serialize(HttpResponseMessage response, Stream stream);
void Serialize(HttpRequestMessage request, Stream stream);
HttpResponseMessage DeserializeToResponse(Stream stream);
HttpRequestMessage DeserializeToRequest(Stream stream);
}
public class MessageContentHttpMessageSerializer : IHttpMessageSerializer
View scratchpad.c
leng = (scratchpad[1]*2);
for (j=0,i=0;i<leng,j<scratchpad[1];j++,i+=2)
{
scratchpad[2+j] = ascii2hex( buffer[DATA+7+i], buffer[DATA+8+i]);
temp_length = sprintf( (char*)&scratchpad[0], (const rom far void *)"PROCESSED_3:%02x:%02x",scratchpad[2+j]);
testif_write( scratchpad,temp_length );
}