[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
#2

I think this one is same as y_ini or what? anyway nice release.
Reply
#3

like y_ini? absulutely no
Reply
#4

pawn Код:
stock s3_Create(file[])
{
    new
           File:FCreate = fopen(file, io_write)
        ;
        return fclose(FCreate);
}
u mad bro?

not good, but okay
Reply
#5

Quote:
Originally Posted by System64
Посмотреть сообщение
pawn Код:
stock s3_Create(file[])
{
    new
           File:FCreate = fopen(file, io_write)
        ;
        return fclose(FCreate);
}
u mad bro?

not good, but okay
why ?
Reply
#6

Quote:
Originally Posted by System64
Посмотреть сообщение
pawn Код:
stock s3_Create(file[])
{
    new
           File:FCreate = fopen(file, io_write)
        ;
        return fclose(FCreate);
}
u mad bro?

not good, but okay
Yes, dafuq's wrong with it?
Reply
#7

nothing, my fault :/

Just take a look on y_ini script and this... but anyway, I appreciate your work
Reply
#8

I guess this is slow.
Reply
#9

Horrible way to name your functions! What's wrong with "INI"?
Reply
#10

Quote:
Originally Posted by -Prodigy-
Посмотреть сообщение
Horrible way to name your functions! What's wrong with "INI"?
yeah i was thinking about this problem. sure may i'll change it
Reply
#11

what the speed difference against Y_ini?
what makes this better and why would one move to this over y_ini?

these are questions people will want to know before even trying this.
Reply
#12

Is nice, good work !
Reply
#13

Quote:
Originally Posted by Madd Kat
Посмотреть сообщение
what the speed difference against Y_ini?
what makes this better and why would one move to this over y_ini?

these are questions people will want to know before even trying this.
I didn't told that you move to this over y_ini. If you would better read you see the message "I know exist much better file system, but is good if you will present yourself."


Quote:
Originally Posted by [Nikk]
Посмотреть сообщение
Is nice, good work !
Thank you man ,..
Reply
#14

+Rep
Reply
#15

Quote:
Originally Posted by s3rious
Посмотреть сообщение
I didn't told that you move to this over y_ini. If you would better read you see the message "I know exist much better file system, but is good if you will present yourself."
yes i understand

well +rep just for giving something to the community!
Reply
#16

I appreciate your work on this. However, if you look at it in a real perspective I doubt a lot of people will switch to this, but really. Goodjob man. Kudos
Reply
#17

Thank you guys for you support i will go to get better
Reply
#18

pawn Код:
stock s3_Create(file[])
{
    new
           File:FCreate = fopen(file, io_write)
        ;
        return fclose(FCreate);
}
pawn Код:
stock s3_Create(file[])
{
        return fclose(fopen(file, io_write));        
}
Reply
#19

Good work keep up the good work and try to make it faster. Anyway good work..
Reply
#20

You can't write/read strings??
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)