protected override void ProcessData(Stream data, out CefStreamReader substituteData)
        {
            var bytes = new byte[(int)data.Length];
            data.Read(bytes, 0, (int)data.Length);
            fileStream.Write(bytes, 0, (int)data.Length);

            substituteData = null;
            // Console.WriteLine("ProcessData: {0}", data.Length);
        }
Example #2
0
        protected override void ProcessData(Stream data, out CefStreamReader substituteData)
        {
            var bytes = new byte[(int)data.Length];

            data.Read(bytes, 0, (int)data.Length);
            fileStream.Write(bytes, 0, (int)data.Length);

            substituteData = null;
            // Console.WriteLine("ProcessData: {0}", data.Length);
        }
        // TODO: use OnBeforeResourceLoad to OnResourceResponse to detect resource loading, and waiting when all resources will be loaded
        protected override bool OnBeforeResourceLoad(CefBrowser browser, CefRequest request, out string redirectUrl, out CefStreamReader resourceStream, CefResponse response, int loadFlags)
        {
            var prevColor = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            Console.WriteLine("OnBeforeResourceLoad: {0}", request.GetURL());
            Console.ForegroundColor = prevColor;

            redirectUrl = null;
            resourceStream = null;
            return false;
        }
        protected override void Drain(out CefStreamReader remainder)
        {
            if (this.fileStream != null)
            {
                this.fileStream.Close();
                this.fileStream = null;
            }

            remainder = null;
            Console.WriteLine("Drain");
        }
Example #5
0
        protected override void Drain(out CefStreamReader remainder)
        {
            if (this.fileStream != null)
            {
                this.fileStream.Close();
                this.fileStream = null;
            }

            remainder = null;
            Console.WriteLine("Drain");
        }
        /// <summary>
        /// Create a new CefXmlReader object.
        /// The returned object's methods can only be called from the thread that created the object.
        /// </summary>
        public static CefXmlReader Create(CefStreamReader stream, CefXmlEncodingType encodingType, string uri)
        {
            fixed (char* uri_str = uri)
            {
                var n_uri = new cef_string_t(uri_str, uri != null ? uri.Length : 0);

                return CefXmlReader.From(
                    NativeMethods.cef_xml_reader_create(
                        stream.GetNativePointerAndAddRef(),
                        (cef_xml_encoding_type_t)encodingType,
                        &n_uri)
                        );
            }
        }
 /// <summary>
 /// Create a new CefXmlReader object.
 /// The returned object's methods can only be called from the thread that created the object.
 /// </summary>
 public static CefXmlReader Create(CefStreamReader stream, CefXmlEncodingType encodingType, Uri uri)
 {
     return Create(stream, encodingType, uri.ToString());
 }
 /// <summary>
 /// Set |substitute_data| to the replacement for the data in |data| if data should be modified.
 /// </summary>
 protected virtual void ProcessData(Stream data, out CefStreamReader substituteData)
 {
     substituteData = null;
 }
 /// <summary>
 /// Called when there is no more data to be processed.
 /// It is expected that whatever data was retained in the last ProcessData() call,
 /// it should be returned now by setting |remainder| if appropriate.
 /// </summary>
 protected virtual void Drain(out CefStreamReader remainder)
 {
     remainder = null;
 }
 /// <summary>
 /// Create a new CefZipReader object.
 /// The returned object's methods can only be called from the thread that created the object.
 /// </summary>
 public static CefZipReader Create(CefStreamReader stream)
 {
     return CefZipReader.From(
         NativeMethods.cef_zip_reader_create(stream.GetNativePointerAndAddRef())
         );
 }
Example #11
0
        /// <summary>
        /// Load the contents of |stream| with the optional dummy target |url|.
        /// </summary>
        public void LoadStream(CefStreamReader stream, string url)
        {
            fixed (char* url_str = url)
            {
                var n_url = new cef_string_t(url_str, url != null ? url.Length : 0);

                cef_frame_t.invoke_load_stream(this.ptr, stream.GetNativePointerAndAddRef(), &n_url);
            }
        }
 /// <summary>
 /// Called on the IO thread before a resource is loaded.
 /// To allow the resource to load normally return false.
 /// To redirect the resource to a new url populate the |redirectUrl| value and return false.
 /// To specify data for the resource return a CefStream object in |resourceStream|,
 /// use the |response| object to set mime type, HTTP status code and optional header values, and return false.
 /// To cancel loading of the resource return true.
 /// Any modifications to |request| will be observed.
 /// If the URL in |request| is changed and |redirectUrl| is also set, the URL in |request| will be used.
 /// </summary>
 protected virtual bool OnBeforeResourceLoad(CefBrowser browser, CefRequest request, out string redirectUrl, out CefStreamReader resourceStream, CefResponse response, int loadFlags)
 {
     redirectUrl = null;
     resourceStream = null;
     return false;
 }
Example #13
0
        // TODO: use OnBeforeResourceLoad to OnResourceResponse to detect resource loading, and waiting when all resources will be loaded
        protected override bool OnBeforeResourceLoad(CefBrowser browser, CefRequest request, out string redirectUrl, out CefStreamReader resourceStream, CefResponse response, int loadFlags)
        {
            var prevColor = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            Console.WriteLine("OnBeforeResourceLoad: {0}", request.GetURL());
            Console.ForegroundColor = prevColor;

            redirectUrl    = null;
            resourceStream = null;
            return(false);
        }