Exemple #1
0
 public void FillValues(SemanticsSessionScope semanticsSessionScope, PURLConnection purlConnection, MetaMetadataCompositeField metaMetadata, DocumentClosure documentClosure)
 {
     SemanticsSessionScope = semanticsSessionScope;
     PURLConnection        = purlConnection;
     MetaMetadata          = metaMetadata;
     DocumentClosure       = documentClosure;
 }
 public void Generate()
 {
     indensionStack.Clear();
     indensionStack.Push(-1);
     if (app == null) app = new Application();
     thisPresentation = app.Presentations.Add(MsoTriState.msoFalse);
     var cl = new DocumentClosure(null, thisPresentation, app);
     CurrentClosure = cl;
     ChangeTheme();
     cl.Initialize();
     cl.WorkPath = DefaultWorkPath;
     var module = thisPresentation.VBProject.VBComponents.Add(vbext_ComponentType.vbext_ct_StdModule);
     module.CodeModule.AddFromString(Resources.VBAModule);
     while (true)
     {
         var thisLine = ScriptReader.ReadLine();
         if (thisLine == null) break;
         Console.WriteLine(thisLine);
         if (!string.IsNullOrWhiteSpace(thisLine) && thisLine.TrimStart()[0] != '#')
             ParseLine(thisLine);
     }
     while (CurrentClosure != null) ExitClosure();
     app.Run("PAG_PostProcess", thisPresentation);
     var wnd = thisPresentation.NewWindow();
     thisPresentation.VBProject.VBComponents.Remove(module);
     wnd.Activate();
     //thisPresentation.Close();
 }
        /// <summary>
        /// Called by the _downloaderThread dispatched to the _awesomiumThread.
        ///
        ///
        /// </summary>
        /// <param name="closure"></param>
        public void ExtractMetadata(DocumentClosure closure)
        {
            Console.WriteLine("Extractor running on thread: " + Thread.CurrentThread.ManagedThreadId);

            WebViewParser parser = new WebViewParser(closure);

            parser.Parse();
        }
 public WebViewParser(DocumentClosure closure)
 {
     _closure = closure;
     SemanticsSessionScope = closure.SemanticsSessionScope;
     _webView = SemanticsSessionScope.WebBrowserPool.Acquire();
     _puri = closure.PURLConnection.ResponsePURL;
     _requestTimedOut = new DispatcherTimer() { Interval = EXTRACTION_TIMEOUT };
     _requestTimedOut.Tick += ExtractionRequestTimedOut;
 }
 public WebViewParser(DocumentClosure closure)
 {
     _closure = closure;
     SemanticsSessionScope = closure.SemanticsSessionScope;
     _webView         = SemanticsSessionScope.WebBrowserPool.Acquire();
     _puri            = closure.PURLConnection.ResponsePURL;
     _requestTimedOut = new DispatcherTimer()
     {
         Interval = EXTRACTION_TIMEOUT
     };
     _requestTimedOut.Tick += ExtractionRequestTimedOut;
 }
        private async void BtnGetMetadata_Click(object sender, RoutedEventArgs e)
        {
            string urls = UrlBox.Text;
            List <DocumentClosure> documentCollection = new List <DocumentClosure>();

            foreach (var url in urls.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
            {
                Document        document        = semanticsSessionScope.GetOrConstructDocument(new ParsedUri(url));
                DocumentClosure documentClosure = document.GetOrConstructClosure(semanticsSessionScope.MetadataServicesClient);

                documentCollection.Add(documentClosure);
            }

            foreach (var documentClosure in documentCollection)
            {
                documentClosure.Continuations += this.MetadataDownloadComplete;
                documentClosure.GetMetadata();
            }
        }
 /// <summary>
 /// Passes the DocumentClosure through to the RunDownloadLoop.
 /// Once the resulting extraction is completed, the call site is notified through the await mechanism.
 /// </summary>
 /// <param name="documentClosure"> </param>
 /// <returns></returns>
 public void QueueExtractionRequest(DocumentClosure documentClosure)
 {
     _toDownload.TryAdd(documentClosure);
 }
        /// <summary>
        /// Called by the _downloaderThread dispatched to the _awesomiumThread. 
        /// 
        /// 
        /// </summary>
        /// <param name="closure"></param>
        public void ExtractMetadata(DocumentClosure closure)
        {
            Console.WriteLine("Extractor running on thread: " + Thread.CurrentThread.ManagedThreadId);

            WebViewParser parser = new WebViewParser(closure);

            parser.Parse();
        }