using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;

namespace Azyobuzi.Twirunrun
{
    public static class Outputz
    {
        public static void Post(string key, string uri, int size)
        {
            using (var wc = new WebClient())
            {
                var nvc = new NameValueCollection();
                nvc.Add("key", key);
                nvc.Add("uri", uri);
                nvc.Add("size", size.ToString());

                try
                {
                    wc.UploadValues("http://outputz.com/api/post", nvc);
                }
                catch (WebException ex)
                {
                    using (var sr = new StreamReader(ex.Response.GetResponseStream()))
                    {
                        throw new Exception(sr.ReadToEnd(), ex);
                    }
                }
            }
        }
    }
}
