private void OnHostWriterActionHandler(string str, HostWriterContext context)
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker) delegate { OnHostWriterActionHandler(str, context); });
            }
            else
            {
                System.Drawing.Color backupForecolor = RTB.SelectionColor;
                System.Drawing.Color backupHighlight = RTB.SelectionBackColor;

                if (context.ForeColor != System.Drawing.Color.Empty)
                {
                    RTB.SelectionColor = context.ForeColor;
                }

                if (context.HighlightColor != System.Drawing.Color.Empty)
                {
                    RTB.SelectionBackColor = context.HighlightColor;
                }

                RTB.AppendText(str);

                RTB.SelectionFont      = Constants.FONT_STANDARD;
                RTB.SelectionColor     = backupForecolor;
                RTB.SelectionBackColor = backupHighlight;
            }
        }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();
            int    i1 = 3 * 4;
            int    i2 = 12 / 4;
            int    i3 = 14 / 4;
            int    i4 = 15 % 4;
            int    i5 = 2 + 3 * 4;
            int    i6 = 2 + (3 * 4) / (2 - 4);
            double d1 = 3.1 * 2.3;
            double d2 = 1.0 / 3.0;
            double d3 = 1 / 3;

            RTB.AppendText(i1 + "\n" + i2 + "\n" + i3 + "\n" + i4 + "\n" + i5 + "\n" + i6 + "\n");
            RTB.AppendText(d1 + "\n" + d2 + "\n" + d3 + "\n");

            string st = "3";

            try
            {
                int it = int.Parse(st);
            }
            catch
            {
                MessageBox.Show(st + " is not an integar");
            }

            string s2 = "3.2";

            try
            {
                int it = int.Parse(s2);
            }
            catch
            {
                MessageBox.Show(s2 + " is not an integer");
                int i7 = 0;
            }

            string s3 = "pi";

            try
            {
                double d7 = double.Parse(s3);
            }
            catch
            {
                double d7 = 0;
            }
        }
        private void loadwcdata()
        {
            // Load up the data according to the wiki!
            int cardID = BitConverter.ToUInt16(wondercard_data, 0);

            if (cardID == 0)
            {
                RTB.Text = "Empty Slot. No data!";
                return;
            }
            string cardname = Encoding.Unicode.GetString(wondercard_data, 0x2, 0x48);
            int    cardtype = wondercard_data[0x51];

            RTB.Clear();
            RTB.AppendText("Card #: " + cardID.ToString("0000") + "\r\n" + cardname + "\r\n");

            if (cardtype == 1) // Item
            {
                int item = BitConverter.ToUInt16(wondercard_data, 0x68);
                int qty  = BitConverter.ToUInt16(wondercard_data, 0x70);

                RTB.AppendText("\r\nItem: " + Form1.itemlist[item] + "\r\n" + "Quantity: " + qty.ToString());
            }
            else if (cardtype == 0) // PKM
            {
                int species  = BitConverter.ToUInt16(wondercard_data, 0x82);
                int helditem = BitConverter.ToUInt16(wondercard_data, 0x78);
                int move1    = BitConverter.ToUInt16(wondercard_data, 0x7A);
                int move2    = BitConverter.ToUInt16(wondercard_data, 0x7C);
                int move3    = BitConverter.ToUInt16(wondercard_data, 0x7E);
                int move4    = BitConverter.ToUInt16(wondercard_data, 0x80);
                int TID      = BitConverter.ToUInt16(wondercard_data, 0x68);
                int SID      = BitConverter.ToUInt16(wondercard_data, 0x6A);

                string OTname = Util.TrimFromZero(Encoding.Unicode.GetString(wondercard_data, 0xB6, 22));
                RTB.Text +=
                    "\r\nSpecies: " + Form1.specieslist[species] + "\r\n"
                    + "Item: " + Form1.itemlist[helditem] + "\r\n"
                    + "Move 1: " + Form1.movelist[move1] + "\r\n"
                    + "Move 2: " + Form1.movelist[move2] + "\r\n"
                    + "Move 3: " + Form1.movelist[move3] + "\r\n"
                    + "Move 4: " + Form1.movelist[move4] + "\r\n"
                    + "OT: " + OTname + "\r\n"
                    + "ID: " + TID.ToString() + "/" + SID.ToString();
            }
            else
            {
                RTB.Text = "Unsupported Wondercard Type!";
            }
        }
Beispiel #4
0
 private void Log(string message)
 {
     this.Invoke(new Action <string>((string msg) => {
         if (RTB.Lines.Length > 2 && RTB.Lines[RTB.Lines.Length - 2].StartsWith("frame=") && msg.StartsWith("frame="))
         {
             ReplaceLastLines(RTB, msg);
         }
         else if (RTB.Lines.Length > 2 && RTB.Lines[RTB.Lines.Length - 2].StartsWith("size=") && msg.StartsWith("size="))
         {
             ReplaceLastLines(RTB, msg);
         }
         else
         {
             RTB.AppendText(msg + "\r\n");
         }
         ScrollToBottom(RTB);
         Application.DoEvents();
     }), message);
     Application.DoEvents();
 }
Beispiel #5
0
        private void initializeFileProgram()
        {
            string lineRead = "";

            beginName.Text = nameFile;
            using (var streamReader = new StreamReader("\\\\Mac\\Home\\Desktop\\Универ\\Методы трансляции\\CompilerPascal\\CompilerPascal\\TextFile\\" + nameFile, System.Text.Encoding.Default))
            {
                int i = 1;

                while ((lineRead = streamReader.ReadLine()) != null)
                {
                    beginNumber.Text += i + "\n\n";
                    begin.AppendText(lineRead + "\n");
                    i++;
                }
            }

            using (var streamReader = new StreamReader("\\\\Mac\\Home\\Desktop\\Универ\\Методы трансляции\\CompilerPascal\\CompilerPascal\\TextFile\\Error.txt", System.Text.Encoding.Default))
            {
                RTB.AppendText(streamReader.ReadToEnd());
            }
        }
Beispiel #6
0
        private void Element_DoubleClick(object sender, HtmlElementEventArgs e)
        {
            var elem = (HtmlElement)sender;

            RTB.AppendText("¶[" + MiMFa_StringService.CompressedText(elem.InnerText, 100, "...") + "]" + Environment.NewLine);
        }
Beispiel #7
0
        //Rich Text Box AppendText
        private void RTBAppendText(string Text, TextColors Color)
        {
            switch (Color)
            {
            case TextColors.Black:
                RTB.Invoke(new MethodInvoker(delegate { RTB.SelectionColor = System.Drawing.Color.Black; RTB.AppendText(Text); }));
                break;

            case TextColors.Green:
                RTB.Invoke(new MethodInvoker(delegate { RTB.SelectionColor = System.Drawing.Color.Green; RTB.AppendText(Text); }));
                break;

            case TextColors.Red:
                RTB.Invoke(new MethodInvoker(delegate { RTB.SelectionColor = System.Drawing.Color.Red; RTB.AppendText(Text); }));
                break;

            default:
                break;
            }
        }