示例#1
0
        public static void prepareToCreateTOC(string consoletocFile, RichTextBox rtb = null)
        {
            if (!consoletocFile.EndsWith("\\"))
            {
                consoletocFile = consoletocFile + "\\";
            }
            List <string> files = GetFiles(consoletocFile);

            if (files.Count != 0)
            {
                rtb?.AppendText($"Creating TOC in {consoletocFile}\n");
                string t = files[0];
                int    n = t.IndexOf("DLC_");
                if (n > 0)
                {
                    for (int i = 0; i < files.Count; i++)
                    {
                        files[i] = files[i].Substring(n);
                    }
                    string t2 = files[0];
                    n = t2.IndexOf("\\");
                    for (int i = 0; i < files.Count; i++)
                    {
                        files[i] = files[i].Substring(n + 1);
                    }
                }
                else
                {
                    n = t.IndexOf("BIOGame");
                    if (n > 0)
                    {
                        for (int i = 0; i < files.Count; i++)
                        {
                            files[i] = files[i].Substring(n);
                        }
                    }
                }
                string pathbase;
                string t3 = files[0];
                int    n2 = t3.IndexOf("BIOGame");
                if (n2 >= 0)
                {
                    pathbase = Path.GetDirectoryName(Path.GetDirectoryName(consoletocFile)) + "\\";
                }
                else
                {
                    pathbase = consoletocFile;
                }
                CreateTOC(pathbase, consoletocFile + "PCConsoleTOC.bin", files.ToArray());
                rtb?.AppendText("Done.\n");
            }
        }
示例#2
0
文件: MainForm.cs 项目: mono/gert
	public MainForm ()
	{
		// 
		// _richTextBox
		// 
		_richTextBox = new RichTextBox ();
		_richTextBox.Dock = DockStyle.Bottom;
		_richTextBox.SelectionAlignment = HorizontalAlignment.Center;
		_richTextBox.AppendText ("Title");
		Controls.Add (_richTextBox);
		// 
		// _alignButton
		// 
		_alignButton = new Button ();
		_alignButton.Text = "Left Align";
		_alignButton.Dock = DockStyle.Top;
		_alignButton.Click += new EventHandler (AlignButton_Click);
		Controls.Add (_alignButton);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 130);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #351918";
		Load += new EventHandler (MainForm_Load);
	}
示例#3
0
文件: MainForm.cs 项目: mono/gert
	public MainForm ()
	{
		// 
		// _richTextBox
		// 
		_richTextBox = new RichTextBox ();
		_richTextBox.ReadOnly = true;
		_richTextBox.Dock = DockStyle.Fill;
		_richTextBox.SelectionColor = Color.Black;
		_richTextBox.AppendText ("should be colored black");
		_richTextBox.SelectionColor = Color.Red;
		_richTextBox.AppendText ("\r\nshould have a red color");
		_richTextBox.SelectionColor = Color.Empty;
		_richTextBox.AppendText ("\r\nshould be default color");
		_richTextBox.SelectionColor = Color.Black;
		_richTextBox.AppendText ("\r\nshould be colored black");
		_richTextBox.SelectionFont = new Font (_richTextBox.SelectionFont, FontStyle.Bold);
		_richTextBox.AppendText (" and now bold");
		_richTextBox.SelectionColor = Color.Red;
		_richTextBox.AppendText ("\r\nshould have a red color");
		_richTextBox.SelectionColor = Color.Empty;
		_richTextBox.AppendText ("\r\nshould be default color");
		Controls.Add (_richTextBox);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 150);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #351576";
		Load += new EventHandler (MainForm_Load);
	}
示例#4
0
文件: test.cs 项目: mono/gert
	static void Main ()
	{
		TextBox textBox = new TextBox ();
		textBox.CreateControl ();
		for (int i = 1; i <= 1000; i++)
			textBox.AppendText (string.Format ("This is line {0}", i));

		RichTextBox rtb = new RichTextBox ();
		rtb.CreateControl ();
		for (int i = 1; i <= 1000; i++)
			rtb.AppendText (string.Format ("This is line {0}", i));
	}
    public static void WriteLog(RichTextBox _logTextBox, string Text)
    {
        string Time = DateTime.Now.ToString("HH:mm:ss dd-MM-yyyy | ");

        if (_logTextBox.InvokeRequired)
        {
            _logTextBox.Invoke(new MethodInvoker(delegate
            {
                _logTextBox.AppendText(Time + Text + "\n");
                _logTextBox.Select(_logTextBox.Text.LastIndexOf('|'), 1);
                _logTextBox.SelectionFont = new System.Drawing.Font(_logTextBox.Font.FontFamily, _logTextBox.Font.Size, FontStyle.Bold);
                _logTextBox.ScrollToCaret();
            }));
        }
        else
        {
            _logTextBox.AppendText(Time + Text + "\n");
            _logTextBox.Select(_logTextBox.Text.LastIndexOf('|'), 1);
            _logTextBox.SelectionFont = new System.Drawing.Font(_logTextBox.Font.FontFamily, _logTextBox.Font.Size, FontStyle.Bold);
            _logTextBox.ScrollToCaret();
        }
    }
示例#6
0
 public static void Append(this RichTextBox textbox, object text)
 {
     textbox.AppendText(text.ToString());
 }
示例#7
0
 public static void AppendLine(this RichTextBox textbox)
 {
     textbox.AppendText(Environment.NewLine);
 }
示例#8
0
 public static void AppendFormatLine(this RichTextBox textbox, string format, params object[] arg0)
 {
     textbox.AppendText(String.Format(format, arg0) + Environment.NewLine);
 }
示例#9
0
 /// <summary>
 /// Вывод сообщения в диалог.
 /// </summary>
 /// <param name="parMessage">Текст сообщения</param>
 public override void AddMessageToMessageBox(string parMessage)
 {
     _messageSpace.AppendText(parMessage);
 }
 public void AppendText(string AppendingText)
 {
     TB.Focus();
     TB.AppendText(AppendingText);
     Invalidate();
 }
