Example #1
0
        public void ImportFieldInfoError(FieldErrorInfoCollection errors)
        {
            TkDebug.AssertArgumentNull(errors, "errors", this);

            if (errors.Count == 0)
            {
                return;
            }
            var errorIndexes = from item in errors
                               orderby item.Position descending
                               group item by item.Position;

            foreach (var groupItem in errorIndexes)
            {
                DataRow row       = ImportTable.Rows[groupItem.Key];
                int     rowNumber = row[ROW_INDEX].Value <int>();
                foreach (var item in groupItem)
                {
                    AddErrorItem(rowNumber, item.NickName, item.Message);
                }
                DataRow errorRow = ErrorTable.NewRow();
                DataSetUtil.CopyRowByName(row, errorRow);
                ErrorTable.Rows.Add(errorRow);
                ImportTable.Rows.Remove(row);
            }
        }
Example #2
0
 private void AddError(Error[] Errors, string ScriptName, string Url, List <ResultField> resField)
 {
     foreach (var error in Errors)
     {
         var err =
             ctx.ErrorTables.FirstOrDefault(
                 er => er.Script == ScriptName && er.Field == error.Field && er.Corrected != true);
         if (err != null)
         {
             err.Counter = err.Counter + 1;
         }
         else
         {
             var field    = resField.FirstOrDefault(f => f.EngName == error.Field);
             var errorobj = new ErrorTable()
             {
                 TypeError     = -1,
                 Script        = ScriptName,
                 Url           = Url,
                 Field         = error.Field,
                 ValueScript   = error.Value,
                 DateException = DateTime.Now,
                 Counter       = 1
             };
             errorobj.TypeError = field != null && field.Important ? 0 : 5;
             if (errorobj.TypeError != -1)
             {
                 ctx.ErrorTables.Add(errorobj);
             }
         }
     }
 }
Example #3
0
        /// <summary>
        ///     Clears / deletes all relevant crawler information from Azure Storage upon command.
        ///     Sets the XML & URL Queue sizes to 0, clears the XML & URL Queues, and deletes
        ///     the URL Table and Error Table. URL and Error Tables must be reinitialized for crawler
        ///     to function again (handled in worker role).
        /// </summary>
        public void ClearAll()
        {
            TableOperation clearQueue =
                TableOperation.InsertOrReplace(new CrawlrQueueSize(0, 0));

            StatusTable.Execute(clearQueue);
            XmlQueue.Clear();
            UrlQueue.Clear();
            UrlTable.Delete();
            ErrorTable.Delete();
        }
Example #4
0
        public static CloudTable GetErrorTable()
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                System.Configuration.ConfigurationManager.AppSettings["StorageConnectionString"]);

            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            ErrorTable = tableClient.GetTableReference("errortable");
            ErrorTable.CreateIfNotExists();

            return(ErrorTable);
        }
Example #5
0
        private void gridControl13333_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView1.CalcHitInfo(new Point(e.X, e.Y));
                if (e.Button == MouseButtons.Left && e.Clicks == 2)//判断是否左键双击
                {
                    //判断光标是否在行范围内
                    if (hInfo.InRow)
                    {
                        if (this.checkBoxCheckMain.Checked)
                        {
                            string errorType = this.gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CHECKTYPE").ToString();
                            string idname    = this.gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "ID").ToString();
                            string TABLENAME = this.gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TABLENAME").ToString();


                            GridView   gridView = this.gridControlError.DefaultView as GridView;
                            ErrorTable table    = new ErrorTable();
                            DataTable  table2   = table.GetTable(idname);

                            DataRow[] dr = table2.Select("1=1");
                            //ESRI.ArcGIS.Geometry.IGeometry igo = (ESRI.ArcGIS.Geometry.IGeometry) dr[0]["Geometry"];
                            gridView.Columns.Clear();
                            for (int i = 0; i < table2.Columns.Count; i++)
                            {
                                GridColumn gridCol_FeatureID = new GridColumn();
                                gridCol_FeatureID.Caption   = table2.Columns[i].Caption;
                                gridCol_FeatureID.FieldName = table2.Columns[i].ColumnName;
                                gridCol_FeatureID.Name      = table2.Columns[i].ColumnName;
                                gridCol_FeatureID.Visible   = true;
                                gridView.Columns.Add(gridCol_FeatureID);
                            }
                            this.gridControlError.DataSource      = table2;
                            gridView.OptionsBehavior.Editable     = false;
                            gridView.OptionsSelection.MultiSelect = true;
                            gridView.ViewCaption    = "拓扑检查";
                            gridView.NewItemRowText = TABLENAME;
                            this.gridControlError.RefreshDataSource();
                        }
                        else
                        {
                            Console.WriteLine("未选中");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("MyException Throw:" + ex.Message);
            }
        }
