Beispiel #1
0
        private void tv1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode t = e.Node;

            if (t != null && t.Name != "")
            {
                int       n   = Convert.ToInt32(t.Name);
                Blaze.Tdf tdf = inlist[n];
                string    s;
                switch (tdf.Type)
                {
                case 0:
                    Blaze.TdfInteger ti = (Blaze.TdfInteger)tdf;
                    rtb2.Text = "0x" + ti.Value.ToString("X");
                    if (ti.Label == "IP  ")
                    {
                        rtb2.Text += Environment.NewLine + "(" + Blaze.GetStringFromIP(ti.Value) + ")";
                    }
                    break;

                case 1:
                    rtb2.Text = ((Blaze.TdfString)tdf).Value.ToString();
                    break;

                case 2:
                    rtb2.Text  = "Length: " + ((Blaze.TdfBlob)tdf).Data.Length.ToString();
                    rtb2.Text += Environment.NewLine + Blaze.HexDump(((Blaze.TdfBlob)tdf).Data);
                    break;

                case 4:
                    Blaze.TdfList l = (Blaze.TdfList)tdf;
                    s = "";
                    for (int i = 0; i < l.Count; i++)
                    {
                        switch (l.SubType)
                        {
                        case 0:
                            s += "{" + ((List <long>)l.List)[i] + "} ";
                            break;

                        case 1:
                            s += "{" + ((List <string>)l.List)[i] + "} ";
                            break;

                        case 9:
                            Blaze.TrippleVal t2 = ((List <Blaze.TrippleVal>)l.List)[i];
                            s += "{" + t2.v1.ToString("X") + "; " + t2.v2.ToString("X") + "; " + t2.v3.ToString("X") + "} ";
                            break;
                        }
                    }
                    rtb2.Text = s;
                    break;

                case 5:
                    s = "";
                    Blaze.TdfDoubleList ll = (Blaze.TdfDoubleList)tdf;
                    for (int i = 0; i < ll.Count; i++)
                    {
                        s += "{";
                        switch (ll.SubType1)
                        {
                        case 0:
                            List <long> l1 = (List <long>)ll.List1;
                            s += l1[i].ToString("X");
                            break;

                        case 1:
                            List <string> l2 = (List <string>)ll.List1;
                            s += l2[i];
                            break;

                        case 0xA:
                            List <float> lf1 = (List <float>)ll.List1;
                            s += lf1[i].ToString();
                            break;

                        default:
                            s += "(see List1[" + i + "])";
                            break;
                        }
                        s += " ; ";
                        switch (ll.SubType2)
                        {
                        case 0:
                            List <long> l1 = (List <long>)ll.List2;
                            s += l1[i].ToString("X");
                            break;

                        case 1:
                            List <string> l2 = (List <string>)ll.List2;
                            s += l2[i];
                            break;

                        case 0xA:
                            List <float> lf1 = (List <float>)ll.List2;
                            s += lf1[i].ToString();
                            break;

                        default:
                            s += "(see List2[" + i + "])";
                            break;
                        }
                        s += "}\n";
                    }
                    rtb2.Text = s;
                    break;

                case 6:
                    rtb2.Text = "Type: 0x" + ((Blaze.TdfUnion)tdf).UnionType.ToString("X2");
                    break;

                case 7:
                    Blaze.TdfIntegerList til = (Blaze.TdfIntegerList)tdf;
                    s = "";
                    for (int i = 0; i < til.Count; i++)
                    {
                        s += til.List[i].ToString("X");
                        if (i < til.Count - 1)
                        {
                            s += "; ";
                        }
                    }
                    rtb2.Text = s;
                    break;

                case 8:
                    Blaze.TdfDoubleVal dval = (Blaze.TdfDoubleVal)tdf;
                    rtb2.Text = "0x" + dval.Value.v1.ToString("X") + " 0x" + dval.Value.v2.ToString("X");
                    break;

                case 9:
                    Blaze.TdfTrippleVal tval = (Blaze.TdfTrippleVal)tdf;
                    rtb2.Text = "0x" + tval.Value.v1.ToString("X") + " 0x" + tval.Value.v2.ToString("X") + " 0x" + tval.Value.v3.ToString("X");
                    break;

                default:
                    rtb2.Text = "";
                    break;
                }
            }
        }