Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace linqParametry
  12. {
  13.     public partial class Glowne : Form
  14.     {
  15.         public Glowne()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void buttonStart_Click(object sender, EventArgs e)
  21.         {
  22.             try
  23.             {
  24.                 string input = richTextBoxStart.Text;
  25.                 string deleteText =  input.Substring(input.IndexOf("parameters") + 11);
  26.                 //string[] split = richTextBoxFinish.Text.Split(new string[] { "{" }, StringSplitOptions.None);
  27.                 var newText = deleteText.Replace('{', ' ').Replace('}', ' ').Replace(" ", "").Replace("True", "1");
  28.                
  29.                 var splittedText = newText.Split(',');                
  30.                 var aStringBuilder = new StringBuilder(input);                
  31.                 int i = 0;
  32.                 string j = ":p" + i;
  33.                 foreach (var item in splittedText)
  34.                 {
  35.                     aStringBuilder.Replace(":p" + i , " " + splittedText[i]);                    
  36.                     i++;
  37.                 }
  38.                 string pomoc = aStringBuilder.ToString();
  39.                 if (pomoc.Contains("' with parameters"))
  40.                     pomoc = pomoc.Substring(0, pomoc.LastIndexOf("' with parameters"));
  41.  
  42.                 richTextBoxFinish.Text = pomoc;
  43.  
  44.             }
  45.             catch (Exception ex)
  46.             {
  47.                 MessageBox.Show(ex.ToString());
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement