예제 #1
0
        /// <summary>
        /// First initializes the method on the object and then findes the processor from the object
        /// </summary>
        public virtual DebugProcessor InitializeDebugProcessor(CoreProcessor processor)
        {
            var getMethod      = typeof(CoreProcessor).GetMethod("GetMethod", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(object[]) }, null);
            var pipelineMethod = getMethod.Invoke(processor, new object[] { new object[] { new PipelineArgs() } }) as PipelineMethod;

            return(GetPipelineMethodProcessor(pipelineMethod) as DebugProcessor);
        }
예제 #2
0
        public virtual PipelineWrapper AddDebugProcessor(string group, string name, int index)
        {
            //Create a core processor
            var config        = BaseFactory.GetConfigNode("pipelines/pipelineDebug/processor");
            var coreProcessor = new CoreProcessor();

            coreProcessor.Initialize(config);

            //Initialize it so we can add settings
            var debugProcessor = ReflectionService.InitializeDebugProcessor(coreProcessor);

            debugProcessor.PipelineGroup = group;
            debugProcessor.PipelineName  = name;
            debugProcessor.PipelineIndex = index;
            debugProcessor.Taxonomies    = SettingsService.DefaultTaxonomies;

            //Add it to our simple pipeline
            var pipeline           = GetPipeline(group, name);
            var processorReference = new ProcessorWrapper(coreProcessor, pipeline, debugProcessor);

            pipeline.Processors.Insert(index, processorReference);
            ProcessorMap.Add(debugProcessor.Id, processorReference);

            //Set the result as the active processors
            ReflectionService.SetProcessors(pipeline.CorePipeline, pipeline.Processors.Select(wrapper => wrapper.CoreProcessor).ToArray());
            RefreshProcessorIndexes(pipeline);

            return(pipeline);
        }
