Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Created,Email,Action")] Logitem logitem)
        {
            if (id != logitem.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(logitem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LogitemExists(logitem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(logitem));
        }
Exemple #2
0
        public static void Analysis() //启动日志分析得到编译日志
        {
            string rawLogtxt = File.ReadAllText(MASM_SCAU.configs.AppMainSettings.Default.CompilerPath + @"\System32\LOG.LOG");

            string[] rawLines = rawLogtxt.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            //
            Errors = 0;
            Warns  = 0;
            infoLines.Clear();
            lstLines.Clear();
            //
            foreach (string iline in rawLines)
            {
                infoLines.Add(iline);
                if (iline.Contains("App.asm("))
                {
                    infoLines.Add(iline);
                    Logitem logitem = new Logitem();
                    try
                    {
                        string[] infoArr = iline.Split(new string[] { "App.asm(", "): ", ": " }, StringSplitOptions.RemoveEmptyEntries);
                        logitem.lineNumber = infoArr[0];

                        logitem.content = infoArr[2];
                        logitem.content = Translate(logitem.content); //假如连接了网络,调用翻译
                                                                      //Console.Write(Translate(logitem.content));
                        if (infoArr[1].Contains("error"))             //假如是错误类型
                        {
                            logitem.type = "Error";
                            logitem.code = infoArr[1].Replace("error ", "");
                        }
                        else//假如是警告类型
                        {
                            logitem.type = "warning";
                            logitem.code = infoArr[1].Replace("warning ", "");
                        }
                        lstLines.Add(logitem);
                    }
                    catch (Exception _e)
                    {
                        logitem.content    = "你输入的中文好毒噢,我内存爆了";
                        logitem.type       = "Error";
                        logitem.lineNumber = "?";
                    }
                }
                else if (iline.Contains("Warning Errors"))
                {
                    string err_tmp = iline.Replace(" ", "");
                    err_tmp = err_tmp.Replace("WarningErrors", "");
                    Warns   = Convert.ToInt32(err_tmp);
                }
                else if (iline.Contains("Severe  Errors"))
                {
                    string err_tmp = iline.Replace(" ", "");
                    err_tmp = err_tmp.Replace("SevereErrors", "");
                    Errors  = Convert.ToInt32(err_tmp);
                }
            }
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Id,Created,Email,Action")] Logitem logitem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(logitem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(logitem));
        }
Exemple #4
0
        public delegate void LogUpdate(); //委托针

        public void LogUpdateWindow()     //被委托执行的函数
        {
            compilerConfigListView.Items.Clear();
            List <Logitem> lines = LogAnalysis.getResult();

            //此处有BUG,多线程操作日志分析集合会出现死锁,当用户频繁点击运行按钮的时候会发生,解决办法未定
            Label_Errors.Text = LogAnalysis.getErrorSum().ToString();
            Label_warn.Text   = LogAnalysis.getWarnSum().ToString();
            lock (lines)
            {
                for (int i = 0; i < lines.Count; i++)
                {
                    Logitem      ilog   = lines[i];
                    ListViewItem newOne = compilerConfigListView.Items.Add(ilog.lineNumber);
                    newOne.SubItems.Add(ilog.type);
                    newOne.SubItems.Add(ilog.content);
                    newOne.SubItems.Add(ilog.code);
                }
            }
        }