public static string Read_config_txt()
{
string config_txt_content = "";
string exe_path = Application.ExecutablePath;
int startIndex = exe_path.IndexOf("Debug");
string temp_filebox_path = exe_path.Substring(0, startIndex);
StreamReader sr = new StreamReader((temp_filebox_path "config.txt"), Encoding.UTF8);
string a_line_content = "";
while ((a_line_content = sr.ReadLine()) != null)
{
config_txt_content = config_txt_content a_line_content;
config_txt_content = config_txt_content.Replace("\t", "");
config_txt_content = config_txt_content.Replace("\r\n", "");
config_txt_content = config_txt_content.Replace(" ","");
}
sr.Close();
return config_txt_content;
}
public static void Write_config_txt(string config_txt_content)
{
string exe_path = Application.ExecutablePath;
int startIndex = exe_path.IndexOf("Debug");
string temp_filebox_path = exe_path.Substring(0, startIndex);
StreamWriter sw = File.CreateText(temp_filebox_path "config.txt"); //追加写入
sw.Write(config_txt_content);
sw.Flush();
sw.Close();
}
评论