예제 #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbInput.Text))
            {
                lblError.Text = Constant.EMPTY_INPUT;
                return;
            }

            try
            {
                BaseAnalyser analyser;
                switch (rbTextMode.SelectedIndex)
                {
                case (int)TextMode.Text:
                    analyser = new TextAnalyser(tbInput.Text, tbStopWords.Text, cbIsFilterStopWords.Checked, cbIsCalculateOccuranceInText.Checked, cbIsCalculateOccuranceInMetaTag.Checked, cbIsCalculateExternalLink.Checked);
                    break;

                case (int)TextMode.URL:
                    analyser = new URLAnalyser(tbInput.Text, tbStopWords.Text, cbIsFilterStopWords.Checked, cbIsCalculateOccuranceInText.Checked, cbIsCalculateOccuranceInMetaTag.Checked, cbIsCalculateExternalLink.Checked);
                    break;

                default:
                    throw new KeyNotFoundException();
                }

                CoreProcessor cp = new CoreProcessor();
                cp.AnalyzeData(analyser, out Dictionary <string, int> occuranceInTextDictionary, out Dictionary <string, int> occuranceInMetaTagDictionary, out Dictionary <string, int> ExternalLinkDictionary);

                GridView gv = new GridView();

                if (cbIsCalculateOccuranceInText.Checked)
                {
                    gv = gvOccuranceInText;
                    CreateGridView(occuranceInTextDictionary, gv);
                    lblWordResult.Text = $"Each Word In Text";
                }

                if (cbIsCalculateOccuranceInMetaTag.Checked)
                {
                    gv = gvOccuranceInMetaTag;
                    CreateGridView(occuranceInMetaTagDictionary, gv);
                    lblTagResult.Text = $"Each Word Listed In Meta Tag";
                }

                if (cbIsCalculateExternalLink.Checked)
                {
                    gv = gvExternalLink;
                    CreateGridView(ExternalLinkDictionary, gv);
                    lblExternalLinkCount.Text = $"Unique/Total External Link In Text : {ExternalLinkDictionary?.Count}/{ExternalLinkDictionary?.Sum(x => x.Value)}";
                }
            }
            catch (UriFormatException ex)
            {
                lblError.Text = Constant.INVALID_URI_FORMAT;
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
예제 #4
0
        public frmIbetSboBrokerHigher()
        {
            InitializeComponent();

            //var newPoint = 126.Round(50);

            CoreProcessor.InitConfig();
            SystemConfig.TIME_GET_UPDATE_LIVE_IBET   = 11000;
            SystemConfig.TIME_GET_UPDATE_LIVE_SBOBET = 10000;

            BrokerData.ScanIbetUsername = "******";
            BrokerData.ScanIbetPassword = "******";
            BrokerData.ScanIbetDomain   = "http://www.88cado.com/";
            BrokerData.ScanSboUsername  = "******";
            BrokerData.ScanSboPassword  = "******";
            BrokerData.ScanSboDomain    = "http://www.currybread.com/";

            if (!this.IsHandleCreated)
            {
                this.CreateHandle();
            }

            BrokerHigherControl ibetSbo = new BrokerHigherControl();

            ibetSbo.Dock = DockStyle.Fill;
            this.Controls.Add(ibetSbo);
        }
    /// <summary>
    /// Processes this instance.
    /// </summary>
    /// <param name="pipelineArgs">The pipeline args.</param>
    public void Process(PipelineArgs pipelineArgs)
    {
      CoreProcessor processor = new CoreProcessor();
      bool isFakeProcessor = string.IsNullOrEmpty(this.processorDefinition.Type) && string.IsNullOrEmpty(this.processorDefinition.TypeReference);

      if (!isFakeProcessor)
      {
        XmlDocument medium = new XmlDocument();

        using (XmlReader reader = this.processorDefinition.ProcessorElement.CreateReader())
        {
          medium.Load(reader);
        }

        processor.Initialize(medium.DocumentElement);
      }

      EventHandler<RuntimeProcessorCallEventArgs> beforePipelineCalled = BeforePipelineProcessorCalled;
      if (beforePipelineCalled != null)
      {
        beforePipelineCalled(this, new RuntimeProcessorCallEventArgs(this.pipelineName, this.pipelineDomain, this.processorIndex, this.processorDefinition, pipelineArgs));
      }

      if (!isFakeProcessor)
      {
        processor.Invoke(new object[] { pipelineArgs });
      }

      EventHandler<RuntimeProcessorCallEventArgs> afterPipelineCalled = AfterPipelineProcessorCalled;
      if (afterPipelineCalled != null)
      {
        afterPipelineCalled(this, new RuntimeProcessorCallEventArgs(this.pipelineName, this.pipelineDomain, this.processorIndex, this.processorDefinition, pipelineArgs));
      }
    }
예제 #6
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     CoreProcessor.Init();
     Application.Run(new frmLogin());
 }
예제 #7
0
 private void btnStartService_Click(object sender, EventArgs e)
 {
     CoreProcessor.InitConfig();
     if (oSvc == null || oSvc.State != CommunicationState.Opened)
     {
         oSvc = new ServiceHost(typeof(BcService));
         oSvc.Open();
     }
 }
예제 #8
0
        static void Main()
        {
            //Application.ThreadException += ApplicationThreadException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CoreProcessor.InitConfig();
            Application.Run(new frmLoginFull());
        }
