Esempio n. 1
0
        public void RefreshVisualZoneData()
        {
            try
            {
                VisualPanel.Refresh();
                if (!DataZoneKeepEmpty)
                {
                    Graphics g             = VisualPanel.CreateGraphics();
                    int[]    bytes_indexes = DataMaster.GetBytesStartEndIndexes(mVisualZone.StartRowNumber, mVisualZone.StartRowNumber + mVisualZone.VisualRowsAmount - 1);
                    mVisualZone.DrawVisualZone(ref g, mDataMaster.PickOutVisualBytes(bytes_indexes));
                }

                ReDrawBlockAddress();
                RefreshScrollBarValues();
                DataZoneKeepEmpty = false;
            }
            catch
            {
            }
        }
Esempio n. 2
0
        private void getBaseDataForSelectedRow(int inRowNumber)
        {
            try
            {
                IsInitializeEditText = true;

                int[]        indexes = DataMaster.GetBytesStartEndIndexes(inRowNumber, inRowNumber);
                VisualByte[] bytes   = mDataMaster.PickOutVisualBytes(indexes);
                byte[]       datas   = new byte[bytes.Length];
                LastEditBytesAmount = datas.Length;
                bool isContain87 = false;
                for (int i = 0; i < bytes.Length; i++)
                {
                    datas[i] = bytes[i].ByteValue;

                    if (datas[i] == DataMaster.DEFAULT_NULL_BYTE_ANOTHER_BYTE)
                    {
                        isContain87 = true;
                    }
                }
                mRawEditTextBoxBytes = datas;
                switch (mVisualZone.CurrentDataFormat)
                {
                case VisualZone.DataFormat.ASCII:
                    string text = ConvertBytesToString(datas);
                    if (!isContain87)
                    {
                        if (EditeTextBox.Text != text)
                        {
                            EditeTextBox.Text = text;
                        }
                        else
                        {
                            IsInitializeEditText = false;
                        }
                        EditeTextBox.SelectionStart = selectedIndex;
                    }
                    else
                    {
                        EditeTextBox.Visible = false;
                        RefreshVisualZoneData();
                        mWarningForm.Visible = true;
                    }
                    break;

                case VisualZone.DataFormat.HEX:
                    text = "";
                    for (int i = 0; i < datas.Length; i++)
                    {
                        byte[] oneByte = new byte[1] {
                            datas[i]
                        };
                        if (i != datas.Length - 1)
                        {
                            text += BitConverter.ToString(oneByte) + "  ";
                        }
                        else
                        {
                            text += BitConverter.ToString(oneByte);
                        }
                    }
                    if (EditeTextBox.Text != text)
                    {
                        EditeTextBox.Text = text;
                    }
                    else
                    {
                        EditeTextBox.Text = text + " ";
                    }
                    break;

                case VisualZone.DataFormat.DEC:
                    text = "";
                    for (int i = 0; i < datas.Length; i++)
                    {
                        if (i != datas.Length - 1)
                        {
                            text += datas[i].ToString("d3") + " ";
                        }
                        else
                        {
                            text += datas[i].ToString("d3");
                        }
                    }

                    if (EditeTextBox.Text != text)
                    {
                        EditeTextBox.Text = text;
                    }
                    else
                    {
                        EditeTextBox.Text = text + " ";
                    }
                    break;
                }
            }
            catch
            {
            }
        }