示例#11
0
 protected override void write(string message)
 {
     richTextBox.AppendText($"{message}\n");
 }
        private void SendTheMessageToRichTextBox(string logMessage, RichTextBoxRowColoringRule rule, LogEventInfo logEvent)
        {
            RichTextBox textBox = TargetRichTextBox;

            int startIndex = textBox.Text.Length;

            textBox.SelectionStart     = startIndex;
            textBox.SelectionBackColor = GetColorFromString(rule.BackgroundColor, textBox.BackColor);
            textBox.SelectionColor     = GetColorFromString(rule.FontColor, textBox.ForeColor);
            textBox.SelectionFont      = new Font(textBox.SelectionFont, textBox.SelectionFont.Style ^ rule.Style);
            textBox.AppendText(logMessage + "\n");
            textBox.SelectionLength = textBox.Text.Length - textBox.SelectionStart;

            // find word to color
            foreach (RichTextBoxWordColoringRule wordRule in WordColoringRules)
            {
                MatchCollection matches = wordRule.CompiledRegex.Matches(textBox.Text, startIndex);
                foreach (Match match in matches)
                {
                    textBox.SelectionStart     = match.Index;
                    textBox.SelectionLength    = match.Length;
                    textBox.SelectionBackColor = GetColorFromString(wordRule.BackgroundColor, textBox.BackColor);
                    textBox.SelectionColor     = GetColorFromString(wordRule.FontColor, textBox.ForeColor);
                    textBox.SelectionFont      = new Font(textBox.SelectionFont, textBox.SelectionFont.Style ^ wordRule.Style);
                }
            }

            if (SupportLinks)
            {
                object linkInfoObj;
                lock (logEvent.Properties)
                {
                    logEvent.Properties.TryGetValue(RichTextBoxLinkLayoutRenderer.LinkInfo.PropertyName, out linkInfoObj);
                }
                if (linkInfoObj != null)
                {
                    RichTextBoxLinkLayoutRenderer.LinkInfo linkInfo = (RichTextBoxLinkLayoutRenderer.LinkInfo)linkInfoObj;

                    bool linksAdded = false;

                    textBox.SelectionStart  = startIndex;
                    textBox.SelectionLength = textBox.Text.Length - textBox.SelectionStart;
                    string          addedText = textBox.SelectedText;
                    MatchCollection matches   = linkAddRegex.Matches(addedText); //only access regex after checking SupportLinks, as it assures the initialization
                    for (int i = matches.Count - 1; i >= 0; --i)                 //backwards order, so the string positions are not affected
                    {
                        Match  match    = matches[i];
                        string linkText = linkInfo.GetValue(match.Value);
                        if (linkText != null)
                        {
                            textBox.SelectionStart  = startIndex + match.Index;
                            textBox.SelectionLength = match.Length;
                            FormHelper.ChangeSelectionToLink(textBox, linkText, LinkPrefix + logEvent.SequenceID);
                            linksAdded = true;
                        }
                    }
                    if (linksAdded)
                    {
                        linkedEvents[logEvent.SequenceID] = logEvent;
                    }
                }
            }

            //remove some lines if there above the max
            if (MaxLines > 0)
            {
                //find the last line by reading the textbox
                var lastLineWithContent = textBox.Lines.LastOrDefault(f => !string.IsNullOrEmpty(f));
                if (lastLineWithContent != null)
                {
                    char lastChar         = lastLineWithContent.Last();
                    var  visibleLineCount = textBox.GetLineFromCharIndex(textBox.Text.LastIndexOf(lastChar));
                    var  tooManyLines     = (visibleLineCount - MaxLines) + 1;
                    if (tooManyLines > 0)
                    {
                        textBox.SelectionStart  = 0;
                        textBox.SelectionLength = textBox.GetFirstCharIndexFromLine(tooManyLines);
                        if (SupportLinks)
                        {
                            string selectedRtf = textBox.SelectedRtf;
                            //only access regex after checking SupportLinks, as it assures the initialization
                            foreach (Match match in linkRemoveRtfRegex.Matches(selectedRtf))
                            {
                                int id;
                                if (int.TryParse(match.Groups[1].Value, out id))
                                {
                                    lock (linkedEventsLock)
                                    {
                                        linkedEvents.Remove(id);
                                    }
                                }
                            }
                        }
                        textBox.SelectedRtf = "{\\rtf1\\ansi}";
                    }
                }
            }

            if (AutoScroll)
            {
                textBox.Select(textBox.TextLength, 0);
                textBox.ScrollToCaret();
            }
        }
示例#13
0
 private void BackgroundWorkerOnProgressChanged(object sender, ProgressChangedEventArgs progressChangedEventArgs)
 {
     _logText.AppendText(progressChangedEventArgs.UserState + "\n");
 }
 private void AppendText(string info)
 {
     box.AppendText(info);
     box.ScrollToCaret();
 }
 /// <summary>Appends text to the current text of a rich text box.</summary>
 /// <param name="text">The text to append to the current contents of the text box.</param>
 public void AppendText(string text)
 {
     _richTextBox.AppendText(text);
 }
