1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

New home for me!

Discussion in 'Tools programming' started by Gridley, 26/9/06.

  1. Gridley

    Gridley

    Joined:
    4/1/05
    Messages:
    54
    Country:
    us-massachusetts
    Thanks to Nick and Arno for creating this site - a much needed home for coders who make FS addons. I can already tell I will be here often!

    Please let me know if I can contribute in some way and help the cause.

    Best,
    sg

    PS> Next build of FS-Blaze is nearly out the door! My first app for FS but not the last!
  2. nickw

    nickw Administrator Staff Member

    Joined:
    28/5/04
    Messages:
    646
    Country:
    ireland
    Welcome! We are all delighted to see skilled developers coming here.

    Contribute what you can... even if you think others will already know it!
  3. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    23,273
    Country:
    wales
    Hi Scott and welcome over here! In my experience the more i find out the more i realize how little I really know

    By the way did you solve the localization problem on FS-Blaze?
  4. Gridley

    Gridley

    Joined:
    4/1/05
    Messages:
    54
    Country:
    us-massachusetts
    Yes - I ended up using the System.Globalization.CultureInfo.InvariantCulture method and just kept everything in the format on the NOAA website. Not the most elegant, but certainly effective.

    The problem I'm currently working through in FS-Blaze is related to Application.Restart - I check my ini file for a build id string. If an old version is detected, the ini is deleted and rebuilt. However, when I call application.restart(), I get three instances of the application respawning - one with the old settings, one with absolutely NO settings, and a third with the new defaults. Everything exits inelegantly at that point (unhandled exceptions)...very odd.

    Not critical though. I'll get it done...
  5. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    23,273
    Country:
    wales
    Hmmm weird - what are you trying to do?
  6. jcboliveira

    jcboliveira

    Joined:
    8/6/04
    Messages:
    150
    Country:
    portugal
    damm ini :)

    I had a simillar problem and was only to solve it with the use of Configuration.ConfigurationManager

    Something like

    this.Inform.ForeColor = Color.FromName(ConfigurationManager.AppSettings["ButtonTextColor"]);

    However had to add te system.configuration in to the references otherwise it assumed the 1.1 assembly :confused:

    José
  7. Gridley

    Gridley

    Joined:
    4/1/05
    Messages:
    54
    Country:
    us-massachusetts
    I have been adding so many entries in the .ini file with the newer builds (poor design plan :) ), I put in a routine to detect an old initialization file. I already had a routine that would detect the lack of an ini file (new install) at startup and create a default, so I thought it would work to simply delete the old invalid ini, and restart the application. However, there's a weird interaction with the try/catch block, closing the file stream, and Application.Restart. Somewhere along the way, an unhandled exception (or more) gets thrown (I suspect restart tries to flush the file stream which has already been released?), and several new threads spawn.

    Not a problem, I'm reworking the logic, but if there's an opportunity to learn something here, please teach! I'm a novice, learning as I go - I really hope this will be a good place to grow my skill set and actually create some cool utilities as we go.

    Thanks!
    sg
  8. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    23,273
    Country:
    wales
    So, let me see if I understand this - you are using an ini file, different versions can have different ini files so if you find the wrong one you correct it and call the program to restart?

    I've had this a bunch of times as I am not good at thinking ahead either :eek: but I never forced the program to re-start - just cleaned up the ini in the load phase and then processed it, but I guess I haven't gotten the problem right in my head yet...

    What sort of ini file are you using and how are you handling it? I know that the purists will shout at me but I still use the old MS ini file and invoke calls to the API to read and write it. The more modern way is to use an XML file for application data, and VS2005 provides it's own settings functionality - though I never got that to work properly and hence I am stuck in the stone age when it comes to ini files :)
  9. Gridley

    Gridley

    Joined:
    4/1/05
    Messages:
    54
    Country:
    us-massachusetts
    I've gotten XML to work well - I use that in FS-Blaze for compiling the fire scenery. We should talk about that if you need it.

    My ini is just a simple text file. Nothing elaborate. I should have used the registry, but I already knew how to do that, I wanted more practice creating and using data files of my own formatting. An exercise really.

    The logic you describe is how I'm approaching it now. Check for old version, delete old, create new with defaults, continue...
  10. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    23,273
    Country:
    wales
    Hi Scott - let us know how it goes...........

Share This Page