我需要一次将大量文本写入文件,但它必须以特定方式格式化,而不是全部在一行中。
我的代码是:
If System.IO.File.Exists(filepath) Then
Using reader As StreamReader = New StreamReader(filepath)
sLine = reader.ReadToEnd
End Using
Using writer As StreamWriter = New StreamWriter(filepath)
writer.Write("[HealthBarSettings]
MaxHealthTicks = 50
MaxHealthMicroTicks = 100
DefaultHealthPerMicroTick = 50
DefaultHealthPerTick = 200
DefaultHealthPerMegaTick = 1000
TickAlpha = 200
MicroTickAlpha = 140
MicroTickHeight = 0.5
MegaTickAlpha = 255
TickThickness = 1.0
MicroTickThickness = 1.0
MegaTickThickness = 2.0
UseCompression = 1
GoTransparent = 1
[GeneralDataHero]()
FadeTimerForHealthBar = 2.0
ZeroHealthAlpha = 225
FullHealthAlpha = 200
DefaultChampionCollisionRadius = 65.0")
End Using
MsgBox("File Written")
Else
MsgBox("File does not exist")
End If
但这不起作用,因为它不会使用所有文本,而只是使用“[HealthBarSettings]”并在此之后自动结束引用。