示例#16
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            _resourceManager = Properties.Resources.ResourceManager;

            _imageStatusList = new ImageList();
            // ReSharper disable once ResourceItemNotResolved
            _imageCloseTabPage = (Bitmap)_resourceManager.GetObject("close");
            _imageNameList     = new List <string>()
            {
                "False", "True"
            };

            foreach (var imageName in _imageNameList)
            {
                _imageStatusList.Images.Add((Bitmap)_resourceManager?.GetObject(imageName));
            }
            listViewFriends.SmallImageList = _imageStatusList;

            LoginForm loginForm = new LoginForm();

            if (loginForm.ShowDialog() == DialogResult.OK)
            {
                _connection = await ConnectionBuilder.Create(loginForm.AuthorizationResult);

                await _connection.Session.Initialization(loginForm.AuthorizationResult.User);

                foreach (var friend in _connection.Friends)
                {
                    if (friend.Value == true)
                    {
                        listViewFriends.Items.Add(friend.Key, friend.Key, 1);
                    }
                    else
                    {
                        listViewFriends.Items.Add(friend.Key, friend.Key, 0);
                    }
                }
            }

            _connection.ChangeStatusFriend += (o, args) =>
            {
                if (args.Status == true)
                {
                    listViewFriends.Items[args.UserName].ImageIndex = 1;
                    if (TabControlChat.Controls.Count != 0)
                    {
                        if (TabControlChat.SelectedTab == TabControlChat.TabPages[args.UserName])
                        {
                            sendMessageButton.Enabled = true;
                        }
                    }
                }
                else
                {
                    listViewFriends.Items[args.UserName].ImageIndex = 0;
                    if (TabControlChat.Controls.Count != 0)
                    {
                        if (TabControlChat.SelectedTab == TabControlChat.TabPages[args.UserName])
                        {
                            sendMessageButton.Enabled = false;
                        }
                    }
                }
            };

            _connection.SendMessage += (o, args) =>
            {
                TabPage     page        = TabControlChat.TabPages[args.UserName];
                RichTextBox richTextBox = page.Controls[0] as RichTextBox;
                richTextBox?.AppendText("\r\n");
                richTextBox?.AppendText("Ja :" + args.Message);
            };

            _connection.ReceiveMessage += (o, args) =>
            {
                if (TabControlChat.TabPages[args.UserName] == null)
                {
                    TabPage page = new TabPage(args.UserName)
                    {
                        Name = args.UserName
                    };
                    RichTextBox richTextBox = new RichTextBox
                    {
                        Text = args.UserName + @": " + args.Message, Dock = DockStyle.Fill, ReadOnly = true
                    };
                    page.Controls.Add(richTextBox);
                    TabControlChat.Controls.Add(page);
                }
                else
                {
                    var         page        = TabControlChat.TabPages[args.UserName];
                    RichTextBox richTextBox = page.Controls[0] as RichTextBox;
                    richTextBox?.AppendText("\r\n");
                    richTextBox?.AppendText(args.UserName + @": " + args.Message);
                }
            };

            _connection.IncomingCall += (o, args) =>
            {
                buttonCall.Visible   = false;
                buttonCancel.Visible = false;

                buttonCallDeclined.Visible = true;
                buttonCallAccepted.Visible = true;

                userName = args.User;
            };
        }
        private void DisplayWorkFlowItems()
        {
            multiTabs.TabPages.Clear();
            RichTextBox box    = null;
            TextBox     sumBox = null;
            TabPage     page   = null;
            Label       lab    = null;

            String[] tabs = { "Inputs", "Attributes" }; // Removed Sequence
            //foreach (TabPage cPage in multiTabs.TabPages)
            //{
            //    cPage.Controls.Clear();
            //    multiTabs.TabPages.Remove(cPage);
            //}
            foreach (String tabName in tabs)
            {
                page      = new TabPage();
                page.Text = tabName;
                page.Name = tabName;
                box       = new RichTextBox();
                page.Controls.Add(box);
                multiTabs.TabPages.Add(page);
                CopyRTB(templateRTB, ref box, true);
                box.ContextMenuStrip = null;

                switch (tabName)
                {
                case "Inputs":
                    foreach (VROWorkFlow.Variables iVar in workflowitems.inputs.Values)
                    {
                        box.AppendText(iVar.ToString() + Environment.NewLine);
                    }
                    break;

                case "Attributes":
                    foreach (VROWorkFlow.Variables iVar in workflowitems.attribs.Values)
                    {
                        box.AppendText(iVar.ToString() + Environment.NewLine);
                    }
                    break;

                case "Sequence":
                    VROWorkFlow.WorkFlowItem wfi = workflowitems.workitems[workflowitems.rootItem];
                    box.AppendText("Root Item : " + wfi.ToString() + Environment.NewLine);
                    while (wfi.wfiType != "end")
                    {
                        wfi = workflowitems.workitems[wfi.outItemName];
                        box.AppendText("Next Item : " + wfi.ToString() + Environment.NewLine);
                    }
                    break;
                }
            }
            List <String> wfkeys = workflowitems.itemKeys.Keys.ToList();

            wfkeys.Sort();
            foreach (String key in wfkeys)
            {
                String wfiItemName = workflowitems.itemKeys[key];
                page = new TabPage();
                VROWorkFlow.WorkFlowItem wfi = workflowitems.workitems[wfiItemName];
                page.Text = wfi.displayName == null ? wfi.itemName : wfi.displayName;
                page.Tag  = wfi;
                page.Name = wfi.itemName;


                box          = new RichTextBox();
                box.Name     = "RTB-" + wfi.itemName;
                box.KeyDown += TextBoxMonitorKeyDown;
                box.KeyUp   += TextBoxMonitorKeyUp;
                box.Click   += RTBBoxClicked;
                sumBox       = new TextBox();
                sumBox.Name  = "SUMMARY-" + wfi.itemName;

                lab      = new Label();
                lab.Name = "LABEL-" + wfi.itemName;

                page.Controls.Add(sumBox);
                page.Controls.Add(box);
                page.Controls.Add(lab);
                multiTabs.TabPages.Add(page);

                CopyRTB(templateRTB, ref box);
                CopyBOX(templateSummary, ref sumBox);
                CopyLabel(PositionMarker, lab);

                box.Lines = wfi.lines;
                sumBox.AppendText(wfi.ToString() + Environment.NewLine);
                if (wfi.inputs.Count > 0)
                {
                    foreach (String eName in wfi.inputs.Keys)
                    {
                        sumBox.AppendText("Input : " + eName + " - " + wfi.inputs[eName].ToString() + Environment.NewLine);
                    }
                }
                if (wfi.outputs.Count > 0)
                {
                    foreach (String eName in wfi.outputs.Keys)
                    {
                        sumBox.AppendText("Output : " + eName + " - " + wfi.outputs[eName].ToString() + Environment.NewLine);
                    }
                }
            }
        }
