[Include] s3File - s3riously INI file system (Write/Read)
#1

s3File - File Reading & Writing


After long time i want to start publish my script's. As first i will show my simple ini system s3File. I know exist much better file system, but is good if you will present yourself.

Version 1.2 changelog:
Код:
token s3 changed to INI - for easier write
improved create function - tnx ******
Version 1.4 changelog:
Код:
optimized code
added functions:
- GetFile
- SetFile
- WriteHex
- ReadHex
Rebuilded Close & Load Function
Bool is written as True or False (not 0/1)
Foreword
This ini system was compared with dini. Result - s3File is 5 times faster than dini. Why? Because s3File will write values only one time. Load file -> write(or)read -> Close file. Predefined function for writing and reading has assigned file in global variable and handle with them until the script does not call Close function.

Writing
pawn Код:
INI_Load("myini.ini");
INI_Write("NAME", "s3rious");
INI_WriteInt("TEAM", 0);
INI_Close();
- In this part of code s3File will load myini.ini file and set key "NAME" to value "s3rious". You can see, that isn't any variable for new file. INI_Write function will handle with file, was loaded by INI_Load("myini.ini");.

Reading
pawn Код:
INI_Load("myini.ini");
varA = INI_ReadInt("a");
varB = INI_ReadFloat("b");
INI_Close();
- This code is like above, but method is GET. This function, s3File will load file and read value of key "a". After success action script store value of readed key to variable varA. In the end will close file.

Be careful. When you load file make sure if called file exist. For create file you must use INI_Create("file.ini"); function. (with own name of file)

Download:
Version 1.1: http://pastebin.com/MYK5SXmH
Version 1.2: http://pastebin.com/pXd3qZr2
Version 1.4: http://pastebin.com/vJ7andKd
Version 1.5: http://pastebin.com/S7eQb1Sy
Reply


Messages In This Thread
s3File - s3riously INI file system (Write/Read) - by s3rious - 27.02.2012, 17:49
Re: s3File - s3riously INI file system (Write/Read) - by WoodPecker - 27.02.2012, 18:04
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 27.02.2012, 18:24
Re: s3File - s3riously INI file system (Write/Read) - by System64 - 27.02.2012, 18:33
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 27.02.2012, 18:33
Re: s3File - s3riously INI file system (Write/Read) - by FireCat - 27.02.2012, 18:36
Re: s3File - s3riously INI file system (Write/Read) - by System64 - 27.02.2012, 18:42
Re: s3File - s3riously INI file system (Write/Read) - by TheArcher - 27.02.2012, 19:00
Re: s3File - s3riously INI file system (Write/Read) - by -Prodigy- - 27.02.2012, 20:05
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 27.02.2012, 20:11
Re: s3File - s3riously INI file system (Write/Read) - by Madd Kat - 27.02.2012, 21:16
Respuesta: s3File - s3riously INI file system (Write/Read) - by [Nikk] - 27.02.2012, 21:52
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 27.02.2012, 22:08
Re: s3File - s3riously INI file system (Write/Read) - by DonWade - 27.02.2012, 22:31
Re: s3File - s3riously INI file system (Write/Read) - by Madd Kat - 27.02.2012, 22:54
Re: s3File - s3riously INI file system (Write/Read) - by Walsh - 27.02.2012, 23:14
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 28.02.2012, 11:46
Re: s3File - s3riously INI file system (Write/Read) - by CaHbKo - 28.02.2012, 12:04
Re: s3File - s3riously INI file system (Write/Read) - by trapped1 - 28.02.2012, 12:04
Re: s3File - s3riously INI file system (Write/Read) - by Shadow_ - 28.02.2012, 12:22
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 28.02.2012, 15:34
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 04.03.2012, 21:20
Re: s3File - s3riously INI file system (Write/Read) - by s3rious - 20.04.2012, 20:02

Forum Jump:


Users browsing this thread: 3 Guest(s)