29.01.2011, 11:43
(
Последний раз редактировалось Drake1994; 25.12.2014 в 22:08.
Причина: no need plugins if you dont want
)
dFile
The fastest file and directory management.
What is this?The fastest file and directory management.
This is a new file management system, which not only the files but the directories can handle!
Anywhere able to save a file.
Warning: The system will save the file next to the server startup!
Why is this?
The system is very simple and straightforward, similar to features in the file manager but it does not contain any other unnecessary things!
There is still a big advantage: It is the fastest file management system! Why? Cause It's based on plugin.
Who made it?
The plugin created JaTochNietDan.
/*
* Dfile 1.0.4
* All rights reserved! © By: Drake
*
* Owner: Drake
* Time: 01/27/2011
*
* This function may be freely distributed.
* And of course, free to use: D
* Thanks to:
* ChuckNorris - Testing, Help
* Fade - Testing, Help
* ****** - boolstr function
* JaTochNietDan - FileManager
*
* Special thanks to:
* Thiadmer - Pawn.
* SA: MP Team Past, Present, Future - SA: MP.
*/
Compare with y_ini:
Features:
dfile_Create - Create a file. Keys:
Код:
(file [])
dfile_Delete - Delete file.
Код:
(file [])
dfile_Open - Open File.
Код:
(file [])
dfile_CreateDirectory - Create a directory.
Код:
(folder [])
dfile_DeleteDirectory - Remove a directory.
Код:
(folder [])
dfile_DirectoryExists - Verify that the folder exists
Код:
Folder []
dfile_WriteString - Write a string to a file.
Код:
(parameter [], value [])
val [] something.
Example:
Код:
key = value
Код:
(parameter [], value [])
val [] something.
Example:
Код:
key = value
Код:
(parameter [], bool: value)
bool: You know what. (False / true)
Example:
Код:
key = true
Код:
(parameter [], value [])
val [] something.
Example:
Код:
key = value
Код:
(parameter[])
dfile_ReadInt - Integer read from a file.
Код:
(parameter [])
dfile_ReadFloat - Read a floating point number from a file.
Код:
(parameter [])
dfile_ReadBool - Read a bool value from a file.
Код:
(parameter [])
dfile_MoveFile - Move a file folder. It is important for the extension and that the destination folder exists!
Код:
(file [], cel [])
End [] to.
dfile_RenameFile - Rename a file name. The extension is important!
Код:
(oldname [], newname[])
newname [] The file new name.
dfile_SaveFile - Values to save the file.
Код:
file []
dfile_FileExists - Verify that the file exists
Код:
file []
dfile_ParseString - Compares the parameters and the input string.
Код:
(file [] parameter [], value [])
parameter [] is the key name
val [] value, which compares the key value.
dfile_ParseInt - Compares the input parameter and an integer value.
Код:
(file [] parameter [], value [])
parameter [] is the key name
val [] value, which compares the key value.
dfile_ParseFloat - Compares the argument and entered a float value.
Код:
(file [] parameter [], value [])
parameter [] is the key name
val [] value, which compares the key value.
dfile_ParseBool - Compares the input parameter and the Boolean value.
Код:
(file [] parameter [], value [])
parameter [] is the key name
val [] value, which compares the key value.
dfile_IsSet - Check if the key have value.
Код:
(parameter[])
dfile_UnSet - Delete the key value.
Код:
(parameter [])
dfile_MultiSet - Tцbb йrtйk нrбsa fбjlba.
Код:
(tipusok[], {Float,_}:...)
Possible types:
- "s" - string
- "d" - integer
- "b" - boolean
- "f" - float
Код:
(tipusok[], {Float,_}:...)
Possible types:
- "s" - string
- "d" - integer
- "b" - boolean
- "f" - float
Код:
#include <a_samp> #include <dfile> #include <YSI\y_ini> #define FILTERSCRIPT new gInt, formalas[128]; #define fDFILE "DFILE_Test.txt" #define fYINI "YINI_Test.txt" #define WRITES 1000 #define READS 100000 public OnFilterScriptInit() { print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); print("---------------------"); print("Writing Tests Started"); new initialTick, DFILE_tick, YINI_tick; print("-Testing dFile"); //dFile Write { dfile_Create(fDFILE); dfile_Open(fDFILE); initialTick=GetTickCount(); for(new i;i<WRITES;i++)format(formalas, sizeof(formalas), "%d", i), dfile_WriteInt(formalas, i); dfile_SaveFile(); dfile_CloseFile(); DFILE_tick=GetTickCount()-initialTick; } print("-Testing Yini\n"); //Yini Write { new INI:file = INI_Open(fYINI); initialTick=GetTickCount(); for(new i;i<WRITES;i++)format(formalas, sizeof(formalas), "%d", i), INI_WriteInt(file, formalas, i); INI_Close(file); YINI_tick=GetTickCount()-initialTick; } printf("\n-nTest Results %d Writes\n", WRITES); printf(" - dFile:\t%d", DFILE_tick); printf(" - Yini:\t%d", YINI_tick); print("---------------------\n\n"); print("---------------------"); print("Reading Tests Started"); print("-Testing dFile"); { dfile_Create(fDFILE); dfile_Open(fDFILE); initialTick=GetTickCount(); for(new i;i<READS;i++)dfile_ReadInt("0"); DFILE_tick=GetTickCount()-initialTick; } print("-Testing Yini\n"); { new INI:file = INI_Open(fYINI); initialTick=GetTickCount(); for(new i;i<READS;i++) { INI_Load(fYINI); } INI_Close(file); YINI_tick=GetTickCount()-initialTick; } printf("\n- Test Results %d Reads\n", READS); printf(" - dFile:\t%d", DFILE_tick); printf(" - Yini:\t%d\n\n", YINI_tick); print("---------------------"); } INI:filename[](name[], value[]) { INI_Int("TEST_TAG", gInt); return 0; }
Код:
#include <a_samp> #include <dfile> main() { new variable1[3][128], variable2[2], float:variable3, bool:variable4; dfile_Create("test.ini"); dfile_Open("test.ini"); dfile_WriteString("parameter0", "test1234234"); dfile_WriteInt("parameter1", 999999999); dfile_WriteFloat("parameter2", 0.97398457987); dfile_WriteBool("parameter3", true); dfile_MultiSet("ssddfbs", "test", "something", "test2", "testhere", "test3", 30, "test4", 50, "test5", 36.23425, "test6", true, "test7", "anothersomething" ); dfile_MultiGet("ssddfbs", "test", variable1[0], "test2", variable1[1], "test3", variable2[0], "test4", variable2[1], "test5", variable3, "test6", variable4, "test7", variable1[2] ); dfile_SaveFile(); printf("%s|%s|%d|%d|%f|%b|%s", variable1[0], variable1[1], variable2[0], variable2[1], variable3, variable4, variable1[2]); dfile_Open("test.ini"); printf("%s", dfile_ReadString("parameter0")); printf("%d", dfile_ReadInt("parameter1")); printf("%f", dfile_ReadFloat("parameter2")); printf("%d s", dfile_ReadBool("parameter3")); printf("%d", dfile_ParseString("parameter0", "test1234234")); printf("%d", dfile_ParseInt("parameter1", 345)); printf("%d", dfile_ParseFloat("parameter2", 0.973984)); printf("%d", dfile_ParseBool("parameter3", true)); printf("%d a", dfile_IsSet("parameter3")); dfile_CloseFile(); }
v1.0.5: Download
v1.0.9: Download
v1.1.0: Download
v1.1.1: Download
Updates:
Updated function:
- dfile_WriteString - The function don't rewrite the key value if that exist
- dfile_FileExists
- dfile_DirectoryExists
- dfile_RenameFile
- dfile_IsSet
- dfile_UnSet
- dfile_Open - Now read the file contents
- dfile_ReadString - Now only the key needed
Description by ChuckNorris.