【发布时间】:2023-03-06 13:27:02
【问题描述】:
所以,我知道我的标题有点混乱,但我可以解释一下我自己,我希望有人能知道我可以在这里做什么。
我有一个网站(网络表单,asp.net 4.5),我已经为我的朋友构建了它,但我不知道该怎么做,
当有人点击一个按钮然后网站读取一个文本文件时,我需要这样说:
var xml = XDocument.Load(xmlplace + "\\AppSettings.xml");
string place = xml.Element("Settings").Element("App").Attribute("Dir").Value.ToString();
string temname = Template1.Text;
HTMLTEXT.Text = File.ReadAllText(place + "/" + temname + ".html");
HTMLTEXT = 网站中的一个文本框,所有文本文件信息都存放在这里。
现在,此功能 100% 有效。这是完美的。但后来我的朋友让我做别的事情..
他给了我这段文字:
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
//this arena
Show only this
Show only this
//end Arena
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
他希望我从文件中取出所有文本,但只显示 //this arena 文本,其中 //this arena 是开始,//end arena 是它的结束。
我真的不知道如何为此使用 IO 或任何其他方式。有人知道吗?
顺便说一句,如果我没有解释我自己,请告诉我,以便我可以改变并尝试更好地解释。
编辑:
如果您还可以告诉我如何将更改后的文件保存回来,那就太好了,谢谢。
非常感谢,任何帮助的人。
【问题讨论】: