@@ -257,34 +257,37 @@ public void Load()
257257 OnLoadTick ? . Invoke ( ) ;
258258
259259 string pathDATA = _filepath . Replace ( '\\ ' , '/' ) . Split ( new string [ ] { "/DATA/ENV" } , StringSplitOptions . None ) [ 0 ] + "/DATA" ;
260- string levelName = Directory . GetParent ( _filepath ) . Name ;
261- XmlDocument doc = new XmlDocument ( ) ;
262- doc . LoadXml ( File . ReadAllText ( pathDATA + "/LEVEL_TEXT_DATABASES.XML" ) ) ;
263- XmlNodeList textDBsGlobal = doc . SelectNodes ( "//level_text_databases/level" ) ;
264- List < string > globalDBs = new List < string > ( ) ;
265- for ( int i = 0 ; i < textDBsGlobal . Count ; i ++ )
266- if ( textDBsGlobal [ i ] . Attributes [ "name" ] . Value . ToUpper ( ) == levelName . ToUpper ( ) || textDBsGlobal [ i ] . Attributes [ "name" ] . Value == "globals" )
267- for ( int x = 0 ; x < textDBsGlobal [ i ] . ChildNodes . Count ; x ++ )
268- globalDBs . Add ( textDBsGlobal [ i ] . ChildNodes [ x ] . Attributes [ "name" ] . Value ) ;
269- List < string > textList = Directory . GetFiles ( pathDATA + "/TEXT/" , "*.TXT" , SearchOption . AllDirectories ) . ToList < string > ( ) ;
270- List < string > levelDBs = new List < string > ( ) ;
271- if ( File . Exists ( _filepath + "/TEXT/TEXT_DB_LIST.TXT" ) )
272- {
273- string [ ] textDBsLevel = File . ReadAllLines ( _filepath + "/TEXT/TEXT_DB_LIST.TXT" ) ;
274- for ( int i = 0 ; i < textDBsLevel . Length ; i ++ )
275- levelDBs . Add ( textDBsLevel [ i ] ) ;
276- textList . AddRange ( Directory . GetFiles ( _filepath + "/TEXT/" , "*.TXT" , SearchOption . AllDirectories ) ) ;
277- }
278- textList . Reverse ( ) ;
279260 Strings = new Dictionary < string , Dictionary < string , TextDB > > ( ) ;
280- foreach ( string textDB in textList )
261+ if ( File . Exists ( pathDATA + "/LEVEL_TEXT_DATABASES.XML" ) )
281262 {
282- string lang = Path . GetFileName ( Path . GetDirectoryName ( textDB ) ) . ToUpper ( ) ;
283- string db = Path . GetFileNameWithoutExtension ( textDB ) . ToUpper ( ) ;
284- if ( ! globalDBs . Contains ( db ) && ! levelDBs . Contains ( db ) ) continue ;
285- if ( ! Strings . ContainsKey ( lang ) ) Strings . Add ( lang , new Dictionary < string , TextDB > ( ) ) ;
286- if ( Strings [ lang ] . ContainsKey ( db ) ) continue ;
287- Strings [ lang ] . Add ( db , new TextDB ( textDB ) ) ;
263+ string levelName = Directory . GetParent ( _filepath ) . Name ;
264+ XmlDocument doc = new XmlDocument ( ) ;
265+ doc . LoadXml ( File . ReadAllText ( pathDATA + "/LEVEL_TEXT_DATABASES.XML" ) ) ;
266+ XmlNodeList textDBsGlobal = doc . SelectNodes ( "//level_text_databases/level" ) ;
267+ List < string > globalDBs = new List < string > ( ) ;
268+ for ( int i = 0 ; i < textDBsGlobal . Count ; i ++ )
269+ if ( textDBsGlobal [ i ] . Attributes [ "name" ] . Value . ToUpper ( ) == levelName . ToUpper ( ) || textDBsGlobal [ i ] . Attributes [ "name" ] . Value == "globals" )
270+ for ( int x = 0 ; x < textDBsGlobal [ i ] . ChildNodes . Count ; x ++ )
271+ globalDBs . Add ( textDBsGlobal [ i ] . ChildNodes [ x ] . Attributes [ "name" ] . Value ) ;
272+ List < string > textList = Directory . GetFiles ( pathDATA + "/TEXT/" , "*.TXT" , SearchOption . AllDirectories ) . ToList < string > ( ) ;
273+ List < string > levelDBs = new List < string > ( ) ;
274+ if ( File . Exists ( _filepath + "/TEXT/TEXT_DB_LIST.TXT" ) )
275+ {
276+ string [ ] textDBsLevel = File . ReadAllLines ( _filepath + "/TEXT/TEXT_DB_LIST.TXT" ) ;
277+ for ( int i = 0 ; i < textDBsLevel . Length ; i ++ )
278+ levelDBs . Add ( textDBsLevel [ i ] ) ;
279+ textList . AddRange ( Directory . GetFiles ( _filepath + "/TEXT/" , "*.TXT" , SearchOption . AllDirectories ) ) ;
280+ }
281+ textList . Reverse ( ) ;
282+ foreach ( string textDB in textList )
283+ {
284+ string lang = Path . GetFileName ( Path . GetDirectoryName ( textDB ) ) . ToUpper ( ) ;
285+ string db = Path . GetFileNameWithoutExtension ( textDB ) . ToUpper ( ) ;
286+ if ( ! globalDBs . Contains ( db ) && ! levelDBs . Contains ( db ) ) continue ;
287+ if ( ! Strings . ContainsKey ( lang ) ) Strings . Add ( lang , new Dictionary < string , TextDB > ( ) ) ;
288+ if ( Strings [ lang ] . ContainsKey ( db ) ) continue ;
289+ Strings [ lang ] . Add ( db , new TextDB ( textDB ) ) ;
290+ }
288291 }
289292 OnLoadTick ? . Invoke ( ) ;
290293 }
0 commit comments