예제 #9
0
        public frmIbetSboBroker(string user, IBcManageService service, ScanInfoDTO betConfigSbo, ScanInfoDTO betConfigIbet)
        {
            //if (DateTime.Now > new DateTime(2015, 11, 20))
            //{
            //    MessageBox.Show("EX12301: Lỗi parse data!");
            //    return;
            //}

            InitializeComponent();
            CoreProcessor.InitConfig();
            SystemConfig.TIME_GET_UPDATE_LIVE_IBET   = 11000;
            SystemConfig.TIME_GET_UPDATE_LIVE_SBOBET = 10000;

            BrokerData.IbetScanServers = betConfigIbet.ScanServers;
            BrokerData.IbetAccounts    = betConfigIbet.Accounts;
            BrokerData.SboScanServers  = betConfigSbo.ScanServers;
            BrokerData.SboAccounts     = betConfigSbo.Accounts;

            Random r          = new Random();
            var    ibetAcc    = betConfigIbet.Accounts[r.Next(betConfigIbet.Accounts.Count)];
            var    ibetServer = betConfigIbet.ScanServers[r.Next(betConfigIbet.ScanServers.Count)];
            var    sboAcc     = betConfigSbo.Accounts[r.Next(betConfigSbo.Accounts.Count)];
            var    sboServer  = betConfigSbo.ScanServers[r.Next(betConfigSbo.ScanServers.Count)];

            BrokerData.ScanIbetUsername = ibetAcc.Username;
            BrokerData.ScanIbetPassword = ibetAcc.Password;
            BrokerData.ScanIbetDomain   = ibetServer;
            BrokerData.ScanSboUsername  = sboAcc.Username;
            BrokerData.ScanSboPassword  = sboAcc.Password;
            BrokerData.ScanSboDomain    = sboServer;

            this.Text = string.Concat("BcBroker - ", user, " © Copyright 2015");

            if (!this.IsHandleCreated)
            {
                this.CreateHandle();
            }

            BrokerControl ibetSbo = new BrokerControl();

            ibetSbo.Dock = DockStyle.Fill;
            this.Controls.Add(ibetSbo);

            _manageService = service;
            _manageService.PingBet(SelfInfo.Username, SelfInfo.MacAddress, 10);

            timerPing          = new System.Timers.Timer(60000);
            timerPing.Elapsed += PingManage;
            timerPing.Start();
        }
예제 #10
0
        public AccountConfig(BetTabControl betTabControl, BcWin bcWin)
        {
            InitializeComponent();
            ID = Guid.NewGuid();

            _betTabControl = betTabControl;
            _bcWin         = bcWin;

            CoreProcessor.InitConfig();

            cboIBetDomain.DataSource = EngineHelper.GetIbetServers();
            cboSboDomain.DataSource  = EngineHelper.GetSboServers();

            cboCompareValue.SelectedIndex = 0;
        }
예제 #11
0
        public frmSboBet(string user, IBcManageService service, ScanInfoDTO betConfig, bool debug = false)
        {
            InitializeComponent();
            this.btnLoginBuyGroup.Image  = Properties.Resources.LoginGroup;
            this.btnLoginSellGroup.Image = Properties.Resources.LoginGroup;
            this.btnSaveExchange.Image   = BcBetRun.Properties.Resources.SaveBmp;
            this.btnSaveExchange2.Image  = BcBetRun.Properties.Resources.SaveBmp;

            cboMarket.SelectedIndex = 0;

            InitConfigSaved();

            this.Text = string.Concat("BetRunDown - ", user, " © Copyright 2015");

            CoreProcessor.InitConfig();

            sboScan.UpdateLiveDataChange    += sboScan_UpdateLiveDataChange;
            sboScan.UpdateNonLiveDataChange += sboScan_UpdateLiveDataChange;
            sboScan.OnExceptionEvent        += sboScan_OnExceptionEvent;

            if (!debug)
            {
                _manageService = service;

                DataContainer.SboScanServers = betConfig.ScanServers;

                _manageService.PingBet(SelfInfo.Username, SelfInfo.MacAddress, 10);

                timerPing          = new System.Timers.Timer(60000);
                timerPing.Elapsed += PingManage;
                timerPing.Start();
            }
            else
            {
                DataContainer.SboScanServers = new List <string>()
                {
                    "http://www.currybread.com/",
                    "http://www.beer000.com/",
                    "http://www.beer777.com/",
                    "http://www.harybox.com/",
                    "http://www.pic5678.com/"
                };
            }
        }
