public void SauceLabs_DownloadAllJobAssets(int jobNumber)
        {
            var jobList = SauceLabs_LastJobsFunction(jobNumber);

            for (int j = 0; j < jobList.Count; j++)
            {
                SauceLabs_DownloadLogs(jobList[j]);  //download logs from joblist location
                SauceLabs_DownloadVideo(jobList[j]); //download video from joblist location
                SauceScreenshots sauceScreenshots = SauceLabs_GetScreenshotAssets(jobList[j]);
                for (int i = 0; i < sauceScreenshots.screenshots.Count; i++)
                {
                    System.IO.Directory.CreateDirectory(jobList[j]);
                    HttpWebRequest HttpWReq =
                        (HttpWebRequest)
                        WebRequest.Create("http://saucelabs.com/rest/JackBTest/jobs/" + jobList[j] +
                                          "/results/" + sauceScreenshots.screenshots[i]);
                    saucelabsAuthentication(HttpWReq);
                    String lsResponse = string.Empty;
                    using (HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse())
                    {
                        using (BinaryReader reader = new BinaryReader(HttpWResp.GetResponseStream()))
                        {
                            Byte[] lnByte = reader.ReadBytes(1 * 1024 * 1024 * 10);
                            using (
                                FileStream lxFS = new FileStream(jobList[j] + "/" + sauceScreenshots.screenshots[i] + ".jpg",
                                                                 FileMode.Create))
                            {
                                lxFS.Write(lnByte, 0, lnByte.Length);
                                HttpWResp.Close();
                            }
                        }
                    }
                }
            }
        }
        public void SauceLabs_DownloadALLScreenShot(string jobsID) //Get JSON of get assets and check the highest screenshot number
        {
            SauceScreenshots sauceScreenshots = SauceLabs_GetScreenshotAssets(jobsID);

            for (int i = 0; i < sauceScreenshots.screenshots.Count; i++)
            {
                //TODO - simplify the namespaces - don't need fully qualified paths
                System.IO.Directory.CreateDirectory(jobsID);
                HttpWebRequest HttpWReq =
                    (HttpWebRequest)
                    WebRequest.Create("http://saucelabs.com/rest/JackBTest/jobs/" + jobsID +
                                      "/results/" + sauceScreenshots.screenshots[i]);
                saucelabsAuthentication(HttpWReq);
                String lsResponse = string.Empty;
                using (HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse())
                {
                    using (BinaryReader reader = new BinaryReader(HttpWResp.GetResponseStream()))
                    {
                        Byte[] lnByte = reader.ReadBytes(1 * 1024 * 1024 * 10);
                        using (FileStream lxFS = new FileStream(jobsID + "/" + sauceScreenshots.screenshots[i] + ".jpg",
                                                                FileMode.Create))
                        {
                            lxFS.Write(lnByte, 0, lnByte.Length);
                            HttpWResp.Close();
                        }
                    }
                }
            }
        }
        public SauceScreenshots SauceLabs_GetScreenshotAssets(string jobsID)
        {
            //TODO - blend auth into actual request builder - use constructors
            HttpWebRequest HttpWReq =
                (HttpWebRequest)WebRequest.Create("http://saucelabs.com/rest/v1/JackBTest/jobs/" + jobsID + "/assets");

            saucelabsAuthentication(HttpWReq);

            //TODO - separate Response handling into separate class
            HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();

            string json;

            using (var sr = new StreamReader(HttpWResp.GetResponseStream()))
            {
                json = sr.ReadToEnd();
            }
            SauceScreenshots sauceScreenshots = JsonConvert.DeserializeObject <SauceScreenshots>(json);

            return(sauceScreenshots);
        }