Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-29-2005, 05:24 PM
Junior Member
 
Join Date: Apr 2005
Posts: 8
Default ini without sectionNames....

is it possible to read key value pairs from a .ini file that contains no section names?

I know it would be easy to change the ini and add a section name, but in this instance I can't.

ini format is
Code:
; startup xbox debug monitor (needs sdk installed)
startDebug = 0

; enable igr
igrEnabled = 1

; display flubber anim
doStartupAnimation = 1

; do dvd drive check
doDvdDriveCheck =  0

; do not reset when pressing on eject
noResetOnEject = 1
I have tried
Code:
var iniPath = getAppDir()+"x2config.ini";
var iniFile = new Ini(iniPath);
var dash1Name = iniFile.getInt(null,"igrEnabled");
trace(dash1Name);
Any help appreciated.
__________________
Awaiting Swf Kit V3
Reply With Quote
  #2 (permalink)  
Old 11-30-2005, 12:15 AM
Junior Member
 
Join Date: Apr 2005
Posts: 8
Default Re:ini without sectionNames....

Nevermind, I figured it out.
I just loaded the ini file as a string and prepended a section name, saved that as a temp file, then read it back as a normal ini file.
Code:
var iniPath = Dialogs.fileOpen("Ini files(*.ini)|*.ini", "", "", false);
var tmpPath = Shell.getSpecialFolder("temp")+"\\temp_x2config.ini"
var iniString = "[Default]\r\n"
iniString = iniString+StringStream.readFromFile(iniPath);
var tmpFile = new StringStream();
tmpFile.write(iniString);
tmpFile.saveToFile(tmpPath)
tmpFile.close();
var readFile = new Ini(tmpPath);
var tmpRead = readFile.getSection("Default");
for (i=0; i<tmpRead.length;i++){
var tmpKey = tmpRead[i].substr(0,tmpRead[i].lastIndexOf("="));
var tmpValue = tmpRead[i].substr(tmpRead[i].indexOf("=")+1,tmpRead[i].length);
        // Arrary Push code here...
trace("Key: "+tmpKey+" - Value: "+tmpValue);
}
__________________
Awaiting Swf Kit V3
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:04 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.