Skip to content

Commit

Permalink
Actually save the file this time
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmacle committed Apr 24, 2016
1 parent afa89c5 commit 5ef0956
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
23 changes: 0 additions & 23 deletions WebAPIPlugin/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,4 @@ public void WebLoop()
}
}
}

public static class Extensions
{
public static void Respond(this HttpListenerContext context, object data, int statusCode)
{
try
{
var response = context.Response;
response.StatusCode = statusCode;

string serialized = JsonConvert.SerializeObject(data, Formatting.Indented);
byte[] bytes = Encoding.ASCII.GetBytes(serialized);
response.ContentLength64 = bytes.Length;

response.OutputStream.Write(bytes, 0, bytes.Length);
response.OutputStream.Close();
}
catch
{
MySandboxGame.Log.WriteLineAndConsole("SEWA: Error writing stream");
}
}
}
}
2 changes: 2 additions & 0 deletions WebAPIPlugin/WebAPIPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="APIBlockCache.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Generator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebHandlers.cs" />
<Compile Include="WebStructs\WebGrid.cs" />
<Compile Include="WebStructs\WebPut.cs" />
<Compile Include="WebStructs\WebPutCollection.cs" />
Expand Down

0 comments on commit 5ef0956

Please sign in to comment.