View Single Post
  #3  
Unread 04-16-2005, 09:01 AM
ger's Avatar
ger ger is offline
Steward of the Faithful
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 580
Default

Quote:
Originally Posted by taco-man
i thought you might find this usefull if you want to add support for language folders.
someone requested support for other languages for the eq2map updater, so i wrote the code for it and it will be in the next release of it. back to your ui swithcer, here is the code i use for detection of language folders, it uses a simple regex (regular expression) to locate any language folders. the regex itself is about 1/2 way down in the code.
Code:
        Dim folders() As String
        'obviously maineq2dir has to be set to the main eq2 directory prior to this
        folders = System.IO.Directory.GetDirectories(MainEQ2dir)
        Dim i As Integer
        Dim LanguageSearch As String
        For i = 0 To folders.Length - 1
            LanguageSearch += folders(i).ToString + vbCrLf
        Next
        Dim regLanguage As New Regex("(LP_REGION_[A-Z]{2}_[A-Z]{2})")
        Dim matchLanguage As MatchCollection = regLanguage.Matches(LanguageSearch)
        For i = 0 To matchLanguage.Count - 1
            'add the language as a choice to the drop down language box
            cmbLanguage.Items.Add(matchLanguage(i).Value)
        Next
EDIT: i just realized this code is slightly flawed as it will return a language directory that has characters after it when it shouldn't example:
LP_REGION_EN_USiliketoeatlots_ofgoodfoor OR iliketoeatlots_ofgoodfoorLP_REGION_EN_US
returns
LP_REGION_EN_US
i will update the code to only return the correct folders late in afternoon on saturday when i get back. you may not even care about it in which case let me know and i will just delet this whole post.
I was planning, eventually, to just use LP_REGION_??_?? hehe
__________________
Reply With Quote