示例#18
0
 private void PrintNeuronResult(RichTextBox richTextBox, int index, double result)
 {
     richTextBox.Invoke((MethodInvoker) delegate { richTextBox.AppendText(index + ": " + String.Format("{0:0.00000}", result) + "\r\n"); });
 }
示例#19
0
 public override void Write(string value)
 {
     txt.AppendText(value);
 }
示例#20
0
        public bool verificarSintaxis(RichTextBox txtLog)
        {
            bool                    comprobante = true;
            List <String>           pila        = new List <String>();
            TablaAnalisisSintactico tas         = new TablaAnalisisSintactico();
            IdentificadoresTabla    find        = new IdentificadoresTabla();

            pila.Add("$");
            pila.Add("Codigo");

            do
            {
                Console.WriteLine("------------------------------------------------------");
                foreach (String element in pila)
                {
                    Console.Write("  " + element);
                }
                Console.WriteLine();
                foreach (String element in entrada)
                {
                    Console.Write("  " + element);
                }

                //si los ultimos elementos de ambas listas son iguales, se eliminan
                if (pila[pila.Count - 1].Equals(entrada[entrada.Count - 1]))
                {
                    pila.RemoveAt(pila.Count - 1);
                    entrada.RemoveAt(entrada.Count - 1);
                }
                else if (pila[pila.Count - 1].Equals("e"))
                {
                    pila.RemoveAt(pila.Count - 1);
                }
                else //Se busca en la tabla los reemplazos para el último en la pila
                {
                    String noTerminal = pila[pila.Count - 1];
                    pila.RemoveAt(pila.Count - 1);
                    int cont = 0;

                    int fila    = Array.IndexOf(find.Fila, noTerminal);
                    int columna = Array.IndexOf(find.Columna, entrada[entrada.Count - 1]);
                    //Console.WriteLine("\n\nFila: " + fila + "   Columna: " + columna);
                    try
                    {
                        foreach (String element in tas.Tabla[fila, columna])
                        {
                            pila.Add(element);
                            cont++;
                        }
                    }
                    catch (IndexOutOfRangeException ex)
                    {
                        comprobante = false;
                    }

                    if (cont == 0)
                    {
                        comprobante = false;
                    }
                }

                Console.WriteLine("\n\n");
            } while (pila.Count != 0 && comprobante);

            //Si la pila o la entrada no están vacías quiere decir que el análisis sintáctico no fue satisfactorio
            if (pila.Count != 0 || entrada.Count != 0)
            {
                comprobante = false;
                Console.WriteLine("Hay errores sintácticos en el análisis");
                txtLog.AppendText(Environment.NewLine + "Error Sintáctico en: (" + informacion[entrada.Count - 2].Fila + "," + informacion[entrada.Count - 2].Columna + ")");
            }

            return(comprobante);
        }
