Ejemplo n.º 1
0
        private void colListBox_ItemSelectChang(object sender, EventArgs e)
        {
            textmessage_type tm = default(textmessage_type);

            if (this.vis && this.colListBox1.SelectItemindex > -1)
            {
                tm = ((listmessage_type)this.colListBox1.Items[this.colListBox1.SelectItemindex].obj).textmessage;
                this.Topm1.Showstring(tm, -1, new Point(base.Left + base.Width + 4, base.Top + this.colListBox1.Itemheight * this.colListBox1.SelectItemindex - this.colListBox1.ScrollValue), base.Width + 8, 16);
            }
            else
            {
                this.Topm1.Showstring(tm, -1, new Point(0, 0), 0, 0);
            }
        }
Ejemplo n.º 2
0
        public void Showstring(textmessage_type tm, int canindex, Point point, int xdec, int ydec)
        {
            int      num      = 0;
            int      num2     = 2;
            int      num3     = 0;
            Font     font     = new Font(Encoding.Default.BodyName, 9f, FontStyle.Regular);
            Font     font2    = new Font(Encoding.Default.BodyName, 9f, FontStyle.Bold);
            Bitmap   image    = new Bitmap(1500, 1500);
            Graphics graphics = Graphics.FromImage(image);

            graphics.Clear(this.BackColor);
            this.bmlock = true;
            Font font3;

            if (tm.lei == 0)
            {
                if (tm.name == null || tm.name == "")
                {
                    this.bmlock = false;
                    this.vis    = false;
                    return;
                }
                string text = tm.name + " ";
                int    i    = 0;
                font3 = font;
                while (i < text.Length)
                {
                    string text2 = text.Substring(i, 1);
                    int    num4  = this.getstrwidth(graphics, text2, font3);
                    if (num + num4 > 600)
                    {
                        num3  = 600;
                        num   = 0;
                        num2 += font3.Height + 1;
                    }
                    graphics.DrawString(text2, font3, new SolidBrush(Color.Black), (float)num, (float)num2, this.measureStringFormat);
                    num += num4 + 1;
                    i++;
                    if (num3 < num)
                    {
                        num3 = num;
                    }
                }
                if (tm.comcans != null)
                {
                    for (int j = 0; j < tm.comcans.Length; j++)
                    {
                        if (tm.comcans[j].canname != null)
                        {
                            text = tm.comcans[j].canname;
                            if (j > 0)
                            {
                                text = "," + text;
                            }
                            i = 0;
                            if (j == canindex)
                            {
                                font3 = font2;
                            }
                            else
                            {
                                font3 = font;
                            }
                            while (i < text.Length)
                            {
                                string text2 = text.Substring(i, 1);
                                int    num4  = this.getstrwidth(graphics, text2, font3);
                                if (num + num4 > 600)
                                {
                                    num3  = 600;
                                    num   = 0;
                                    num2 += font3.Height + 1;
                                }
                                graphics.DrawString(text2, font3, new SolidBrush(Color.Black), (float)num, (float)num2, this.measureStringFormat);
                                num += num4 + 1;
                                i++;
                                if (num3 < num)
                                {
                                    num3 = num;
                                }
                            }
                        }
                    }
                }
                text = "";
                if (canindex > -1 && canindex < tm.comcans.Length && tm.comcans[canindex].zhushi != null && tm.comcans[canindex].zhushi != "")
                {
                    text = tm.comcans[canindex].canname + ":" + tm.comcans[canindex].zhushi;
                }
                else if (canindex == -1 && tm.zhushi != null && tm.zhushi != "")
                {
                    text = tm.zhushi;
                    if (tm.comcans == null || tm.comcans.Length == 0)
                    {
                        text += "(此指令无需参数)".Language();
                    }
                }
                if (text != "")
                {
                    if (num3 < num + 1)
                    {
                        num3 = num;
                    }
                    num   = 0;
                    num2 += font3.Height + 1;
                    i     = 0;
                    font3 = font2;
                    while (i < text.Length)
                    {
                        string text2 = text.Substring(i, 1);
                        int    num4  = this.getstrwidth(graphics, text2, font3);
                        if (num + num4 > 600)
                        {
                            num3  = 600;
                            num   = 0;
                            num2 += font3.Height + 1;
                        }
                        graphics.DrawString(text2, font3, new SolidBrush(Color.Black), (float)num, (float)num2, this.measureStringFormat);
                        num += num4 + 1;
                        i++;
                        if (num3 < num)
                        {
                            num3 = num;
                        }
                    }
                }
            }
            else
            {
                if (tm.zhushi == null || tm.zhushi == "")
                {
                    this.bmlock = false;
                    this.vis    = false;
                    return;
                }
                string text = tm.zhushi;
                int    i    = 0;
                font3 = font;
                while (i < text.Length)
                {
                    string text2 = text.Substring(i, 1);
                    int    num4  = this.getstrwidth(graphics, text2, font3);
                    if (num + num4 > 600)
                    {
                        num3  = 600;
                        num   = 0;
                        num2 += font3.Height + 1;
                    }
                    graphics.DrawString(text2, font3, new SolidBrush(Color.Black), (float)num, (float)num2, this.measureStringFormat);
                    num += num4 + 1;
                    i++;
                    if (num3 < num)
                    {
                        num3 = num;
                    }
                }
            }
            if (num3 < num)
            {
                num3 = num;
            }
            int num5 = num2 + font3.Height;

            this.thisbm = new Bitmap(num3 + 6, num5 + 4);
            Graphics graphics2 = Graphics.FromImage(this.thisbm);

            graphics2.DrawImage(image, 1, 1);
            graphics2.DrawRectangle(new Pen(Color.FromArgb(100, 100, 100)), 0, 0, this.thisbm.Width - 1, this.thisbm.Height - 1);
            base.Width  = this.thisbm.Width;
            base.Height = this.thisbm.Height;
            this.BackgroundImageLayout = ImageLayout.None;
            this.bmlock = false;
            this.showpoint(point, xdec, ydec);
        }
