public ExtractionManagerTest()
        {
            _pdfToText = A.Fake <PdfToText>();
            _cognitive = A.Fake <Cognitive>();

            _manager = new ExtractionManager(_pdfToText, _cognitive);
        }
Beispiel #2
0
 public ProcessDocumentTest()
 {
     _fileManager       = A.Fake <FileManager>();
     _extractionManager = A.Fake <ExtractionManager>();
     _callback          = A.Fake <Callback>();
     _processDocument   = new ProcessDocument(_fileManager, _extractionManager, _callback);
     _newFileToProcess  = new NewFileToProcess {
         Url = string.Empty
     };
 }
Beispiel #3
0
        private void ExtractGameDir(string containerPath, string versionFilePath, string gamePath)
        {
            ExtractionManager ex = new ExtractionManager(new List <Extractor>()
            {
                new PackageExtractor(), new FileExtractor()
            });
            RootDirectoryEntity deser = new RootDirectoryEntityIO().Deserialize(versionFilePath);

            ex.Extract(deser, gamePath, Helpers.EntityToPath(containerPath), _dirCache, null);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="SteganographyPageViewModel" /> class.
 /// </summary>
 public SteganographyPageViewModel()
 {
     this.SourcePicture       = new Picture();
     this.HiddenPicture       = new Picture();
     this.EmbeddedPicture     = new Picture();
     this.ExtractedPicture    = new Picture();
     this.embeddingManager    = new EmbeddingManager(this.HiddenPicture, this.EmbeddedPicture);
     this.extractionManager   = new ExtractionManager(this.ExtractedPicture);
     this.headerManager       = new HeaderManager(this.SourcePicture);
     this.BitsPerColorChannel = 1;
 }
        public void ExtractToContainer(RootDirectoryEntity root, string gameDir, IProgress <int> progress)
        {
            string            container = Settings.Default.ContainerDirectory;
            ExtractionManager ex        = new ExtractionManager(new List <Extractor>()
            {
                new PackageExtractor(), new FileExtractor()
            });

            ex.Extract(root, gameDir, Helpers.EntityToPath(container), _dirCache, progress);

            string cacheXml = Settings.Default.DirectoryCacheFile;

            _ds.Serialize(_dirCache, cacheXml);
        }
Beispiel #6
0
        public PatcherForm(IStorageService storageService)
        {
            _storageService = storageService;

            _downloadManager   = new DownloadManager();
            _extractionManager = new ExtractionManager();
            _patchManager      = new PatchManager();

            _downloadTable   = new Dictionary <DownloadTask, ListViewItem>();
            _extractionTable = new Dictionary <ExtractionTask, ListViewItem>();
            _patchTable      = new Dictionary <PatchingTask, ListViewItem>();

            InitializeComponent();
        }
Beispiel #7
0
 private void stopButton_Click(object sender, EventArgs e)
 {
     lock (sender)
     {
         if (stop)
         {
             start = true;
             stop  = false;
             ExtractionManager.GetExtractionManager().MessagesShowEventHandler -= ExInfo;
             ExtractionManager.GetExtractionManager().StopExtract();
             tsstate.Text = @"状态:停止提取数据库";
         }
     }
 }
        public IExtractionManager GetExtractionManager()
        {
            var context                  = new ConcreteContext <EntityFramework>();
            var dataContextDecExt        = new DataContextDeclarationExtractor(context);
            var dbEntityExt              = new DatabaseEntityDeclarationExtractorUsingDbContextProperties(context);
            var dbAccessingMethodCallExt = new DatabaseAccessingMethodCallExtractor(context);
            var codeExecutionPathExt     = new CodeExecutionPathGenerator(context);
            var progressIndicator        = new Progress <ExtractionProgress>((e) => ProgressChanged(e));
            var serializer               = new NewtonsoftSerializer <EntityFramework>();

            IExtractionManager extractionManager = new ExtractionManager <EntityFramework>(dataContextDecExt, dbEntityExt, dbAccessingMethodCallExt, codeExecutionPathExt, progressIndicator, serializer);

            return(extractionManager);
        }
Beispiel #9
0
 private void startButton_Click(object sender, EventArgs e)
 {
     lock (sender)
     {
         if (start)
         {
             if (ProjectInfoDic.GetInstance().GetProjectInfos().Count > 0)
             {
                 stop  = true;
                 start = false;
                 ExtractionManager.GetExtractionManager().StartExtractDb();
                 ExtractionManager.GetExtractionManager().MessagesShowEventHandler += ExInfo;
                 tsstate.Text = @"状态:正在提取数据库";
             }
             else
             {
                 MessageBox.Show(@"请配置项目信息");
             }
         }
     }
 }
        private static void Main(string[] args)
        {
            var inputFilePath   = GetInputFilePath();
            var outputDirectory = GetOutputDirectory();
            var verboseEnabled  = GetVerboseLoggingEnabled();

            var verboseLogger       = new VerboseLogger(verboseEnabled, Console.WriteLine);
            var configProvider      = new AppConfigProvider();
            var httpWebRequestAgent = new HttpWebRequestAgent(verboseLogger);

            var extractor = new ExtractionManager(new ExtractionRequest
            {
                InputFilePath   = inputFilePath,
                OutputDirectory = outputDirectory,
                VerboseLogger   = verboseLogger
            }, configProvider, httpWebRequestAgent, verboseLogger);

            var response = extractor.RunExtraction();

            if (!string.IsNullOrEmpty(response.GeneralException))
            {
                Console.WriteLine($"Process failed. Error: {response.GeneralException}.");
                Console.ReadKey();
                return;
            }

            if (response.HasExtractionException)
            {
                foreach (var extrctException in response.ExtractionExceptions)
                {
                    Console.WriteLine(
                        $"Extraction did not complete for url: {extrctException.InputUrl}. " +
                        $"Error: {extrctException}");
                }
                Console.ReadKey();
            }

            Console.WriteLine($"Process complete. {response.SuccessfulExtractions} website(s) successfully processed.");
            Console.ReadKey();
        }
        public void ShouldCallParsingForEachPageFromPreviousIteration()
        {
            // Arrange
            var htmlTagExtractorMock    = Substitute.For <IHtmlTagExtractorService>();
            var pageDownloadServiceMock = Substitute.For <IPageDownloaderService>();
            var tagsDataBaseManagerMock = Substitute.For <ITagsDataBaseManager>();

            var    sut      = new ExtractionManager(htmlTagExtractorMock, pageDownloadServiceMock, tagsDataBaseManagerMock);
            string linkInfo = "https://en.wikipedia.org/wiki/Ryoji_Naraoka";

            CancellationToken cts = new CancellationToken();
            int linkLayer         = 1;
            var htmlTagExctractorReturningResult = new List <string>();

            htmlTagExctractorReturningResult.Add("https://en.wikipedia.org/wiki/Racewalking");
            htmlTagExctractorReturningResult.Add("https://en.wikipedia.org/wiki/1936_Summer_Olympics");
            pageDownloadServiceMock
            .DownloadPage(Arg.Any <string>(), Arg.Any <HttpClient>(), Arg.Any <CancellationToken>())
            .Returns(Task.FromResult <string>(linkInfo.GetHashCode().ToString()));

            htmlTagExtractorMock
            .ExtractTags(Arg.Any <string>(), Arg.Any <string>())
            .Returns(htmlTagExctractorReturningResult);


            // Act
            sut.RecursionTagExtraction(linkInfo, linkLayer, cts);

            // Asserts
            pageDownloadServiceMock
            .Received(1)
            .DownloadPage(Arg.Any <string>(), Arg.Any <HttpClient>(), Arg.Any <CancellationToken>());
            htmlTagExtractorMock
            .Received(3)
            .ExtractTags(Arg.Any <string>(), Arg.Any <string>());
        }
Beispiel #12
0
        static void Deploy(IEnumerable <RevisionSetting> revisions)
        {
            try
            {
                Console.WriteLine("Loading extraction instance");

                ExtractionManager manager = ExtractionManager.Instance;
                RepositoryStorage rs      = new RepositoryStorage();

                manager.ExtractedItem += new EventHandler <ItemEventArgs>(manager_ExtractedItem);
                manager.Extracted     += new EventHandler <ExtractionEventArgs>(manager_Extracted);

                manager.OverwriteExistingDependencies = true;
                manager.OverwriteExistingitems        = true;
                manager.OverwriteExistingResources    = true;

                Console.WriteLine("Deployment manager loaded");


                foreach (var rev in revisions.Where(x => x.Active))
                {
                    string revFolder = Path.GetFullPath(rev.Folder);
                    Console.WriteLine("Loading folder: " + revFolder);

                    Repository r = rs.GetByAlias(rev.Alias);

                    /*
                     * Console.WriteLine("Syncing files");
                     * foreach (var s in rev.Syncs)
                     * {
                     *  string pattern = "*.*";
                     *  if (!string.IsNullOrEmpty(s.Pattern))
                     *      pattern = s.Pattern;
                     *
                     *  var files = System.IO.Directory.GetFiles(s.Target, pattern);
                     * }
                     */


                    Console.WriteLine("Enabling remote deployment for: " + r.Name);
                    manager.EnableRemoteExtraction(r);

                    Console.WriteLine("Loading Contents: " + revFolder);
                    manager.Load(revFolder);

                    Console.WriteLine("Building graph...");
                    manager.BuildGraph();

                    Console.WriteLine(manager.ExtractionGraph.CountUnique() + " Items added to graph");

                    Console.WriteLine("Extraction...");
                    manager.ExtractAll(true, true);

                    Console.WriteLine("Unloading...");
                    manager.Unload();
                }

                Console.WriteLine("DONE...");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            Stopwatch st = new Stopwatch();

            #region Develop
            ImageUtils        imgUtils  = new ImageUtils();
            KeyPointExtractor myExtrac  = new KeyPointExtractor();
            ExtractionManager exManager = new ExtractionManager();
            myExtrac.ExtractKeyPoints(Const.imagesFolderDirectory + Const.imgName01 + ".png");
            myExtrac.ExtractKeyPoints(Const.imagesFolderDirectory + Const.imgName02 + ".png");
            PictureKeyPoints pkp01 = new PictureKeyPoints(Const.imgName01);
            PictureKeyPoints pkp02 = new PictureKeyPoints(Const.imgName02);
            LetDraw          ld    = new LetDraw();

            pkp01.KeyPoints = exManager.ExtractKeyPointsFromImages(pkp01.GetImagePath());
            pkp02.KeyPoints = exManager.ExtractKeyPointsFromImages(pkp02.GetImagePath());

            KeyPointPairsFinder kppf = new KeyPointPairsFinder(pkp01, pkp02);

            //foreach (KeyPoint kp in pkp01.KeyPoints)
            //{
            //    Console.WriteLine("Picture One key points: \n");
            //    Console.WriteLine(kp);
            //}

            Console.WriteLine("Start searching neighbours");
            st.Start();
            //Dictionary<KeyPoint, KeyPoint> neighbors = exManager.FindNeighbers(pkp01.KeyPoints, pkp02.KeyPoints); //WHY DICTIONARY NOT WORK ?
            List <KeyValuePair <KeyPoint, KeyPoint> > neighbors = kppf.FindKeyPointsPairs();
            st.Stop();
            Console.WriteLine("Neighbors Count: " + neighbors.Count + "\nin time: " + st.ElapsedMilliseconds.ToString());
            //ld.MergeImagesAndDrawLines(neighbors);


            /*
             * st.Reset();
             * st.Start();
             * NeighbourhoodCoherenceFilter neighbourhoodCoherenceFilter = new NeighbourhoodCoherenceFilter(neighbors, Const.neighborsToCheck, Const.neighborsCondition);
             * List<KeyValuePair<KeyPoint, KeyPoint>> filteredPairs = neighbourhoodCoherenceFilter.GetFilteredPairs();
             * st.Stop();
             * Console.WriteLine("AFTER FILTER");
             * Console.WriteLine("pairs Count: " + filteredPairs.Count + "\nin time: " + st.ElapsedMilliseconds.ToString());
             * //ld.MergeImagesAndDrawLines(filteredPairs);
             */

            Console.WriteLine("RANSAC IN PROGRESS");
            st.Reset();
            st.Start();
            //ITransform transform = new AffineTransform();
            ITransform      transform       = new PerspectiveTransform();
            Ransac          ransac          = new Ransac(Const.iterationNumber, transform, Const.maxError);
            TransformFilter transformFilter = new TransformFilter(ransac);
            List <KeyValuePair <KeyPoint, KeyPoint> > ransacPairs = transformFilter.Filter(neighbors);
            st.Stop();
            Console.WriteLine("AFTER RANSCAC");
            Console.WriteLine("pairs Count: " + ransacPairs.Count + "\nin time: " + st.ElapsedMilliseconds.ToString());

            ld.MergeImagesAndDrawLines(ransacPairs);



            Console.ReadKey();

            #endregion

            //ConsoleInterface cI = new ConsoleInterface();
        }
Beispiel #14
0
 public void Awake()
 {
     man = FindObjectOfType <ExtractionManager>();
 }