示例#21
0
        public static void ProcessInput(int startpoint)
        {
            processing = true;

            if (startpoint == 0)
            {
                r3.Text = "";
            }

            noOfLines = r2.Lines.Length - 1;

            int u = startpoint;      // process only last line

            for (; u < noOfLines; u++)
            {
                cuurrentLineNo = u;
                Initialize();
                show_output = true;

                p_line = r2.Lines[u];
                p_line = p_line.Trim(' ');
                if (p_line == "")
                {
                    continue;
                }
                if (p_line[p_line.Length - 1] == ';')
                {
                    show_output = false;
                }
                p_line = p_line.Trim(';');
                p_len  = p_line.Length;
                if (p_len == 0)
                {
                    continue;
                }

                // Skip Initial Spaces
                SkipSpaces();
                inx--;
                if (End())
                {
                    continue;
                }

                // Store This Point;
                beginInx = inx;

                if (IsCommand())
                {
                    // Skip Spaces
                    SkipSpaces();
                    inx--;
                    if (End())
                    {
                        continue;
                    }

                    ParseCommand();
                }
                else if (IsEquation(p_line))
                {
                    if (SplitEquation(p_line, VariableAssignment))
                    {
                        FVar temp = null;
                        if ((temp = ListHandler.ML_VariableList(MLGUI.GetVariable, is_var)) != null)
                        {
                            ListHandler.ML_VariableList(MLGUI.UpdateVariableValue, temp.varName, is_val);
                        }
                        else
                        {
                            ListHandler.ML_VariableList(MLGUI.AddItem, is_var, is_val);
                        }
                    }
                    else if (SplitEquation(p_line, FunctionAssignment))
                    {
                        FunctionTree temp = null;
                        if ((temp = ListHandler.ML_FunctionList(MLGUI.GetFunction, is_var)) != null)
                        {
                            ListHandler.ML_FunctionList(MLGUI.UpdateFunctionExpression, is_var, is_func);
                        }
                        else
                        {
                            ListHandler.ML_FunctionList(MLGUI.AddItem, is_var, is_func);
                        }

                        //foreach (FVar v in temp.varList)
                        //{
                        //if (ListHandler.ML_FunctionList(MLGUI.GetFunction, v.varName))
                        //}
                    }
                    else
                    {
                        syntaxError = true;
                        Error();
                    }
                }
                else if (IsVariable(p_line))
                {
                    ListHandler.ML_VariableList(MLGUI.RemoveItem, is_var);
                    ListHandler.ML_VariableList(MLGUI.AddItem, is_var);
                }
                else if (IsFunction(p_line))
                {
                    FunctionEntry temp = null;
                    if ((temp = ListHandler.ML_FunctionListSecondary(MLGUI.GetFunctionFromExpression, is_func)) != null)
                    {
                        r2.AppendText(temp.Name);
                        r2.SelectionStart = r2.TextLength;
                        r2.ScrollToCaret();
                    }
                    else
                    {
                        ListHandler.ML_FunctionList(MLGUI.AddItem, "", is_func);
                    }
                }
                else
                {
                    parseError = true;
                    Error();
                }

                if (output[0] != "" && show_output)
                {
                    string lu = (u + 1) + "";
                    r3.AppendText("line-" + lu);
                    for (int o = 0; o < (5 - lu.Length); o++)
                    {
                        r3.Text += "  ";
                    }
                    r3.AppendText("\t" + output[0] + "\n");

                    int z = 1;
                    while (output[z] != "" && z < output.Length)
                    {
                        for (int o = 0; o < 10; o++)
                        {
                            r3.Text += "  ";
                        }
                        r3.AppendText("\t" + output[z] + "\n");
                        z++;
                    }
                }
            }
            processing = false;
        }
        public void validarLexemas(RichTextBox TokensTxt, RichTextBox ErroresTxt)
        {
            TokensTxt.AppendText("<ListaTokens>\n", Color.BlueViolet);
            ErroresTxt.AppendText("<ListaErrores>\n\n", Color.BlueViolet);
            Boolean PalabraControl;

            foreach (Palabra auxPalabra in Palabras)
            {
                PalabraControl = false;
                foreach (Regex auxRegex in Expresiones)
                {
                    if (auxRegex.TestLexema(auxPalabra.getLexema(), Conjuntos))
                    {
                        //GENERAR XML
                        TokensTxt.AppendText("\t<Token>\n", Color.LimeGreen);

                        TokensTxt.AppendText("\t\t<Nombre> ", Color.DarkOrange);
                        TokensTxt.AppendText(auxRegex.getID(), Color.Gainsboro);
                        TokensTxt.AppendText(" </Nombre>\n", Color.DarkOrange);

                        TokensTxt.AppendText("\t\t<Valor> ", Color.DeepPink);
                        TokensTxt.AppendText(auxPalabra.getLexema(), Color.Gainsboro);
                        TokensTxt.AppendText(" </Valor>\n", Color.DeepPink);

                        TokensTxt.AppendText("\t\t<Fila> ", Color.Crimson);
                        TokensTxt.AppendText(auxPalabra.Fila.ToString(), Color.Gainsboro);
                        TokensTxt.AppendText(" </Fila>\n", Color.Crimson);

                        TokensTxt.AppendText("\t\t<Columa> ", Color.DodgerBlue);
                        TokensTxt.AppendText(auxPalabra.Columna.ToString(), Color.Gainsboro);
                        TokensTxt.AppendText(" </Columa>\n", Color.DodgerBlue);

                        TokensTxt.AppendText("\t</Token>\n\n", Color.LimeGreen);

                        PalabraControl = true;
                    }
                }
                if (!PalabraControl)
                {
                    //GENERAR XML
                    ErroresTxt.AppendText("\t<Error>\n", Color.LimeGreen);

                    ErroresTxt.AppendText("\t\t<Valor> ", Color.DeepPink);
                    ErroresTxt.AppendText(auxPalabra.getLexema(), Color.Gainsboro);
                    ErroresTxt.AppendText(" </Valor>\n", Color.DeepPink);

                    ErroresTxt.AppendText("\t\t<Fila> ", Color.Crimson);
                    ErroresTxt.AppendText(auxPalabra.Fila.ToString(), Color.Gainsboro);
                    ErroresTxt.AppendText(" </Fila>\n", Color.Crimson);

                    ErroresTxt.AppendText("\t\t<Columa> ", Color.DodgerBlue);
                    ErroresTxt.AppendText(auxPalabra.Columna.ToString(), Color.Gainsboro);
                    ErroresTxt.AppendText(" </Columa>\n", Color.DodgerBlue);

                    ErroresTxt.AppendText("\t</Error>\n\n", Color.LimeGreen);
                }
            }
            TokensTxt.AppendText("</ListaTokens>", Color.BlueViolet);
            ErroresTxt.AppendText("</ListaErrores>", Color.BlueViolet);
        }
示例#23
0
 //appends the text to the current textbox that is in focus
 private void SquareRootButton_Click(object sender, EventArgs e)
 {
     focusedTextBox.AppendText("√");
 }
示例#24
0
 public void ResetDescription(RichTextBox rtbDescription)
 {
     rtbDescription.AppendText(string.Format(LexTextControls.ksBullettedItem, Citation, Environment.NewLine));
 }
示例#25
0
        public static void TCPSocketServer()
        {
            string data = null;

            // Data buffer for incoming data.
            byte[] bytes = new Byte[1024];

            int           portNumber;
            Configuration configManager = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            KeyValueConfigurationCollection confCollection = configManager.AppSettings.Settings;

            if (!string.IsNullOrEmpty(confCollection["TCPPort"].Value))
            {
                Int32.TryParse(confCollection["TCPPort"].Value, out portNumber);
            }
            else
            {
                MessageBox.Show("TCPPort is not set in the config file!!!", "BuggerNET");
                return;
            }

            // Establish the local endpoint for the socket.
            // Dns.GetHostName returns the name of the
            // host running the application.
            IPHostEntry ipHostInfo    = Dns.GetHostEntry(Dns.GetHostName());
            IPAddress   ipAddress     = ipHostInfo.AddressList[0];
            IPEndPoint  localEndPoint = new IPEndPoint(ipAddress, portNumber);

            TcpListener tcpListener = new TcpListener(localEndPoint);

            // Bind the socket to the local endpoint and
            // listen for incoming connections.
            try
            {
                tcpListener.Start();
                // Start listening for connections.
                while (true)
                {
                    //statRTB.AppendText("Waiting for a connection...\n");

                    while (!tcpListener.Pending())
                    {
                        System.Threading.Thread.Sleep(20);
                    }

                    // Program is suspended while waiting for an incoming connection.
                    Socket handler = tcpListener.AcceptSocket();
                    handler.Blocking = false;
                    data             = null;

                    // An incoming connection needs to be processed.
                    int count = 0;
                    while (/*count < 100000 && !m_Stop.WaitOne(0)*/ true)
                    {
                        bytes = new byte[1024];
                        data  = null;
                        SocketError socketError = SocketError.Success;
                        //try
                        //{
                        while (handler.Receive(bytes, 0, bytes.Length, SocketFlags.None, out socketError) <= 0)
                        {
                            //
                            //System.Threading.Thread.Sleep(20);
                        }

                        //}
                        //catch (Exception ex1)
                        //{
                        //    string str = ex1.ToString();
                        //}

                        data = Encoding.ASCII.GetString(bytes, 0, bytes.Length);

                        //statRTB.AppendText(string.Format("Text received : {0}\n", data));
                        bytes = null;

                        count++;
                    }

                    handler.Shutdown(SocketShutdown.Both);
                    handler.Close();
                }
            }
            catch (Exception ex)
            {
                statRTB.AppendText(ex.ToString());
            }
        }