Example #6
0
        /// <summary>
        /// Handler which enumerates issues for a Sonar project
        /// </summary>
        /// <param name="project">SonarQube project to query</param>
        /// <returns>Awaitable task which enumerates associated errors</returns>
        private async Task OnItemSelectAsync(SonarQubeProject project)
        {
            _projectPathsManager.TryGetValue(project.Key, out string projectLocalPath);

            IEnumerable <ErrorListItem> errors;

            try
            {
                errors = await _errorListProvider.GetErrorsAsync(project.Key, projectLocalPath);
            }
            catch
            {
                TeamExplorer.ShowNotification($"Failed to download issues for \"{project.Name}\".",
                                              NotificationType.Error, NotificationFlags.None, null, SonarErrorsNotificationId);

                return;
            }

            TeamExplorer.HideNotification(SonarErrorsNotificationId);

            if (errors.Any())
            {
                if (!Path.IsPathRooted(errors.First().FileName))
                {
                    TeamExplorer.ShowNotification("Unable to resolve local file path for issues. Make sure project local path is correctly configured.",
                                                  NotificationType.Warning, NotificationFlags.None, null, FilePathResolutionNotificationId);
                }
                else
                {
                    TeamExplorer.HideNotification(FilePathResolutionNotificationId);
                }
            }

            ErrorTable.CleanAllErrors();
            ErrorTable.AddErrors(project.Name, errors);

            _projectIssuesInView = project.Key;
        }
Example #7
0
        public MainWindow()
        {
            InitializeComponent();

            Loaded   += MainWindow_Loaded;
            Unloaded += MainWindow_Unloaded;

            _errorTable = new ErrorTable((s) =>
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    if (string.IsNullOrEmpty(s) == false)
                    {
                        this.error.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        this.error.Visibility = Visibility.Collapsed;
                    }
                    this.error.Text = s;
                }));
            });
        }
Example #8
0
        public void TestContainer_QaError(object sender, QaErrorEventArgs e)
        {
            esriGeometryType geomType;

            if (e.QaError.Geometry != null)
            {
                geomType = e.QaError.Geometry.GeometryType;
            }
            else
            {
                geomType = esriGeometryType.esriGeometryNull;
            }

            ErrorTable errorTable;

            if (!_errorTables.TryGetValue(geomType, out errorTable))
            {
                errorTable = new ErrorTable(_ws, geomType.ToString(), geomType);
                _errorTables.Add(geomType, errorTable);
            }

            errorTable.Add(e.QaError);
        }
Example #9
0
        private void FindError(ResultField field, object nedvigimost, string ScriptName, string Url)
        {
            var        val   = nedvigimost.GetPropValue(field.EngName);
            ErrorTable error = new ErrorTable()
            {
                TypeError = 3, Script = ScriptName, Url = Url, Field = field.Name, ValueScript = "", DateException = DateTime.Now, Counter = 1
            };

            error.TypeError = -1;
            switch (field.Type)
            {
            case "Целое число":
                if (val == null)
                {
                    error.TypeError = field.Important? 1: 3;
                }
                else
                {
                    var valInt = (int)val;
                    if (valInt == -10000001)
                    {
                        error.TypeError = field.Important ? 6 : 2;
                    }
                }
                break;

            case "Число с плавающей точкой":
                if (val == null)
                {
                    error.TypeError = field.Important ? 1 : 3;
                }
                else
                {
                    var valDouble = (double)nedvigimost.GetPropValue(field.EngName);

                    if (Math.Abs(valDouble - (-10000001.0)) == 0)
                    {
                        error.TypeError = field.Important ? 6 : 2;
                    }
                }

                break;

            case "Строка":
                if (val == null)
                {
                    val = "";
                }
                var reg = new Regex("[a-zA-Z0-9_а-яА-Я]+");
                if (reg.Matches(val.ToString()).Count > 1)
                {
                    error = (new ErrorTable()
                    {
                        TypeError = 4,
                        Script = ScriptName,
                        Url = Url,
                        Field = field.Name,
                        ValueScript = "",
                        DateException = DateTime.Now, Counter = 1
                    });
                }
                break;

            case "Дата время":
                if (val == null)
                {
                    error.TypeError = field.Important ? 1 : 3;
                }
                var date = DateTime.MinValue;
                DateTime.TryParse(nedvigimost.GetPropValue(field.EngName)?.ToString(), out date);
                if (date == DateTime.MinValue)
                {
                    error.TypeError = field.Important ? 6 : 2;
                }
                break;

            case "URL":
                break;
            }
            if (error.TypeError != -1)
            {
                var err = ctx.ErrorTables.FirstOrDefault(
                    s => s.Script == error.Script && s.Field == error.Field &&
                    !s.Corrected && s.TypeError == error.TypeError);
                if (err != null)
                {
                    err.Counter = err.Counter + 1;
                }
                else
                {
                    ctx.ErrorTables.Add(error);
                }
            }
        }
Example #10
0
 public void Dispose()
 {
     ImportDataSet.DisposeObject();
     ErrorTable.DisposeObject();
 }
Example #11
0
        public void Run()
        {
            ReadLine.HistoryEnabled        = true;
            ReadLine.AutoCompletionHandler = new AutoCompletionHandler();

            bool ishexMode = false;

            while (true)
            {
                string prefix = ishexMode ? "hex" : "asm";

                var input = ReadLine.Read(prefix + "> ");

                if (ReplCommand.IsCommand(input))
                {
                    var cmd = ReplCommand.Parse(input);
                    switch (cmd.Name)
                    {
                    case "mode":
                        var arg = cmd.Args.First();
                        if (arg == "asm")
                        {
                            ishexMode = false;
                        }
                        else if (arg == "hex")
                        {
                            ishexMode = true;
                        }
                        else
                        {
                            Console.WriteLine($"mode '{arg}' not recognized");
                        }

                        break;

                    case "register":
                        Utils.PrintRegisters(vm.Register);

                        break;

                    case "clear":
                        Console.Clear();
                        break;

                    case "explain":
                        if (cmd.Args.Length == 1)
                        {
                            var errorcodeStr = cmd.Args.First();

                            Console.WriteLine(ErrorTable.GetExplanation(int.Parse(errorcodeStr)));
                        }
                        else
                        {
                            Console.WriteLine("Please specifiy an errorcode");
                        }
                        break;

                    default:
                        Console.WriteLine($"Command '{cmd.Name}' not found");
                        break;
                    }
                }
                else
                {
                    if (ishexMode)
                    {
                        var prog   = ParseHex(input);
                        var reader = new VmReader(prog, vm);
                        vm.RunInstructionLine(reader);
                    }
                    else
                    {
                        var src    = AssemblySource.Parse(input);
                        var writer = new VmWriter();

                        foreach (var line in src.Lines)
                        {
                            writer.Write(line.Opcode);

                            foreach (var operand in line.Operands)
                            {
                                writer.Write(operand);
                            }
                        }

                        vm.Run(writer);

                        vm.Register[Registers.IPR] = 0;
                    }
                }
            }
        }