コード例 #1
0
        public FindPrintManager Create()
        {
            if (_version < 3 || _version > 6)
                throw new PBException("bad version {0}", _version);

            XmlConfig config = XmlConfig.CurrentConfig;
            _printConfig = config.GetConfig("PrintConfig");
            _printList1Config = config.GetConfig("PrintList1Config");
            _printList2Config = config.GetConfig("PrintList2Config");

            //_printTitleManager = CreatePrintTitleManager.Create(_version, _gapDayBefore, _gapDayAfter);
            PrintTitleManagerCreator createPrintTitleManager = new PrintTitleManagerCreator();
            createPrintTitleManager.Init(_xeConfig);
            createPrintTitleManager.SetParameters(_parameters);
            createPrintTitleManager.Version = _version;
            createPrintTitleManager.GapDayBefore = _gapDayBefore;
            createPrintTitleManager.GapDayAfter = _gapDayAfter;
            _printTitleManager = createPrintTitleManager.Create();

            _findDayManager = CreateFindDayManager();
            _printManager = CreatePrintManager();
            _postTypeDirectories = CreatePostTypeDirectories();
            _findPrintManager = _CreateFindPrintManager();

            return _findPrintManager;
        }
コード例 #2
0
        public void Init(XElement xe, XmlConfig config)
        {
            //XElement xe;
            //if (!test)
            //    _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager");
            //else
            //{
            //    Trace.WriteLine("CreateDownloadAutomateManager init for test");
            //    _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager_Test");
            //}
            //_test = test;
            _xeConfig       = xe;
            _version        = xe.zXPathValue("Version").zTryParseAs(_version);
            _useTestManager = xe.zXPathValue("UseTestManager").zTryParseAs(false);
            _traceLevel     = xe.zXPathValue("TraceLevel").zTryParseAs <int?>();
            //_dailyPrintManager = xe.zXPathValue("DailyPrintManager").zTryParseAs(false);
            //_gapDayBefore = xe.zXPathValue("GapDayBefore").zTryParseAs(0);
            //_gapDayAfter = xe.zXPathValue("GapDayAfter").zTryParseAs(0);

            //_config = XmlConfig.CurrentConfig;
            _config      = config;
            _localConfig = _config.GetConfig("LocalConfig");
            //_localConfig = _config.GetConfig("LocalConfig", optional: true);
            _printList1Config = _config.GetConfig("PrintList1Config");
            _printList2Config = _config.GetConfig("PrintList2Config");
        }
コード例 #3
0
        private static DebridLinkFr_v3 CreateDebridLinkFr(XmlConfig config)
        {
            DebridLinkFr_v3 debrider    = new DebridLinkFr_v3();
            XmlConfig       localConfig = config.GetConfig("LocalConfig");

            debrider.Login             = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/Login");
            debrider.Password          = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/Password");
            debrider.PublicKey         = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/PublicKey");
            debrider.ConnexionLifetime = DebridLinkFr_v3.GetConnexionLifetime(localConfig.GetExplicit("DownloadAutomateManager/DebridLink/ConnexionLifetime"));
            debrider.ConnexionFile     = config.GetExplicit("DebridLink/ConnexionFile");
            //debrider.ServerTimeFile = XmlConfig.CurrentConfig.GetExplicit("DebridLink/ServerTimeFile");
            return(debrider);
        }
コード例 #4
0
ファイル: QuestionsManager_Scan.cs プロジェクト: 24/source_04
        //private static string GetScanZone(QuestionsParameters parameters, string imageFile)
        //{
        //    // format: "top:left:height:width,...", example "zone=0:0:100:100,50:50:50:50"
        //    if (parameters.PageColumn == 1)
        //        return null;
        //    else if (parameters.PageColumn == 2)
        //    {
        //        int width;
        //        int height;
        //        zimg.GetImageWidthHeight(imageFile, out width, out height);
        //        string zone;
        //        switch (parameters.PageRotate)
        //        {
        //            case PageRotate.NoRotate:
        //            case PageRotate.Rotate180:
        //                int width2 = width / 2;
        //                zone = $"0:0:{width2}:{height},{width2}:0:{width - width2}:{height}";
        //                break;
        //            case PageRotate.Rotate90:
        //            case PageRotate.Rotate270:
        //                int height2 = height / 2;
        //                zone = $"0:0:{width}:{height2},0:{height2}:{width}:{height - height2}";
        //                break;
        //            default:
        //                throw new PBException($"unknow page rotation {parameters.PageRotate}");
        //        }
        //        return zone;
        //    }
        //    else
        //        throw new PBException($"can't create scan zone for {parameters.PageColumn} columns");
        //}

        //private OcrRequest CreateOcrRequest()
        //{
        //    return new OcrRequest { Language = "french,english", OutputFormat = "txt" };
        //}

        //private OcrWebService CreateOcrWebService()
        //{
        //    XmlConfig config = XmlConfig.CurrentConfig;
        //    XmlConfig ocrWebServiceConfig = config.GetConfig("OcrWebServiceConfig");
        //    OcrWebService ocrWebService = new OcrWebService(ocrWebServiceConfig.GetExplicit("UserName"), ocrWebServiceConfig.GetExplicit("LicenseCode"), _timeout);
        //    //ocrWebService.UserName = ocrWebServiceConfig.GetExplicit("UserName");
        //    //ocrWebService.LicenseCode = ocrWebServiceConfig.GetExplicit("LicenseCode");
        //    string cacheDirectory = config.Get("OcrWebServiceCacheDirectory");
        //    if (cacheDirectory != null)
        //    {
        //        UrlCache urlCache = new UrlCache(cacheDirectory);
        //        urlCache.UrlFileNameType = UrlFileNameType.Host | UrlFileNameType.Path;
        //        if (config.Get("OcrWebServiceCacheDirectory/@option")?.ToLower() == "indexedfile")
        //            urlCache.IndexedFile = true;
        //        ocrWebService.HttpManager.SetCacheManager(urlCache);
        //    }
        //    return ocrWebService;
        //}

        private ScanManager CreateScanManager()
        {
            XmlConfig config = XmlConfig.CurrentConfig;
            XmlConfig ocrWebServiceConfig = config.GetConfig("OcrWebServiceConfig");
            UrlCache  urlCache            = null;
            string    cacheDirectory      = config.Get("OcrWebServiceCacheDirectory");

            if (cacheDirectory != null)
            {
                urlCache = new UrlCache(cacheDirectory);
                urlCache.UrlFileNameType = UrlFileNameType.Host | UrlFileNameType.Path;
                if (config.Get("OcrWebServiceCacheDirectory/@option")?.ToLower() == "indexedfile")
                {
                    urlCache.IndexedFile = true;
                }
            }
            ScanManager scanManager = new ScanManager(ocrWebServiceConfig.GetExplicit("UserName"), ocrWebServiceConfig.GetExplicit("LicenseCode"), urlCache);

            scanManager.Language     = "french,english";
            scanManager.OutputFormat = "txt";
            return(scanManager);
        }