示例#26
0
 public static void AppendFormat(this RichTextBox textbox, string format, params object[] arg0)
 {
     textbox.AppendText(String.Format(format, arg0));
 }
示例#27
0
 public void wyswietl(RichTextBox o, string tekst)
 {
     o.Focus();
     o.AppendText(tekst);
     o.ScrollToCaret();
 }
示例#28
0
 public static void AppendLine(this RichTextBox textbox, string text)
 {
     textbox.AppendText(text + Environment.NewLine);
 }
示例#29
0
 public override void Write(char value)
 {
     base.Write(value);
     _output.AppendText(value.ToString()); // Когда символ записывается в поток, добавляем его в textbox.
 }
示例#30
0
        private void ViewSpellInfo()
        {
            _rtb.Clear();
            _rtb.SetBold();
            _rtb.AppendFormatLine("ID - {0} {1}", _spell.ID, _spell.SpellNameRank);
            _rtb.SetDefaultStyle();

            _rtb.AppendFormatLine(_line);
            _rtb.AppendFormatLineIfNotNull("Description: {0}", _spell.Description);
            _rtb.AppendFormatLineIfNotNull("ToolTip: {0}", _spell.ToolTip);
            _rtb.AppendFormatLineIfNotNull("Modal Next Spell: {0}", _spell.ModalNextSpell);
            if (_spell.Description != string.Empty && _spell.ToolTip != string.Empty && _spell.ModalNextSpell != 0)
            {
                _rtb.AppendFormatLine(_line);
            }

            _rtb.AppendFormatLine("Category = {0}, SpellIconID = {1}, activeIconID = {2}, SpellVisual = ({3},{4}), SpellPriority = {5}",
                                  _spell.Category, _spell.SpellIconID, _spell.ActiveIconID, _spell.SpellVisual[0], _spell.SpellVisual[1], _spell.SpellPriority);

            _rtb.AppendFormatLine("Family {0}, flag [0] 0x{1:X8} [1] 0x{2:X8} [2] 0x{3:X8}",
                                  (SpellFamilyNames)_spell.SpellFamilyName, _spell.SpellFamilyFlags[0], _spell.SpellFamilyFlags[1], _spell.SpellFamilyFlags[2]);

            _rtb.AppendLine();

            _rtb.AppendFormatLine("SpellSchoolMask = {0} ({1})", _spell.SchoolMask, _spell.School);
            _rtb.AppendFormatLine("DamageClass = {0} ({1})", _spell.DmgClass, (SpellDmgClass)_spell.DmgClass);
            _rtb.AppendFormatLine("PreventionType = {0} ({1})", _spell.PreventionType, (SpellPreventionType)_spell.PreventionType);

            if (_spell.Attributes != 0 || _spell.AttributesEx != 0 || _spell.AttributesEx2 != 0 || _spell.AttributesEx3 != 0 ||
                _spell.AttributesEx4 != 0 || _spell.AttributesEx5 != 0 || _spell.AttributesEx6 != 0 || _spell.AttributesEx7 != 0)
            {
                _rtb.AppendLine(_line);
            }

            if (_spell.Attributes != 0)
            {
                _rtb.AppendFormatLine("Attributes: 0x{0:X8} ({1})", _spell.Attributes, (SpellAtribute)_spell.Attributes);
            }
            if (_spell.AttributesEx != 0)
            {
                _rtb.AppendFormatLine("AttributesEx1: 0x{0:X8} ({1})", _spell.AttributesEx, (SpellAtributeEx)_spell.AttributesEx);
            }
            if (_spell.AttributesEx2 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx2: 0x{0:X8} ({1})", _spell.AttributesEx2, (SpellAtributeEx2)_spell.AttributesEx2);
            }
            if (_spell.AttributesEx3 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx3: 0x{0:X8} ({1})", _spell.AttributesEx3, (SpellAtributeEx3)_spell.AttributesEx3);
            }
            if (_spell.AttributesEx4 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx4: 0x{0:X8} ({1})", _spell.AttributesEx4, (SpellAtributeEx4)_spell.AttributesEx4);
            }
            if (_spell.AttributesEx5 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx5: 0x{0:X8} ({1})", _spell.AttributesEx5, (SpellAtributeEx5)_spell.AttributesEx5);
            }
            if (_spell.AttributesEx6 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx6: 0x{0:X8} ({1})", _spell.AttributesEx6, (SpellAtributeEx6)_spell.AttributesEx6);
            }
            if (_spell.AttributesEx7 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx7: 0x{0:X8} ({1})", _spell.AttributesEx7, (SpellAtributeEx7)_spell.AttributesEx7);
            }

            _rtb.AppendLine(_line);

            if (_spell.Targets != 0)
            {
                _rtb.AppendFormatLine("Targets Mask = 0x{0:X8} ({1})", _spell.Targets, (SpellCastTargetFlags)_spell.Targets);
            }

            if (_spell.TargetCreatureType != 0)
            {
                _rtb.AppendFormatLine("Creature Type Mask = 0x{0:X8} ({1})",
                                      _spell.TargetCreatureType, (CreatureTypeMask)_spell.TargetCreatureType);
            }

            if (_spell.Stances != 0)
            {
                _rtb.AppendFormatLine("Stances: {0}", (ShapeshiftFormMask)_spell.Stances);
            }

            if (_spell.StancesNot != 0)
            {
                _rtb.AppendFormatLine("Stances Not: {0}", (ShapeshiftFormMask)_spell.StancesNot);
            }

            AppendSkillLine();

            // reagents
            {
                var printedHeader = false;
                for (var i = 0; i < _spell.Reagent.Length; ++i)
                {
                    if (_spell.Reagent[i] == 0)
                    {
                        continue;
                    }

                    if (!printedHeader)
                    {
                        _rtb.AppendLine();
                        _rtb.Append("Reagents:");
                        printedHeader = true;
                    }

                    _rtb.AppendFormat("  {0} x{1}", _spell.Reagent[i], _spell.ReagentCount[i]);
                }

                if (printedHeader)
                {
                    _rtb.AppendLine();
                }
            }

            _rtb.AppendFormatLine("Spell Level = {0}, base {1}, max {2}, maxTarget {3}",
                                  _spell.SpellLevel, _spell.BaseLevel, _spell.MaxLevel, _spell.MaxTargetLevel);

            if (_spell.EquippedItemClass != -1)
            {
                _rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", _spell.EquippedItemClass, (ItemClass)_spell.EquippedItemClass);

                if (_spell.EquippedItemSubClassMask != 0)
                {
                    switch ((ItemClass)_spell.EquippedItemClass)
                    {
                    case ItemClass.WEAPON:
                        _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                              _spell.EquippedItemSubClassMask, (ItemSubClassWeaponMask)_spell.EquippedItemSubClassMask);
                        break;

                    case ItemClass.ARMOR:
                        _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                              _spell.EquippedItemSubClassMask, (ItemSubClassArmorMask)_spell.EquippedItemSubClassMask);
                        break;

                    case ItemClass.MISC:
                        _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                              _spell.EquippedItemSubClassMask, (ItemSubClassMiscMask)_spell.EquippedItemSubClassMask);
                        break;
                    }
                }

                if (_spell.EquippedItemInventoryTypeMask != 0)
                {
                    _rtb.AppendFormatLine("    InventoryType mask = 0x{0:X8} ({1})",
                                          _spell.EquippedItemInventoryTypeMask, (InventoryTypeMask)_spell.EquippedItemInventoryTypeMask);
                }
            }

            _rtb.AppendLine();
            _rtb.AppendFormatLine("Category = {0}", _spell.Category);
            _rtb.AppendFormatLine("DispelType = {0} ({1})", _spell.Dispel, (DispelType)_spell.Dispel);
            _rtb.AppendFormatLine("Mechanic = {0} ({1})", _spell.Mechanic, (Mechanics)_spell.Mechanic);

            _rtb.AppendLine(_spell.Range);

            _rtb.AppendFormatLineIfNotNull("Speed {0:F}", _spell.Speed);
            _rtb.AppendFormatLineIfNotNull("Stackable up to {0}", _spell.StackAmount);

            _rtb.AppendLine(_spell.CastTime);

            if (_spell.RecoveryTime != 0 || _spell.CategoryRecoveryTime != 0 || _spell.StartRecoveryCategory != 0)
            {
                _rtb.AppendFormatLine("RecoveryTime: {0} ms, CategoryRecoveryTime: {1} ms", _spell.RecoveryTime, _spell.CategoryRecoveryTime);
                _rtb.AppendFormatLine("StartRecoveryCategory = {0}, StartRecoveryTime = {1:F} ms", _spell.StartRecoveryCategory, _spell.StartRecoveryTime);
            }

            _rtb.AppendLine(_spell.Duration);

            if (_spell.ManaCost != 0 || _spell.ManaCostPercentage != 0 || _spell.PowerType != 0 ||
                _spell.ManaCostPerlevel != 0 || _spell.ManaPerSecond != 0 || _spell.ManaPerSecondPerLevel != 0)
            {
                _rtb.AppendFormat("Power {0}, Cost {1}",
                                  (Powers)_spell.PowerType, _spell.ManaCost == 0 ? _spell.ManaCostPercentage + " %" : _spell.ManaCost.ToString());
                _rtb.AppendFormatIfNotNull(" + lvl * {0}", _spell.ManaCostPerlevel);
                _rtb.AppendFormatIfNotNull(" + {0} Per Second", _spell.ManaPerSecond);
                _rtb.AppendFormatIfNotNull(" + lvl * {0}", _spell.ManaPerSecondPerLevel);
                _rtb.AppendLine();
            }

            _rtb.AppendFormatLine("Interrupt Flags: 0x{0:X8}, AuraIF 0x{1:X8}, ChannelIF 0x{2:X8}",
                                  _spell.InterruptFlags, _spell.AuraInterruptFlags, _spell.ChannelInterruptFlags);

            if (_spell.CasterAuraState != 0)
            {
                _rtb.AppendFormatLine("CasterAuraState = {0} ({1})", _spell.CasterAuraState, (AuraState)_spell.CasterAuraState);
            }

            if (_spell.TargetAuraState != 0)
            {
                _rtb.AppendFormatLine("TargetAuraState = {0} ({1})", _spell.TargetAuraState, (AuraState)_spell.TargetAuraState);
            }

            if (_spell.CasterAuraStateNot != 0)
            {
                _rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", _spell.CasterAuraStateNot, (AuraState)_spell.CasterAuraStateNot);
            }

            if (_spell.TargetAuraStateNot != 0)
            {
                _rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", _spell.TargetAuraStateNot, (AuraState)_spell.TargetAuraStateNot);
            }

            if (_spell.MaxAffectedTargets != 0)
            {
                _rtb.AppendFormatLine("MaxAffectedTargets = {0}", _spell.MaxAffectedTargets);
            }

            AppendSpellAura();

            AppendAreaInfo();

            _rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", _spell.RequiresSpellFocus);

            if (_spell.ProcFlags != 0)
            {
                _rtb.SetBold();
                _rtb.AppendFormatLine("Proc flag 0x{0:X8}, chance = {1}, charges - {2}",
                                      _spell.ProcFlags, _spell.ProcChance, _spell.ProcCharges);
                _rtb.SetDefaultStyle();
                _rtb.AppendFormatLine(_line);
                _rtb.AppendText(_spell.ProcInfo);
            }
            else
            {
                _rtb.AppendFormatLine("Chance = {0}, charges - {1}", _spell.ProcChance, _spell.ProcCharges);
            }

            AppendSpellEffectInfo();
            AppendItemInfo();
            AppendDifficultyInfo();

            AppendSpellVisualInfo();
        }
