for now...dont deal with the default image

This commit is contained in:
Tommy Parnell
2014-01-26 05:36:28 -05:00
parent 892e1e6b48
commit 070c8d4605
3 changed files with 8 additions and 4 deletions

View File

@@ -9,10 +9,10 @@ namespace GravatarWrapper.Test
[TestMethod] [TestMethod]
public void TestMethod1() public void TestMethod1()
{ {
var req = GravatarWrapper.Request("test@mctest.com", 400, false); var req = GravatarWrapper.Request("tparnell@vistaprint.com", 400);
if (req != null) if (req != null)
{ {
req.Save(@"c:\users\test\Desktop\bmp.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); req.Save(@"c:\users\tommy\Desktop\bmp.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
} }
else else
{ {

View File

@@ -32,11 +32,10 @@ namespace GravatarWrapper
return sBuilder.ToString(); // Return the hexadecimal string. return sBuilder.ToString(); // Return the hexadecimal string.
} }
public static Bitmap Request(string email, int size, bool ShowDefaultImage) public static Bitmap Request(string email, int size)
{ {
var client = new RestClient("http://www.gravatar.com/avatar/" + HashEmailForGravatar(email)); var client = new RestClient("http://www.gravatar.com/avatar/" + HashEmailForGravatar(email));
var req = new RestRequest(Method.GET); var req = new RestRequest(Method.GET);
if (!ShowDefaultImage) req.AddParameter("d", "%22%22" );
req.AddParameter("s", size); req.AddParameter("s", size);
var res = client.Execute(req); var res = client.Execute(req);
if (res != null) if (res != null)

View File

@@ -30,6 +30,10 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="RestSharp, Version=104.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\RestSharp.104.4.0\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
@@ -40,6 +44,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Exceptions\NoResponseReturnedException.cs" />
<Compile Include="GravatarWrapper.cs" /> <Compile Include="GravatarWrapper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>