Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- 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;
- using System.Text.RegularExpressions;
- namespace SteamFontChanger
- {
- public partial class Form1 : Form
- {
- int newFont = 16;
- int prevFont;
- string line;
- string oldFont = " font-size=";
- string filePath = "readme.txt";
- string startLine = "friends_chat_text";
- string fontLine = " font-size=";
- string endLine = "friends_chat_accountid";
- string newFontS;
- public Form1()
- {
- InitializeComponent();
- System.IO.StreamReader prevFontRead = new System.IO.StreamReader("C:\\Users\\chris\\Desktop\\SteamFontSize\\prevfont.txt");
- prevFont = int.Parse(prevFontRead.ReadLine());
- oldFont = " font-size=" + prevFont;
- prevLabel.Text = "Previous " + oldFont;
- }
- /// <summary>
- /// Edits the text in a file
- /// </summary>
- //v the below code
- private void editText()
- {
- System.IO.StreamReader read = new System.IO.StreamReader(filePath);
- StringBuilder write = new StringBuilder(filePath);
- while ((line = read.ReadLine()) != null)
- {
- if (startLine == read.ReadLine())
- {
- while ((line = read.ReadLine()) != endLine)
- {
- write.Replace(oldFont, newFontS);
- }
- }
- }
- MessageBox.Show("Done!");
- }
- // ^ the above code ^
- private void changeFont_Click(object sender, EventArgs e)
- {
- MessageBox.Show("If you have not done so, exit steam completely.");
- if (filePath != "readme.txt")
- {
- newFontS = fontLine + newFont.ToString();
- editText();
- }
- else
- {
- MessageBox.Show("Error: " + filePath + " is not a valid path, did you change the path?");
- }
- }
- private void textPath_TextChanged(object sender, EventArgs e)
- {
- filePath = textPath.Text + "\\steam\\resource\\styles\\steam.txt";
- }
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- //trying to get variable from box
- newFont = Convert.ToInt32(fontBox.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement