Well I am updating my lazy code Generator (EasyCode)... and try to figure the right way to read/write a project file (.b4j), and bas files too...
So tried to use the following code to read the lines into a list (but i think is wrong)
... Seems good .. but if check the output... more find that the new output has only LF.. and no CRLF at the end of lines... so B4J IDE can't open the new project...
May be need to read line by line as string... input stream? anyone tried to read/write/edit b4j files?
So tried to use the following code to read the lines into a list (but i think is wrong)
B4X:
Dim allcode As List=File.ReadList(expdir & "/B4J","B4JProject.b4j")
Dim allcode2 As List
allcode2.Initialize
For k=0 To 6
allcode2.Add(allcode.Get(k))
Next
Dim n As Int = 5
For k=0 To lviews.Size-1 'For example i want to auto add/sync the new files will be added to a B4J Project
If File.Exists(seldir,lfile(k)) Then
n=n+1
Dim s As String=n
allcode2.Add("File" & s.Trim & "=" & lfile(k))
End If
If File.Exists(seldir,lfile(k).Replace(".view",".json")) Then
n=n+1
Dim s As String=n
allcode2.Add(("File" & s.Trim & "=" & lfile(k).Replace(".view",".json") ))
End If
If File.Exists(seldir,lfile(k).Replace(".view",".json")) Then
n=n+1
Dim s As String=n
allcode2.Add(("File" & s.Trim & "=" & lfile(k).Replace(".view",".html") ))
End If
Next
...
...
File.WriteList(expdir & "/B4J","B4JProject.b4j",allcode2)
... Seems good .. but if check the output... more find that the new output has only LF.. and no CRLF at the end of lines... so B4J IDE can't open the new project...
May be need to read line by line as string... input stream? anyone tried to read/write/edit b4j files?