public static RootObject GetInfo(string bookCode)
        {
            WebClient webClient = WebClientFactory.Create();
            string    url       = string.Format(UrlPattern, bookCode);
            string    content   = webClient.DownloadString(url).Trim();

            content = content.Substring(10);
            content = content.Remove(content.Length - 1);
            var result = JsonConvert.DeserializeObject <RootObject>(content);

            if (result.status != "ok")
            {
                throw new CalameoException("Failed to download book info");
            }
            return(result);
        }
        static string DownloadHtml(string sourceUrl)
        {
            string content;

            try
            {
                var webClient = WebClientFactory.Create();
                content = webClient.DownloadString(sourceUrl);
                if (content.ToLowerInvariant().Contains("offline"))
                {
                    throw new CalameoException("Site is currently offline");
                }
            }
            catch (WebException webException)
            {
                throw new CalameoException(webException.Message);
            }
            return(content);
        }
        void GetPage(
            string downloadUrl,
            string bookUniqueKey,
            string pageID,
            int pageNumber,
            string localFilePath)
        {
            var baseUri = new Uri(downloadUrl);
            var pageUri = new Uri(baseUri, bookUniqueKey + "/" + pageID);

            try
            {
                var webClient = WebClientFactory.Create();
                var data      = webClient.DownloadData(pageUri);
                ProcessData(localFilePath, data);
            }
            catch (WebException webException)
            {
                throw new CalameoException(webException.Message);
            }
        }