Jump to content

My INI file got too big!


Recommended Posts

Interesting concept. Would like to help with it but I have no idea on where to start. Infact, I'm not even sure if I quite understand XML.

It's like your own custom HTML tags that are only interpreted by your app right?

<{POST_SNAPBACK}>

No, other way around. HTML is based on XML.

XML just defines the formatting of the tags (for example, all tags should be enclosed in angle brackets, a closing tag has a slash before it's name, etc). HTML defines the content of the tags.

XML could look like this:

<map>
  <zip>demoranch.zip</zip>
  <size>14KB</size>
  <name>Demolition Ranch</name>
  <author>Truffle</author>
  <screenshot>demoranch.jpg</screenshot>
  <tester>Truffle</tester>
  <description>Small DM arena map designed for Sanchez/Dynamite matches only</description>
</map>
<map>
  next map details go here...
</map>

The advantage that XML has over INI is that INI has only 2 layers: Headers and Keys. XML is nestable, so you could do this:

<map>
  <zip>
    <file>demoranch.zip</file>
    <size>14KB</size>
  </zip>
  <name>Demolition Ranch</name>
  <author>Truffle</author>
  <screenshot>demoranch.jpg</screenshot>
  <testers>
    <tester>Truffle</tester>
    <tester>Some other Guy</tester>
    <tester>My next door neighbor</tester>
    <tester>Etc...</tester>
  </testers>
  <description>
    <line>Small DM arena map</line>
    <line>designed for Sanchez/Dynamite matches only</line>
    <line>Works best with version x.xx</line>
    <line>more info goes here</line>
    <line>etc...</line>
  </description>
</map>
Edited by blindwig
Link to comment
Share on other sites

INI is easier to read, but also a simplier format. See my added example in the post above. INI has only 2 levels of complexity, XML can have unlimited numbers, just like you see how HTML has multiple layers of nesting. The good news is that IE (and most other browsers) will show you a nice tree view of an XML file if you drag the file into the browser.

That's a lot easier than trying to view them in notepad :whistle:

Link to comment
Share on other sites

No, really

<map>

  <zip>demoranch.zip</zip>

  <size>14KB</size>

  <name>Demolition Ranch</name>

  <author>Truffle</author>

  <screenshot>demoranch.jpg</screenshot>

  <tester>Truffle</tester>

  <description>Small DM arena map designed for Sanchez/Dynamite matches only</description>

</map>

<map>

  next map details go here...

</map>

i think that's easy to read than the INI file that I'm using. Of course that could be because Ive been coding HTML in notepad for six years now. (I of course use editors now but thats another topic)

So you would need to tell it to search for < and anything in between the < and > is an opening tag. And do the steps needed until it reaches </

What is needed there? A for loop, looping through the entire file using regular expressions to test each line.....Or is that ineffective? (too slow?)

Link to comment
Share on other sites

read the line, then stringinstr and stringmid

if the tags are always in the same place, could also use stringtrimleft and stringtrimright

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Writing your own XML library would be quite a feat (to make it 100% XML standard compatable anyway).

Watch DaleHohm's XML thread to see if anyone responds to it.

In the mean time, you might want to check out the command-line tool XML Starlet if you want to go the XML route. For now, I'd recommend that you just use CSV - it seems best suited to your task.

Link to comment
Share on other sites

Okay seems to be working good so far guys thanks for the help....Instead of using Commas to separate values I used the "|". This way i can keep all my commas I'm currently using :whistle: I wrote a PHP script to convert the INI file to new format (|SV hehe).... saved tons of time. Got another question though (a gui question) this is also a Win98 bug

This is normal appearance in Windows XP

http://www.olhideout.net/gsxp.jpg

But in 98 the logo on the top right loses a lot of quality

http://www.olhideout.net/gs98.jpg

This also happens to any image that i put on a window and the screenshots which are showin in a child window also lose a lot of quality as seen here

http://www.olhideout.net/gs982.jpg

Any idea on why this is doing that?

Edited by Truffle
Link to comment
Share on other sites

Okay seems to be working good so far guys thanks for the help....Instead of using Commas to separate values I used the "|". This way i can keep all my commas I'm currently using :whistle: I wrote a PHP script to convert the INI file to new format (|SV hehe).... saved tons of time. Got another question though (a gui question) this is also a Win98 bug

This is normal appearance in Windows XP

http://www.olhideout.net/gsxp.jpg

But in 98 the logo on the top right loses a lot of quality

http://www.olhideout.net/gs98.jpg

This also happens to any image that i put on a window and the screenshots which are showin in a child window also lose a lot of quality as seen here

http://www.olhideout.net/gs982.jpg

Any idea on why this is doing that?

<{POST_SNAPBACK}>

I dont know about the Win98 question, but the second one it seems to me the aspect ratio isnt kept so the quality gets lower. Just my thoughts. Nothing to confirm. Maybe if you use IrfanView to resize images it may be better as by default they keep the proper aspect ratio.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I dont know about the Win98 question, but the second one it seems to me the aspect ratio isnt kept so the quality gets lower. Just my thoughts. Nothing to confirm. Maybe if you use IrfanView to resize images it may be better as by default they keep the proper aspect ratio.

JS

<{POST_SNAPBACK}>

yep for some reason Windows 98 doesnt like it when you put in different dimensions in your GUI than the actual pic holds.

My logo on the top right is also used as a splash screen that shows up while the list is being generated. So I created a JPG that is smaller to fit in the area.

Then I had 225 screenshots that are all taken at 512x384 but in the GUI are resized at 400x300.... With Infranview, as you suggested, I resized them all and this fixed the problem

Thanks all for your help. :whistle:

Link to comment
Share on other sites

I'm guessing that when you have a control that is a different size than the image, the image is stretched (or shrunk) to match the control's dimensions. The difference in quality is most likely related to the resizing/smoothing routines of the particular OS. The real solution is just to make your controls the right size.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...