Ejemplo n.º 1
0
        static SearchManager()
        {
            searchConfig               = new SearchConfig();
            optimizeOptions            = new OptimizeOptions();
            binaryResponseHeaderParser = new BinaryResponseHeaderParser();
            IUpdateParametersConvert <NamedList>         updateParametersConvert = new BinaryUpdateParametersConvert();
            ISolrUpdateConnection <NamedList, NamedList> solrUpdateConnection    = new SolrUpdateConnection <NamedList, NamedList>()
            {
                ServerUrl = searchConfig.ServerUrl
            };

            updateOperations = new SolrUpdateOperations <NamedList, NamedList>(solrUpdateConnection, updateParametersConvert)
            {
                ResponseWriter = "javabin"
            };
            ISolrQueryConnection <NamedList> connection = new SolrQueryConnection <NamedList>()
            {
                ServerUrl = searchConfig.ServerUrl
            };

            operations = new SolrQueryOperations <NamedList>(connection)
            {
                ResponseWriter = "javabin"
            };
        }
Ejemplo n.º 2
0
        public IList <int> Optimize()
        {
            OptimizeOptions value          = default(OptimizeOptions);
            ResponseHeader  responseHeader = this.Update(new UpdateOptions
            {
                OptimizeOptions = new OptimizeOptions?(value)
            });
            IList <int> list = new List <int>();

            if (responseHeader != null)
            {
                list.Add(responseHeader.Status);
                list.Add(responseHeader.QTime);
                ConsoleHelper.WriteLine(string.Concat(new object[]
                {
                    "优化Solr:",
                    this.SolrServerUrl,
                    "成功,状态:",
                    responseHeader.Status,
                    "执行时间:",
                    responseHeader.QTime
                }), ConsoleColor.Yellow, "");
            }
            return(list);
        }
Ejemplo n.º 3
0
        public IPhpStatement[] TranslateStatement(IStatement x)
        {
            if (!(x is CSharpBase))
            {
                throw new Exception("Błąd translacji " + x.GetType().FullName);
            }
            var op = new OptimizeOptions();

            var s      = new PhpStatementSimplifier(op);
            var a      = new PhpStatementTranslatorVisitor(_state);
            var tmp    = a.Visit(x as CSharpBase);
            var result = new List <IPhpStatement>(tmp.Length);

            result.AddRange(tmp.Select(i => s.Visit(i as PhpSourceBase)));
            return(result.ToArray());
        }
Ejemplo n.º 4
0
        public void PostOptimizeDocumentTest()
        {
            const string name = "4pages.pdf";

            UploadFile(name, name);

            var options = new OptimizeOptions(
                AllowReusePageContent: false,
                CompressImages: true,
                ImageQuality: 100,
                LinkDuplcateStreams: true,
                RemoveUnusedObjects: true,
                RemoveUnusedStreams: true,
                UnembedFonts: true);
            var response = PdfApi.PostOptimizeDocument(name, options, folder: TempFolder);

            Assert.That(response.Code, Is.EqualTo(200));
        }
Ejemplo n.º 5
0
        public void PostOptimizeDocumentTest()
        {
            const string name = "4pages.pdf";

            UploadFile(name, name);

            var options = new OptimizeOptions(
                AllowReusePageContent: false,
                CompressImages: true,
                ImageQuality: 100,
                LinkDuplcateStreams: true,
                RemoveUnusedObjects: true,
                RemoveUnusedStreams: true,
                UnembedFonts: true);
            var response = api.PostOptimizeDocument(name, options, folder: FolderName);

            Console.WriteLine(response);
        }
Ejemplo n.º 6
0
        public IPyStatement[] TranslateStatement([NotNull] IStatement x)
        {
            if (x == null)
            {
                throw new ArgumentNullException(nameof(x));
            }
            if (!(x is CSharpBase))
            {
                throw new Exception($"Translation error: {x.GetType().FullName} is not CSharpBase instance");
            }
            var op = new OptimizeOptions();

            var s      = new PyStatementSimplifier(op);
            var a      = new PyStatementTranslatorVisitor(_state);
            var tmp    = a.Visit(x as CSharpBase);
            var result = new List <IPyStatement>(tmp.Length);

            result.AddRange(tmp.Select(i => s.Visit(i as PySourceBase)));
            return(result.ToArray());
        }
Ejemplo n.º 7
0
 public StatementSimplifier(OptimizeOptions op)
 {
     this.op = op;
 }
Ejemplo n.º 8
0
 public ExpressionSimplifier(OptimizeOptions op)
 {
     this.op = op;
 }
Ejemplo n.º 9
0
        public IPhpStatement[] TranslateStatement(IStatement x)
        {
            if (!(x is CSharpBase)) throw new Exception("Błąd translacji " + x.GetType().FullName);
            var op = new OptimizeOptions();

            var s = new StatementSimplifier(op);
            var a = new StatementTranslatorVisitor(_state);
            var tmp = a.Visit(x as CSharpBase);
            var result = new List<IPhpStatement>(tmp.Length);
            result.AddRange(tmp.Select(i => s.Visit(i as PhpSourceBase)));
            return result.ToArray();
        }