Я делаю приложение, чтобы изменить разрешение этой игры на требуемое разрешение.C# Заменить подстановочный знак
StreamReader reader = new StreamReader(@"C:\Documents and Settings\ARTech\Bureaublad\PersistentSymbols.ini");//Reads the file.
string content = reader.ReadToEnd();//Puts the content of the file, into a variable.
reader.Close();
string replace = "persistent extern INDEX m_pixScreenWidth=(INDEX)" + txtWidth.Text + ";";
content = content.Replace("persistent extern INDEX m_pixScreenWidth=(INDEX)1920;", replace);//Replaces the ScreenWidth of the game to the requested number.
replace = "persistent extern INDEX m_pixScreenHeight=(INDEX)" + txtHeight.Text + ";";
content = content.Replace("persistent extern INDEX m_pixScreenHeight=(INDEX)1200;", replace);//Replaces the ScreenHeight of the game to the requested number.
StreamWriter writer = new StreamWriter(@"C:\Documents and Settings\ARTech\Bureaublad\PersistentSymbols.ini");
writer.Write(content);//Saves the changes.
writer.Close();
Проблема заключается в том, что разрешение не всегда 1920 х 1200, так что мне нужно какое-то шаблона, который принимает все между persistent extern INDEX m_pixScreenWidth=(INDEX)
и ;
.
Вскоре вам нужно получить что-то вроде m_pixScreenHeight = [0-9] * в качестве регулярного выражения – ykatchou