Exemple #1
0
        private void AddLineToPacketHeaderDataGridView(DataGridView dataGridView, DataGridViewRow row, PacketHeader header, string magic)
        {
            int counter = 3;

            foreach (var field in header.GetType().GetFields())
            {
                bool magicField = field.Name.Equals("h_magic", StringComparison.Ordinal);
                if (magicField)
                {
                    row.Cells[counter].Value = magic;
                }
                else
                {
                    string value = field.GetValue(header).ToString();
                    row.Cells[counter].Value = value;
                }
                counter++;
            }
            dataGridView.Rows.Add(row);
        }
Exemple #2
0
        private DataGridView PacketHeaderDataGridView(TabPage tabPage)
        {
            DataGridView dataGridView = new DataGridView();

            dataGridView.Location = new Point(0, 0);
            dataGridView.Size     = tabPage.Size;
            dataGridView.ReadOnly = true;
            dataGridView.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            dataGridView.Columns.Add("id", "id");
            dataGridView.Columns.Add("type", "type");
            dataGridView.Columns.Add("status", "status");

            PacketHeader header = new PacketHeader();

            foreach (var field in header.GetType().GetFields())
            {
                dataGridView.Columns.Add(field.Name, field.Name);
            }

            return(dataGridView);
        }