[red]Useless[/red]
pawn Code:
xini_remove(filename[])
{
if(!fexist(filename)) return false;
fremove(filename);
return true;
}
[blue]native bool:fremove(const name[]);[/blue] fails if the file doesn't exist.
Basically this does exactly the same as fremove (not thinking about uselessly called fexist...).
[red]Uneffective, bad managed code[/red]
pawn Code:
new File:file, File:file2, line[MAX_STRING], key2[MAX_STRING], header2[MAX_STRING], filename2[MAX_STRING], tmp[MAX_STRING];
format(filename2,MAX_STRING,"%s.xini",filename);
if((file = fopen(filename,io_read)) && (file2 = fopen(filename2,io_write)))
[blue]MAX_STRING = 255[/blue] => you allocate 1275 bytes of memory (what is really a lot for a such simple function) even before checking if the file exists...
Seriously, first learn how to write effective code and JUST then release something.
[red]Doesn't allow you to choose file name[/red]
pawn Code:
format(filename2,MAX_STRING,"%s.xini",filename);
Because it always appends .xini to end of the file name.
[red]Bad written include[/red]
pawn Code:
native xini_get(filename[],header[],key[],bool:ignorecase=true);
native xini_set(filename[],header[],key[],value[],bool:ignorecase=true);
native xini_iskeyset(filename[],header[],key[],bool:ignorecase=true);
native xini_isheaderset(filename[],header[],bool:ignorecase=true);
native xini_setint(filename[],header[],key[],value,bool:ignorecase=true);
native xini_int(filename[],header[],key[],bool:ignorecase=true);
native xini_setfloat(filename[],header[],key[],Float:value,bool:ignorecase=true);
native Float:xini_float(filename[],header[],key[],bool:ignorecase=true);
native xini_create(filename[]);
native xini_remove(filename[]);
native xini_truncreate(filename[]);
native xini_getstore(filename[],value[],refheader[],refkey[],offset=0,bool:ignorecase=true);
xini_set is [blue]bool[/blue], but native is withoud [blue]"bool"[/blue] -> [green]native xini_set(filename[],header[],key[],value[],bool:ignorecase=true);[/green] <- (the same problem with xini_iskeyset, xini_isheaderset, xini_setint, xini_setfloat, xini_getstore, xini_unsetheader)
These functions aren't [blue]stock[/blue]-ed, so compiler compiles entire include even if you don't use any of xini functions.
And also there is [red]"unnatived"[/red] function... so if you don't read entire include (because it is the last function in the include), you won't probably know about xini_unsetheader...
EDIT: Windows already contains similar functions: [green]GetPrivateProfileString WritePrivateProfileString[/green] -> perfect idea for a plugin.