Skip to content
Snippets Groups Projects
Commit 1b286335 authored by brewdente's avatar brewdente
Browse files

Only lower case the first letter of the property. If there is an error, no...

Only lower case the first letter of the property.  If there is an error, no request id, and there is only 1 request, then we know what to do.  Renaming the file for the EVentHandler.
parent b0759f1c
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@
<Compile Include="CommandResponse.cs" />
<Compile Include="CommandResponseAttribute.cs" />
<Compile Include="CommandResponseFactory.cs" />
<Compile Include="CommandResponseHandler.cs" />
<Compile Include="EventHandler.cs" />
<Compile Include="ErrorResponse.cs" />
<Compile Include="Event.cs" />
<Compile Include="EventAttribute.cs" />
......
......@@ -131,6 +131,18 @@ namespace ChromeDevTools
_responses.AddOrUpdate(response.Id, id => response, (key, value) => response);
requestMre.Set();
}
else
{
// in the case of an error, we don't always get the request Id back :(
// if there is only one pending requests, we know what to do ... otherwise
if (1 == _requestWaitHandles.Count)
{
var requestId = _requestWaitHandles.Keys.First();
_requestWaitHandles.TryGetValue(requestId, out requestMre);
_responses.AddOrUpdate(requestId, id => response, (key, value) => response);
requestMre.Set();
}
}
}
private Task<ICommandResponse> SendCommand(Command command)
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Serialization;
using System;
namespace ChromeDevTools.Serialization
{
class MessageContractResolver : DefaultContractResolver
internal class MessageContractResolver : DefaultContractResolver
{
protected override string ResolvePropertyName(string propertyName)
{
return propertyName.ToLower();
if (String.IsNullOrEmpty(propertyName))
{
return propertyName;
}
if (1 == propertyName.Length)
{
return Char.ToLowerInvariant(propertyName[0]).ToString();
}
return Char.ToLowerInvariant(propertyName[0]) + propertyName.Substring(1);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment