-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
0x wrote code and pinged me for my opinion
my opinion for serialization remains conversational
I wrote this when testing the lib
auto parseIniFile(string filePath) {
import std.file : readText;
return parseIniAA(readText(filePath));
}
auto parseSimpleIniFile(string filePath) {
return parseIniFile(filePath)[""];
}
void writeIniFile(string filePath, IniDocument!string document) {
import std.file : write;
return write(filePath, stringifyIni(document));
}
void hotloadSave(Args...)(string filePath="data.ini"){
import std.file;
import std.conv;
auto file=File(filePath,"w");
static foreach(I;0..Args.length){
file.writeln(Args[I].stringof,"=",Args[I].to!string);
}
}
void hotloadLoad(Args...)(string filePath="data.ini"){
import std.conv;
foreach(key,value;parseSimpleIniFile(filePath)){
lable:switch(key){
static foreach(I;0..Args.length){
case Args[I].stringof:
writeln(Args[I].stringof,",",value);
Args[I]=value.to!(typeof(Args[I])); break lable;
}
default: writeln(key,value,"missed");
}
}}When 0x.ini moves to odc.ini or adrs.ini; I will want some kind of hotloading api
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels