Esempio n. 1
0
        public void ScanHost()
        {
            var scan   = new CodeScaner(ViewActivity, "添加主机");
            var invoke = scan.Invoke((result) => {
                var model = ActiveContext.HostExpress.GetServiceDefine(result);
                if (model != null)
                {
                    ActiveContext.HostStore.Save(model);
                }
            });

            Task.WaitAll(invoke);
        }
Esempio n. 2
0
        void ScanClick()
        {
            //var intent = new Intent(this, typeof(ScanerActivity));
            //StartActivity(intent);

            var scan   = new CodeScaner(this, "添加主机");
            var invoke = scan.Invoke((result) => {
                var model = ActiveContext.HostExpress.GetServiceDefine(result);
                if (model != null)
                {
                    ActiveContext.HostStore.Save(model);
                }
            });

            Task.WaitAll(invoke);
        }
Esempio n. 3
0
        public void Execute(TaskContext context, TaskAction action)
        {
            if (action.Items == null || action.Items.Length == 0)
            {
                action.Items = context.JobOption.CodePath;
            }

            if (action.Items == null || action.Items.Length == 0)
            {
                return;
            }

            TotalResult            totalResult = context.TotalResult;
            List <CodeCheckResult> resultList  = new List <CodeCheckResult>();

            try {
                foreach (string path in action.Items)
                {
                    CodeScaner scaner = new CodeScaner();
                    scaner.ExcludePaths = LoadExcludePaths(path);
                    List <CodeCheckResult> list = scaner.Execute(context.Branch, path);
                    resultList.AddRange(list);
                }


                // 过滤前端代码的检查结果
                totalResult.JsCodeCheckResults.AddRange(
                    (from x in resultList
                     where x.FileName.EndsWith(".js", StringComparison.OrdinalIgnoreCase)
                     select x).ToList());

                // 过滤服务端代码的检查结果
                totalResult.CsCodeCheckResults.AddRange(
                    (from x in resultList
                     where x.FileName.EndsWith(".js", StringComparison.OrdinalIgnoreCase) == false
                     select x).ToList());

                context.ConsoleWrite("CodeScanTask OK");
            }
            catch (Exception ex) {
                totalResult.CodeCheckException = ex.ToString();
                context.ProcessException(ex);
            }
        }