コード例 #1
0
        /// <summary>
        /// 处理数据
        /// </summary>
        /// <param name="Controller"></param>
        /// <param name="Method"></param>
        /// <returns></returns>
        protected virtual ISocketResult ExecuteCallDataHandler(Type Controller, MethodInfo Method, ISocketResult Param)
        {
            var    Ctrl      = Activator.CreateInstance(Controller);
            var    ParamInfo = Method.GetParameters().FirstOrDefault();
            Object Result;

            if (ParamInfo?.ParameterType == typeof(PageQuery))
            {
                PageQuery TargetParamerter = Param.SocketJsonData.ToModel <PageQuery>();
                Result = ((Task <ActionResult <Object> >)Method.Invoke(Ctrl, new[] { TargetParamerter })).Result.Value;
                if (Result != null)
                {
                    return new SocketResultDefault {
                               SocketJsonData = Result.ToJson()
                    }
                }
                ;
            }
            else if (ParamInfo?.ParameterType == typeof(ResultProvider))
            {
                ResultProvider TargetParamerter = ResultProvider.SetValue(null, Param.SocketJsonData.ToModel <Dictionary <string, Object> >());
                Result = ((Task <ActionResult <Object> >)Method.Invoke(Ctrl, new[] { TargetParamerter })).Result.Value;
                if (Result != null)
                {
                    return new SocketResultDefault {
                               SocketJsonData = Result.ToJson()
                    }
                }
                ;
            }
            else
            {
                Result = ((Task <ActionResult <Object> >)Method.Invoke(Ctrl, null)).Result.Value;
                if (Result != null)
                {
                    return new SocketResultDefault {
                               SocketJsonData = Result.ToJson()
                    }
                }
                ;
            }
            return(ExecuteNoAuthor());
        }
コード例 #2
0
        private void GeneratePdfInternal(IInputData[] inputFiles, IOutputData output, string coverHtml, RocketPDFParameterManager parameterManager)
        {
            TempFileManager tempFileManager = new TempFileManager(tempFilesDirectory: TempFilesDirectory, filePrefix: "pdf-temp-");

            OutputFileProvider outputFileProvider = new OutputFileProvider(tempFileManager);

            var            outputPdfFilePath = output.Accept(outputFileProvider).OutputFile;
            ResultProvider resultProvider    = new ResultProvider(outputPdfFilePath);


            var parameters            = parameterManager.GetParameters();
            var pdfParametersInternal = GenerateInternalParameters(inputFiles, outputPdfFilePath, coverHtml, parameters, tempFileManager);

            try
            {
                if (_batchMode)
                {
                    InvokeWkHtmlToPdfInInBatch(parameters, pdfParametersInternal);
                }
                else
                {
                    InvokeWkHtmlToPdf(parameters, pdfParametersInternal);
                }

                output.Accept(resultProvider);
            }
            catch (Exception ex)
            {
                if (!_batchMode)
                {
                    _processHelper.EnsureWkHtmlProcessStopped();
                }
                throw new Exception("Can't generate PDF: " + ex.Message, ex);
            }
            finally
            {
                tempFileManager.DeleteTempFiles();
            }
        }
コード例 #3
0
        private void SetResultProvider()
        {
            var trace = new StackTrace();
            var t     = trace.GetFrame(2).GetMethod().DeclaringType;

            if (t == typeof(GoogleCalculator))
            {
                ResultProvider = ResultProvider.Google;
            }
            else if (t == typeof(BingCalculator))
            {
                ResultProvider = ResultProvider.Bing;
            }
            else if (t == typeof(OctaveCalculator))
            {
                ResultProvider = ResultProvider.Octave;
            }
            else
            {
                ResultProvider = ResultProvider.Unknown;
            }
        }
コード例 #4
0
ファイル: TestController.cs プロジェクト: EmilyEdna/XExten
        public List <string> Get()
        {
            TestClass tc   = new TestClass();
            var       data = ResultProvider.SetValue("Name", new Dictionary <object, object> {
                { "Key", "Value" }
            });

            tc.ByTraceInvoke("TestMethods", new object[] { data });

            //HttpMultiClient.HttpMulti.AddNode("https://www.baidu.com").Build().RunString();

            //var xx = Sugar.DB.Queryable<WarnInfo>().Select(t => new WarnInfo
            //{
            //    Title = t.Title,
            //    ZhaiYao = t.ZhaiYao
            //}).ToList();

            //var x =  xx.FirstOrDefault();
            // x.Title = "测试1";
            // Sugar.DB.Updateable(x).UpdateColumns(t => t.Title).Where(t => t.ZhaiYao == "111").ExecuteCommand();
            return(new List <string>());
        }
コード例 #5
0
 //Interface
 public SharePointSearchServiceGateway(string queryServiceUrl,ResultProvider rp) { 
     //Constructor
     this.mQueryServiceUrl = queryServiceUrl;
     this.mResultProvider = rp;
 }
コード例 #6
0
 public DescriptiveStatsPublisher(ResultProvider <NumericDistribution> distributionProvider)
 {
     this.distributionProvider = distributionProvider;
 }
コード例 #7
0
 public QuartileEstimator(
     ResultProvider <NumericHistogramComponent.Result> histogramResult)
 {
     this.histogramResult = histogramResult;
 }
コード例 #8
0
ファイル: TestController.cs プロジェクト: EmilyEdna/XExten
 public int TestMethods(ResultProvider provider)
 {
     return(111);
 }
コード例 #9
0
 public DatetimeGeneratorComponent(ResultProvider <DatetimeDistribution> distributionProvider)
 {
     this.distributionProvider = distributionProvider;
 }
コード例 #10
0
 public DatetimeDistributionComponent(ResultProvider <LinearTimeBuckets.Result> timeBucketsResultProvider)
 {
     this.timeBucketsResultProvider = timeBucketsResultProvider;
 }
コード例 #11
0
 public QueryResult(IEnumerable <T> enumerable)
 {
     this.enumerable = enumerable;
     this.provider   = new ResultProvider();
 }
コード例 #12
0
 public MinMaxFromHistogramComponent(ResultProvider <List <HistogramWithCounts> > histogramsProvider)
 {
     this.histogramsProvider = histogramsProvider;
 }
コード例 #13
0
 public AverageEstimator(ResultProvider <NumericHistogramComponent.Result> histogramResultProvider)
 {
     this.histogramResultProvider = histogramResultProvider;
 }
コード例 #14
0
 public EmailCheckComponent(
     ResultProvider <DistinctValuesComponent.Result> distinctValuesProvider)
 {
     this.distinctValuesProvider = distinctValuesProvider;
 }
コード例 #15
0
ファイル: AverageEstimator.cs プロジェクト: diffix/explorer
 public AverageEstimator(ResultProvider <HistogramWithCounts> histogramResultProvider)
 {
     this.histogramResultProvider = histogramResultProvider;
 }
コード例 #16
0
 public DistributionAnalysisComponent(ResultProvider <NumericDistribution> distributionProvider)
 {
     this.distributionProvider = distributionProvider;
 }
コード例 #17
0
 public NumericDistributionComponent(ResultProvider <HistogramWithCounts> histogramResultProvider)
 {
     this.histogramResultProvider = histogramResultProvider;
 }
コード例 #18
0
 public NumericDistributionComponent(ResultProvider <NumericHistogramComponent.Result> histogramResultProvider)
 {
     this.histogramResultProvider = histogramResultProvider;
 }