예제 #1
0
        public DbMonitor(IAppBase app, bool isDbOnly = false)
        {
            App = app;

            _isDbOnly = isDbOnly;

            if (Core.Env.SystemConnectionStringSettings != null)
            {
                using (var conn = Core.Env.SystemConnectionStringSettings.GetDbConnection())
                {
                    InitStatusDatabase(conn);

                    var insertSql = "insert ignore into DotnetSpider.Status (`TaskId`,`Identity`, `NodeId`, `Logged`, `Status`, `Thread`, `Left`, `Success`, `Error`, `Total`, `AvgDownloadSpeed`, `AvgProcessorSpeed`, `AvgPipelineSpeed`) values (@TaskId,@Identity, @NodeId, current_timestamp, @Status, @Thread, @Left, @Success, @Error, @Total, @AvgDownloadSpeed, @AvgProcessorSpeed, @AvgPipelineSpeed);";
                    conn.MyExecute(insertSql,
                                   new
                    {
                        TaskId            = App.TaskId,
                        Identity          = App.Identity,
                        NodeId            = NodeId.Id,
                        Status            = "INIT",
                        Left              = 0,
                        Total             = 0,
                        Success           = 0,
                        Error             = 0,
                        AvgDownloadSpeed  = 0,
                        AvgProcessorSpeed = 0,
                        AvgPipelineSpeed  = 0,
                        Thread            = 0
                    });
                }
            }
        }
예제 #2
0
        private void AnimeDownload(argumentList args, int ti, Action <int, string> u)
        {
            VideoBase e = new VideoBase(args, ti, u);

            _base = e;
            e.BeginExecution();
            return;
        }
예제 #3
0
        public override string GetText(Chapter chp, HtmlDocument use, WebClient wc)
        {
            wc.Headers = IAppBase.GenerateHeaders(chp.chapterLink.Host);
            string dwnld = wc.DownloadString(chp.chapterLink);

            use.LoadHtml(dwnld);
            GC.Collect();
            return(use.DocumentNode.FindAllNodes().GetFirstElementByClassNameA("chp_raw").InnerText);
        }
예제 #4
0
 public HomeController(UserManager <ApplicationUser> userManager,
                       SignInManager <ApplicationUser> signInManager,
                       IConfiguration configuration,
                       IAppBase <User, UserDTO> app,
                       ApplicationDbContext contexto, IMapper mapper)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _configuration = configuration;
     this.app       = app;
     _contexto      = contexto;
     _iMapper       = mapper;
 }
예제 #5
0
        public static bool StartAllApps()
        {
            List <ContainerRegistration> regs = _theContainer.Registrations.Where(reg => reg.Name != null && reg.Name.StartsWith("App")).ToList();

            foreach (var reg in regs)
            {
                IAppBase appBase = _theContainer.Resolve <IAppBase>(reg.Name);

                appBase.Start();
            }

            return(true);
        }
예제 #6
0
        public override string GetText(Chapter chp, HtmlDocument use, WebClient wc)
        {
            HtmlNodeCollection b;
            StringBuilder      sb = new StringBuilder();

            // Git controls in visual studio are f*****g horrible, and I had to rewrite this TWICE. Only if Git Bash wasn't being deprecated...
            wc.Headers = IAppBase.GenerateHeaders(chp.chapterLink.Host);
            string dwnld;

            Retry :;
            try
            {
                dwnld = wc.DownloadString(chp.chapterLink);
            }
            catch
            {
                goto Retry;
            }
            use.LoadHtml(dwnld);
            b = use.DocumentNode.SelectNodes("//div[contains(@class, 'chapter-c')]");

            HtmlNode[] scripts = b[0].DescendantNodes().Where(x => x.XPath.Contains("/script")).ToArray();

            foreach (HtmlNode n in scripts)
            {
                n.RemoveAll();
            }

            use.LoadHtml(b[0].InnerHtml);

            b = use.DocumentNode.SelectNodes("//text()[normalize-space(.) != '']");

            foreach (HtmlNode htmln in b)
            {
                sb.AppendLine(htmln.InnerText + "\n");
            }

            GC.Collect();
            return(HttpUtility.HtmlDecode(sb.ToString()));
        }
예제 #7
0
        static void ListenerCallback(IAsyncResult result)
        {
            HttpRequestContext = listener.EndGetContext(result);
            string[] urlParamStr = new string[0];

            //HttpRequestContext.Response.StatusCode = 200;
            //HttpRequestContext.Response.StatusDescription = "OK";

            string url = HttpRequestContext.Request.Url.ToString();

            appUrl = url.Replace(baseUrl, string.Empty);

            IAppBase theApp = RequestFilter.DoMapping(appUrl);

            if (theApp == default(AppBase))
            {
                return;
            }

            urlParamStr = new string[1];

            urlParamStr[0] = appUrl;


            string appResponseStr = theApp.HandleRequest(urlParamStr);

            var buffer = System.Text.Encoding.UTF8.GetBytes(appResponseStr);

            HttpRequestContext.Response.ContentLength64 = buffer.Length;

            var output = HttpRequestContext.Response.OutputStream;

            output.Write(buffer, 0, buffer.Length);

            output.Close();

            HttpRequestContext.Response.Close();

            return;
        }
예제 #8
0
        static void MainServer()
        {
            //Server Root Folder
            //String sMyWebServerRoot = "C:\\WebServerRoot\\";

            Console.WriteLine("Server");
            listener = new HttpListener();
            listener.Prefixes.Add(baseUrl);
            listener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;

            listener.Start();


            AppLifecycleManager.RegisterApp <IAppBase, AppFibonacci>("AppFibonacci");
            AppLifecycleManager.RegisterApp <IAppBase, AppTextFileReader>("AppTextFileReader");
            AppLifecycleManager.RegisterApp <IAppBase, AppIndex>("AppIndex");
            AppLifecycleManager.RegisterApp <IAppBase, AppNotFound>("AppNotFound");

            IAppBase appfin = AppLifecycleManager.Resolve <IAppBase>("AppFibonacci");

            appfin.Start();

            IAppBase apptex = AppLifecycleManager.Resolve <IAppBase>("AppTextFileReader");

            apptex.Start();

            IAppBase appindex = AppLifecycleManager.Resolve <IAppBase>("AppIndex");
            //appindex.Start();

            IAppBase apperror = AppLifecycleManager.Resolve <IAppBase>("AppNotFound");

            apperror.Start();

            while (true)
            {
                ProcessRequest();
            }
        }
예제 #9
0
 public HttpMonitor(IAppBase app)
 {
     App = app;
 }
 public BaseController(IAppBase <Entidade, EntidadeDTO> appBase)
 {
     _appBase = appBase;
 }
예제 #11
0
 public ReportController(
     IAppBase <Report, ReportDTO> app,
     IReportApp reportApp) : base(app)
 {
     _reportApp = reportApp;
 }
예제 #12
0
 public ClientesController(IAppBase <Client, ClienteDTO> app) : base(app)
 {
 }
예제 #13
0
 public ControllerBase(IAppBase <Entidade, EntidadeDTO> app)
 {
     _app = app;
 }
예제 #14
0
 public ControllerBase(IAppBase <Entity, EntityDTO> app)
 {
     this.app = app;
 }
예제 #15
0
 public UserController(IAppBase <User, UserDTO> app) : base(app)
 {
 }
예제 #16
0
 public ControllerBaseController(IAppBase <Entidade, EntidadeDTO> app)
 {
     this.app = app;
 }
예제 #17
0
 public Base(IAppBase <Entidade, EntidadeDTO> app)
 {
     this.app = app;
 }