예제 #12
0
        public frmIbetSboBrokerHigher(string user)
        {
            //if (DateTime.Now > new DateTime(2015, 11, 20))
            //{
            //    MessageBox.Show("EX12301: Lỗi parse data!");
            //    return;
            //}

            InitializeComponent();
            CoreProcessor.InitConfig();
            SystemConfig.TIME_GET_UPDATE_LIVE_IBET   = 11000;
            SystemConfig.TIME_GET_UPDATE_LIVE_SBOBET = 10000;

            //BrokerData.IbetScanServers = betConfigIbet.ScanServers;
            //BrokerData.IbetAccounts = betConfigIbet.Accounts;
            //BrokerData.SboScanServers = betConfigSbo.ScanServers;
            //BrokerData.SboAccounts = betConfigSbo.Accounts;

            //Random r = new Random();
            //var ibetAcc = betConfigIbet.Accounts[r.Next(betConfigIbet.Accounts.Count)];
            //var ibetServer = betConfigIbet.ScanServers[r.Next(betConfigIbet.ScanServers.Count)];
            //var sboAcc = betConfigSbo.Accounts[r.Next(betConfigSbo.Accounts.Count)];
            //var sboServer = betConfigSbo.ScanServers[r.Next(betConfigSbo.ScanServers.Count)];

            //BrokerData.ScanIbetUsername = ibetAcc.Username;
            //BrokerData.ScanIbetPassword = ibetAcc.Password;
            //BrokerData.ScanIbetDomain = ibetServer;
            //BrokerData.ScanSboUsername = sboAcc.Username;
            //BrokerData.ScanSboPassword = sboAcc.Password;
            //BrokerData.ScanSboDomain = sboServer;

            this.Text = string.Concat("BcBroker - ", user, " © Copyright 2015");

            if (!this.IsHandleCreated)
            {
                this.CreateHandle();
            }

            BrokerHigherControl ibetSbo = new BrokerHigherControl();

            ibetSbo.Dock = DockStyle.Fill;
            this.Controls.Add(ibetSbo);
        }
예제 #13
0
        public virtual Type GetProcessorType(CoreProcessor processor)
        {
            if (processor == null)
            {
                return(null);
            }

            //if it's already initialized we can get it from method
            var method = GetCoreProcessorMethod(processor);

            if (method != null)
            {
                return(GetPipelineMethodProcessor(method).GetType());
            }
            //otherwise we create an object from config
            else
            {
                var config          = GetProcessorConfig(processor);
                var processorObject = GetProcessorObject(config);
                return(processorObject.Object.GetType());
            }
        }
        /// <summary>
        /// Processes this instance.
        /// </summary>
        /// <param name="pipelineArgs">The pipeline args.</param>
        public void Process(PipelineArgs pipelineArgs)
        {
            CoreProcessor processor       = new CoreProcessor();
            bool          isFakeProcessor = string.IsNullOrEmpty(this.processorDefinition.Type) && string.IsNullOrEmpty(this.processorDefinition.TypeReference);

            if (!isFakeProcessor)
            {
                XmlDocument medium = new XmlDocument();

                using (XmlReader reader = this.processorDefinition.ProcessorElement.CreateReader())
                {
                    medium.Load(reader);
                }

                processor.Initialize(medium.DocumentElement);
            }

            EventHandler <RuntimeProcessorCallEventArgs> beforePipelineCalled = BeforePipelineProcessorCalled;

            if (beforePipelineCalled != null)
            {
                beforePipelineCalled(this, new RuntimeProcessorCallEventArgs(this.pipelineName, this.pipelineDomain, this.processorIndex, this.processorDefinition, pipelineArgs));
            }

            if (!isFakeProcessor)
            {
                processor.Invoke(new object[] { pipelineArgs });
            }

            EventHandler <RuntimeProcessorCallEventArgs> afterPipelineCalled = AfterPipelineProcessorCalled;

            if (afterPipelineCalled != null)
            {
                afterPipelineCalled(this, new RuntimeProcessorCallEventArgs(this.pipelineName, this.pipelineDomain, this.processorIndex, this.processorDefinition, pipelineArgs));
            }
        }
예제 #15
0
 public Form2()
 {
     InitializeComponent();
     CoreProcessor.InitConfig();
 }
예제 #16
0
 protected virtual XmlNode GetProcessorConfig(CoreProcessor processor)
 {
     return(typeof(CoreProcessor).GetField("_configNode", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(processor) as XmlNode);
 }
예제 #17
0
 public virtual PipelineMethod GetCoreProcessorMethod(CoreProcessor processor)
 {
     return(typeof(CoreProcessor).GetField("_method", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(processor) as PipelineMethod);
 }
예제 #18
0
 public ProcessorWrapper(CoreProcessor coreProcessor, PipelineWrapper pipeline, DebugProcessor debugProcessor = null)
 {
     CoreProcessor  = coreProcessor;
     Pipeline       = pipeline;
     DebugProcessor = debugProcessor;
 }