Raised This Month: $51 Target: $400
 12% 

.ini files read


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-18-2015 , 13:48   .ini files read
Reply With Quote #1

Hi modders, the c++ (I think windows only??) can use a GetInt, GetString and others functions to use .ini files with this design:

PHP Code:
[MySection]
MyValue 1
MyString 
My awesome string

[MySection1]
MyOtherValue 65.0
MyOtherString 
Other string

// Comment line
Other comment line 
This can be implemented?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 02-18-2015 at 13:49.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2015 , 14:12   Re: .ini files ready
Reply With Quote #2

There are already an INI parser API based on event: https://github.com/alliedmodders/amx...tparse_ini.inc

Same for SMC (which is similar to VDF): https://github.com/alliedmodders/amx...tparse_smc.inc
__________________
Arkshine is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-18-2015 , 14:21   Re: .ini files ready
Reply With Quote #3

But this have a min and max values ? Like GetInt ?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2015 , 14:26   Re: .ini files ready
Reply With Quote #4

I have actually no idea what you're talking about.
__________________
Arkshine is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-18-2015 , 14:58   Re: .ini files ready
Reply With Quote #5

The GetInt and Get* Functions, have a design like this:

GetInt(MinValue, MaxValue, DefaultValue, "Section", "MyKey", "MyFile.ini");

Works as i posted a example file in main topic
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2015 , 16:39   Re: .ini files read
Reply With Quote #6

It's an event-based parser because it's efficient and the most flexible to do stuffs.

Well, considering that INI format is straight, it could be welcomed too to be able to get/set just by giving section/key name. I really don't know. There is no plan to change that for now.
__________________
Arkshine is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-18-2015 , 18:07   Re: .ini files read
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
It's an event-based parser because it's efficient and the most flexible to do stuffs.

Well, considering that INI format is straight, it could be welcomed too to be able to get/set just by giving section/key name. I really don't know. There is no plan to change that for now.
Thanks, but i can made a module to analyses their performance?

I only need some tricks to code for amxx module, but i think i am post here my module to this.



EDIT: I have create this for c++

PHP Code:
long cPugConfigs::GetInt(long Minlong Maxlong Default, LPCSTR BlockNameLPCSTR ConfigNameLPCSTR FolderName)
{
    
long lResult;

    
WIN32_FIND_DATAA wfd;

    if(
FindFirstFileA(FolderName, &wfd) == INVALID_HANDLE_VALUE)
    {
        
lResult = Default;
    }
    else
    {
        
lResult GetPrivateProfileIntA(BlockName,ConfigName,-100500,FolderName);
    }

    if(
lResult == -100500)
    {
        
lResult = Default;
    }

    if(
lResult Min || lResult Max)
    {
        
lResult = Default;
    }

    return 
lResult;

and i will implement at module,
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 02-19-2015 at 00:00.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode