Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Deneuralyzer : Form
- {
- public Deneuralyzer()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- using System;
- using System.IO;
- using System.Text.RegularExpressions;
- string filePath = @"C:\Program Files (x86)\location\to\application\textfile.txt";
- string searchText = "Count,2,";
- string replaceText = "Count,200,";
- ReplaceInFile(filePath, searchText, replaceText);
- static public void ReplaceInFile(string filePath, string searchText, string replaceText)
- {
- StreamReader reader = new StreamReader(filePath);
- string content = reader.ReadToEnd();
- reader.Close();
- content = Regex.Replace(content, searchText, replaceText);
- StreamWriter writer = new StreamWriter(filePath);
- writer.Write(content);
- writer.Close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement