Closed LibraChris closed 3 years ago
Hey, could you give a little more info about the format in this PR? Also two more things are needed:
Updated Reader code to better fit the gdf format. Added Documentation for the Reader.
Known issues
[x] Add a test for the writer
[x] Update to dotnet 5.0.100. At the moment, only dotnet 3.1. seems to build
[x] Review exit condition in GDF.fs -> splitElementInfos -> Handle commas
let private splitElementInfos (line:string) =
let chars = line.ToCharArray()
let rec stringDeconstruction insideQuote potEmpty i vertexInfos (sb:StringBuilder) =
match chars.[i] with
// Handle quote marks
| '\'' when i = chars.Length-1 -> sb.ToString() :: vertexInfos
| '\'' when insideQuote -> stringDeconstruction false false (i+1) vertexInfos (sb)
| '\'' -> stringDeconstruction true false (i+1) vertexInfos (sb)
// Handle commas
| ',' when insideQuote -> stringDeconstruction insideQuote false (i+1) vertexInfos (sb.Append ',')
| ',' when i = chars.Length-1 -> "" :: vertexInfos
| ',' when potEmpty = true -> stringDeconstruction false false (i+1) (""::vertexInfos) (sb.Clear())
| ',' -> stringDeconstruction insideQuote true (i+1) (sb.ToString() :: vertexInfos) (sb.Clear())
// Handle every other symbol
| c when i = chars.Length-1 -> sb.Append(c).ToString() :: vertexInfos
| c -> stringDeconstruction insideQuote false (i+1) vertexInfos (sb.Append c)
stringDeconstruction false false 0 [] (StringBuilder())
|> List.rev
|> List.toArray
If all needed for reading and writing GDF files is implemented, I'd merge this PR. What do you think, @LibraChris?
Everything should be woking fine. Thank you.
Nice Work!