示例#31
0
 public void ShowSerialLog(RichTextBox rtxtLog)
 {
     rtxtLog.AppendText(RcvLog);
     RcvLog = "";
 }
示例#32
0
        private void Slot_MouseDownBlow(object sender, MouseEventArgs e)
        {
            var hs = (Button)sender;
            var nc = (KeyValuePair <AirSlotAttributesClass, InstrumentsNotesClass>)hs.Tag;

            Application.DoEvents();
            hs.BackColor = Color.Green;

            sa.NoteOn(nc.Value.GetNoteByte(), 65, 0);
            if (writeNoteToText)
            {
                timePlayed.Restart();
                SongText.AppendText($@"{nc.Value.Note}");
            }
            Application.DoEvents();
            Thread.Sleep(100);
        }
示例#33
0
        public void Drop(RichTextBox richTextBox, object sender, DragEventArgs e)
        {
            #region Opid funkcji

            /* Funkcja podczas upuszczenia pliku na RichTextBox'ie wstawia do niego w zależności od rozszerzenia nazwy pliku:
             *  - obraz (pliki: jpg, jpeg, bmb, gif, tif
             *  - tekst (pliki txt)
             */
            #endregion
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                try
                {
                    //Pobranie scieżki do pliku
                    string[] filePath = e.Data.GetData(DataFormats.FileDrop) as string[];
                    if (filePath != null)
                    {
                        if (File.Exists(filePath[0]))
                        {
                            foreach (var file in filePath)
                            {
                                int    dlugosc     = file.Length;
                                int    znak        = file.LastIndexOf(".");
                                string formatPliku = file.Substring(dlugosc - (dlugosc - znak - 1)).ToLower();

                                if (formatPliku.ToLower() == "txt")  //Plik tekstowy
                                {
                                    richTextBox.AppendText(File.ReadAllText(file) + "\n");
                                }
                                else if (formatPliku == "jpg" || formatPliku == "jpeg" || formatPliku == "bmp" || formatPliku == "gif" || formatPliku == "tif")   //Plik obrazu
                                {
                                    bitmap = new BitmapImage(new Uri(file, UriKind.Absolute))
                                    {
                                        CacheOption = BitmapCacheOption.OnLoad
                                    };
                                    bitmap.Freeze();
                                    image        = new Image();
                                    image.Source = bitmap;

                                    if (image != null)
                                    {
                                        image.Height = bitmap.Height;   //przypisanie rozmiaru Image z orginału (Bitmapy)
                                        image.Width  = bitmap.Width;
                                        //INSERT IMAGE
                                        BlockUIContainer container = new BlockUIContainer(image);
                                        richTextBox.Document.Blocks.Add(container);

                                        //Dodoanie ZNACZNIKÓW dla narozników AKTUALNIE wstawianego zdjecia dla RESIZE za pomocą klasy ResizingAdorner
                                        image.Loaded += delegate
                                        {
                                            AdornerLayer al = AdornerLayer.GetAdornerLayer(image);
                                            if (al != null)
                                            {
                                                al.Add(new ResizingAdorner(image, true)); //true - rozciąganie proporcjonalne
                                            }
                                        };
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
示例#34
0
 public static void smethod_0(RichTextBox richTextBox_0, string string_0, Color color_0)
 {
     int length = richTextBox_0.Text.Length;
     richTextBox_0.AppendText(string_0 + "\r\n\r\n");
     richTextBox_0.Select(length, checked(string_0.Length + 1));
     richTextBox_0.SelectionColor = color_0;
     richTextBox_0.Select(length, 0);
     richTextBox_0.ScrollToCaret();
     if (richTextBox_0.Lines.Length >= 150)
     {
         richTextBox_0.Clear();
     }
 }
示例#35
0
        public void LogWind(int wind)
        {
            int deltaWind = 0;

            if (lastWind == null)
            {
                deltaWind = wind;
            }
            else
            {
                deltaWind = wind - (int)lastWind;
            }

            lastWind = wind;

            string dws = "";

            if (deltaWind > 0)
            {
                if (enemyDir == 1)
                {
                    dws = "\t(∆ = " + deltaWind + " ►, ∆ѳ = ◄ " + (deltaWind / 10) + "°)";
                }
                else
                {
                    dws = "\t(∆ = ◄ " + (-1 * deltaWind) + ", ∆ѳ = " + (deltaWind / 10) + "° ►)";
                }
            }

            else if (deltaWind < 0)
            {
                if (enemyDir == 1)
                {
                    dws = "\t(∆ = ◄ " + (-1 * deltaWind) + ", ∆ѳ = " + Math.Abs(deltaWind / 10) + "° ►)";
                }
                else
                {
                    dws = "\t(∆ = ◄ " + (-1 * deltaWind) + ", ∆ѳ = ◄ " + Math.Abs(deltaWind / 10) + "°)";
                }
            }
            else
            {
                dws = "\t(∆ = " + deltaWind + ", ∆ѳ = 0°)";
            }

            /*if (deltaWind > 0)
             *  dws = "\t(∆ = " + deltaWind + " ►)";
             * else if (deltaWind < 0)
             *  dws = "\t(∆ = ◄ " + (-1 * deltaWind) + ")";
             * else
             *  dws = "\t(∆ = " + deltaWind + ")";*/

            if (wind > 0)
            {
                log.AppendText(wind + " ►" + dws + Environment.NewLine);
            }
            else if (wind < 0)
            {
                log.AppendText("◄ " + (-1 * wind) + dws + Environment.NewLine);
            }
            else
            {
                log.AppendText(wind + dws + Environment.NewLine);
            }

            windChart.Series["wind_history"].Points.Add(new DataPoint(x, wind));
            x++;
        }