public void Execute()
{
foreach (string textureId in m_textureIds)
{
string thisTextureUrl = string.Format("{0}?texture_id={1}", m_getTextureUrl, textureId);
WebRequest req = HttpWebRequest.Create(thisTextureUrl);
try
{
using (WebResponse response = req.GetResponse())
{
// Console.WriteLine("Successfully executed {0} {1}", req.Method, req.RequestUri);
long len = response.ContentLength;
m_test.TotalBytes += len;
if (len <= 0)
{
Console.WriteLine("ERROR: Got length {0} for {1} {2}", len, req.Method, req.RequestUri);
}
else
{
Console.WriteLine("Got length {0} for {1} {2}", len, req.Method, req.RequestUri);
m_test.SuccessfulRequests++;
}
}
}
catch (WebException e)
{
Console.WriteLine("ERROR: Got {0} on {1} {2}", e.Status, req.Method, req.RequestUri);
}
}
}
public void Execute() { DateTime start = DateTime.Now; GetTextures gt = new GetTextures(this, m_getTextureUrl, m_textureIds); gt.Execute(); TimeSpan elapsed = DateTime.Now - start; Console.WriteLine( "Successfully got {0} textures out of {1} requests totalling {2} bytes from capability {3} took {4} seconds (avg {5} seconds/texture, {6} kB/s)", SuccessfulRequests, m_textureIds.Count, TotalBytes, m_getTextureUrl, elapsed.TotalSeconds, elapsed.TotalSeconds / (double)m_textureIds.Count, TotalBytes / elapsed.TotalSeconds / 1024); }