#36548 FIx not to cause NullReference Exception when DTXMania was used as DTXV mode
#xxxxx Add try-catch foropening System/resources.csv
@@ -478,7 +478,8 @@ | ||
478 | 478 | |
479 | 479 | // PANELの設定は、base.On活性化()の後に(actPanelの活性化の後)行うこと。 |
480 | 480 | // さもないと、actPanelが活性化されていないため、パネル文字列の設定が機能しなくなる。 |
481 | - string strLabel = CDTXMania.Instance.stage選曲.r確定された曲.ar難易度ラベル[ CDTXMania.Instance.stage選曲.n確定された曲の難易度 ]; | |
481 | + string strLabel = (CDTXMania.Instance.stage選曲.r確定された曲 == null)? | |
482 | + null : CDTXMania.Instance.stage選曲.r確定された曲.ar難易度ラベル[ CDTXMania.Instance.stage選曲.n確定された曲の難易度 ]; | |
482 | 483 | string strPanel = CDTXMania.Instance.DTX.TITLE; |
483 | 484 | //string strSETDEFlabel = CDTXMania.Instance.stage選曲.r確定された曲.strタイトル; |
484 | 485 | if ( !string.IsNullOrWhiteSpace( strLabel ) && !strPanel.Contains(strLabel) |
@@ -34,7 +34,7 @@ | ||
34 | 34 | if ( strLanguageCode == "" || strLanguageCode == null ) |
35 | 35 | { |
36 | 36 | string s = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; |
37 | - if ( s == "" || !csvHeader.Contains( s+".title" ) ) | |
37 | + if ( s == "" || csvHeader == null || !csvHeader.Contains( s+".title" ) ) | |
38 | 38 | { |
39 | 39 | strLanguageCode = "default"; |
40 | 40 | } |
@@ -52,7 +52,7 @@ | ||
52 | 52 | if ( value == "" || value == null ) |
53 | 53 | { |
54 | 54 | string s = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; |
55 | - if ( s == "" || !csvHeader.Contains( s + ".title" ) ) | |
55 | + if ( s == "" || csvHeader == null || !csvHeader.Contains( s + ".title" ) ) | |
56 | 56 | { |
57 | 57 | strLanguageCode = "default"; |
58 | 58 | } |
@@ -63,7 +63,7 @@ | ||
63 | 63 | } |
64 | 64 | else |
65 | 65 | { |
66 | - if ( !csvHeader.Contains( value + ".title" ) ) | |
66 | + if ( csvHeader == null || !csvHeader.Contains( value + ".title" ) ) | |
67 | 67 | { |
68 | 68 | strLanguageCode = "default"; |
69 | 69 | } |
@@ -211,12 +211,20 @@ | ||
211 | 211 | public void LoadResources(string language = "") |
212 | 212 | { |
213 | 213 | // 参考: http://dobon.net/vb/dotnet/file/readcsvfile.html |
214 | + Microsoft.VisualBasic.FileIO.TextFieldParser tfp; | |
215 | + try | |
216 | + { | |
217 | + tfp = new Microsoft.VisualBasic.FileIO.TextFieldParser( | |
218 | + csvFileName, | |
219 | + System.Text.Encoding.Unicode | |
220 | + ); | |
221 | + } | |
222 | + catch ( System.IO.FileNotFoundException e ) | |
223 | + { | |
224 | + Trace.TraceError( "言語情報ファイル System/resources.csv が見つかりませんでした。" + e.Message ); | |
225 | + return; | |
226 | + } | |
214 | 227 | |
215 | - Microsoft.VisualBasic.FileIO.TextFieldParser tfp = | |
216 | - new Microsoft.VisualBasic.FileIO.TextFieldParser( | |
217 | - csvFileName, | |
218 | - System.Text.Encoding.Unicode | |
219 | - ); | |
220 | 228 | //フィールドが文字で区切られているとする |
221 | 229 | //デフォルトでDelimitedなので、必要なし |
222 | 230 | tfp.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited; |