Ejemplo n.º 3
0
        private bool CheckComShow(string str, Point point, int state)
        {
            bool result;

            try
            {
                int      num   = -1;
                bool     flag  = false;
                int      i     = 0;
                string[] array = str.Split(new char[]
                {
                    ' '
                });
                if (state == 2 && array.Length > 1)
                {
                    result = false;
                    return(result);
                }
                int num2 = this.getcommessageindex(array[0]);
                if (num2 > -1)
                {
                    if (array.Length > 1)
                    {
                        num++;
                        while (i < array[1].Length)
                        {
                            string a = array[1].Substring(i, 1);
                            if (a == "\"")
                            {
                                if (i == 0)
                                {
                                    flag = !flag;
                                }
                                else if (array[1].Substring(i - 1, 1) != "\\")
                                {
                                    flag = !flag;
                                }
                            }
                            else if (!flag && a == ",")
                            {
                                num++;
                            }
                            i++;
                        }
                    }
                    textmessage_type tm = this.messagecom[num2];
                    this.Topm1.Showstring(tm, num, point, 0, 0);
                    result = true;
                    return(result);
                }
                if (state == 2)
                {
                    num2 = this.getvamessageindex(array[0]);
                    if (num2 > -1)
                    {
                        textmessage_type tm = this.messageva[num2];
                        this.Topm1.Showstring(tm, -1, point, 0, 0);
                        result = true;
                        return(result);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageOpen.Show(ex.Message);
            }
            result = false;
            return(result);
        }
Ejemplo n.º 4
0
 private void messageinit()
 {
     try
     {
         this.messagecom.Clear();
         string str = (datasize.Language == 0) ? (Application.StartupPath + "\\ch") : (Application.StartupPath + "\\en");
         str = str + this.messageid.ToString() + "_";
         string       path         = str + "com.bin";
         string       path2        = str + "va.bin";
         StreamReader streamReader = new StreamReader(path);
         byte[]       array        = new byte[streamReader.BaseStream.Length - 1L];
         streamReader.BaseStream.Position = 1L;
         streamReader.BaseStream.Read(array, 0, array.Length);
         for (int i = 0; i < array.Length; i++)
         {
             byte[] expr_B5_cp_0 = array;
             int    expr_B5_cp_1 = i;
             expr_B5_cp_0[expr_B5_cp_1] ^= 5;
         }
         streamReader.Close();
         string[] array2 = Encoding.GetEncoding("UTF-8").GetString(array).Replace("\r\n", "\r").Split(new char[]
         {
             '\r'
         });
         string[] array3 = array2;
         for (int j = 0; j < array3.Length; j++)
         {
             string text  = array3[j];
             string text2 = text.Trim();
             if (text2.Length > 0)
             {
                 string[] array4 = text2.Split(new char[]
                 {
                     '|'
                 });
                 textmessage_type item = new textmessage_type
                 {
                     name   = "",
                     zhushi = ""
                 };
                 item.lei  = 0;
                 item.name = array4[0].Trim();
                 string[] array5 = item.name.Split(new char[]
                 {
                     '@'
                 });
                 item.name = array5[0];
                 if (array5.Length > 1)
                 {
                     item.zhushi = array5[1];
                 }
                 if (array4.Length > 1)
                 {
                     string   text3  = text2.Substring(array4[0].Length + 1, text2.Length - array4[0].Length - 1);
                     string[] array6 = text3.Split(new char[]
                     {
                         '|'
                     });
                     item.comcans = new comcan_type[array6.Length];
                     for (int i = 0; i < array6.Length; i++)
                     {
                         string[] array7 = array6[i].Split(new char[]
                         {
                             '@'
                         });
                         item.comcans[i].canname = array7[0];
                         if (array7.Length > 1)
                         {
                             item.comcans[i].zhushi = array6[i].Substring(array7[0].Length + 1, array6[i].Length - array7[0].Length - 1);
                         }
                     }
                 }
                 this.messagecom.Add(item);
             }
         }
         streamReader = new StreamReader(path2);
         array        = new byte[streamReader.BaseStream.Length - 1L];
         streamReader.BaseStream.Position = 1L;
         streamReader.BaseStream.Read(array, 0, array.Length);
         for (int i = 0; i < array.Length; i++)
         {
             byte[] expr_363_cp_0 = array;
             int    expr_363_cp_1 = i;
             expr_363_cp_0[expr_363_cp_1] ^= 5;
         }
         streamReader.Close();
         streamReader.Dispose();
         array2 = Encoding.GetEncoding("UTF-8").GetString(array).Replace("\r\n", "\r").Split(new char[]
         {
             '\r'
         });
         this.messageva.Clear();
         array3 = array2;
         for (int j = 0; j < array3.Length; j++)
         {
             string text  = array3[j];
             string text2 = text.Trim();
             if (text2.Length > 0)
             {
                 string[] array4 = text2.Split(new char[]
                 {
                     '|'
                 });
                 textmessage_type item = new textmessage_type
                 {
                     name   = "",
                     zhushi = ""
                 };
                 item.lei  = 1;
                 item.name = array4[0].Trim();
                 string[] array5 = item.name.Split(new char[]
                 {
                     '@'
                 });
                 item.name = array5[0];
                 if (array5.Length > 1)
                 {
                     item.zhushi = array5[1];
                 }
                 this.messageva.Add(item);
             }
         }
     }
     catch (Exception ex)
     {
         MessageOpen.Show(ex.Message);
     }
 }