コード例 #1
0
        private bool SingleDocumentHandler(IHTMLEventObj e)
        {
            IHTMLElement form    = e.srcElement;
            string       docid   = PACER.GetDocumentIdFromUrl(this.browser.LocationURL);
            string       urlpath = this.browser.LocationURL;

            FormData data = new FormData();

            foreach (IHTMLElement input in ((HTMLFormElement)form).getElementsByTagName("input"))
            {
                if (input.getAttribute("type") == "text")
                {
                    data.Append(input.getAttribute("name"), input.innerText);
                }
            }

            (new XHR(form.getAttribute("action"), data, "arraybuffer", (XHR.Callback)((type, responseData) => {
                byte[] responseBytes = (byte[])responseData;
                if (type == "application/pdf")
                {
                    string filepath = SaveTemporaryPdf(responseBytes);
                    string html = "<body><iframe src=\"file://" + filepath + "\"></iframe></body>";
                    this.ShowPdfPage(docid, urlpath, filepath, html);
                }
                else
                {
                    string html = Encoding.UTF8.GetString(responseBytes);
                    this.ShowPdfPage(docid, urlpath, null, html);
                }
            }))).Send();

            return(true);
        }
コード例 #2
0
ファイル: PACER.cs プロジェクト: wethepeopleonline/recap-ie
        public static void ConvertDocumentUrl(string url, ConvertDocumentUrlCallback callback)
        {
            string schemeHost = (new Regex(@"^\w+://[^/]+")).Match(url).ToString();
            string query      = (new Regex(@"\?.*")).Match(url).ToString();
            string queryurl   = schemeHost + "/cgi-bin/document_link.pl?document" + query.Replace('?', 'K').Replace('&', 'K').Replace('=', 'V');

            NameValueCollection data = HttpUtility.ParseQueryString(query);

            (new XHR(queryurl, null, "text", (type, responseData) => {
                string newurl = (string)responseData;
                callback(newurl, PACER.GetDocumentIdFromUrl(newurl), data["caseid"], data["de_seq_num"], data["dm_id"], data["doc_num"]);
            })).Send();
        }