• R/O
  • SSH
  • HTTPS

dtxmania: 提交


Commit MetaInfo

修订版1032 (tree)
时间2016-08-15 00:35:46
作者yyagi

Log Message

#36548 FIx not to cause NullReference Exception when DTXMania was used as DTXV mode
#xxxxx Add try-catch foropening System/resources.csv

更改概述

差异

--- trunk/DTXManiaプロジェクト/コード/ステージ/07.演奏/CStage演奏画面共通.cs (revision 1031)
+++ trunk/DTXManiaプロジェクト/コード/ステージ/07.演奏/CStage演奏画面共通.cs (revision 1032)
@@ -478,7 +478,8 @@
478478
479479 // PANELの設定は、base.On活性化()の後に(actPanelの活性化の後)行うこと。
480480 // さもないと、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確定された曲の難易度 ];
482483 string strPanel = CDTXMania.Instance.DTX.TITLE;
483484 //string strSETDEFlabel = CDTXMania.Instance.stage選曲.r確定された曲.strタイトル;
484485 if ( !string.IsNullOrWhiteSpace( strLabel ) && !strPanel.Contains(strLabel)
--- trunk/DTXManiaプロジェクト/コード/全体/CResources.cs (revision 1031)
+++ trunk/DTXManiaプロジェクト/コード/全体/CResources.cs (revision 1032)
@@ -34,7 +34,7 @@
3434 if ( strLanguageCode == "" || strLanguageCode == null )
3535 {
3636 string s = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
37- if ( s == "" || !csvHeader.Contains( s+".title" ) )
37+ if ( s == "" || csvHeader == null || !csvHeader.Contains( s+".title" ) )
3838 {
3939 strLanguageCode = "default";
4040 }
@@ -52,7 +52,7 @@
5252 if ( value == "" || value == null )
5353 {
5454 string s = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
55- if ( s == "" || !csvHeader.Contains( s + ".title" ) )
55+ if ( s == "" || csvHeader == null || !csvHeader.Contains( s + ".title" ) )
5656 {
5757 strLanguageCode = "default";
5858 }
@@ -63,7 +63,7 @@
6363 }
6464 else
6565 {
66- if ( !csvHeader.Contains( value + ".title" ) )
66+ if ( csvHeader == null || !csvHeader.Contains( value + ".title" ) )
6767 {
6868 strLanguageCode = "default";
6969 }
@@ -211,12 +211,20 @@
211211 public void LoadResources(string language = "")
212212 {
213213 // 参考: 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+ }
214227
215- Microsoft.VisualBasic.FileIO.TextFieldParser tfp =
216- new Microsoft.VisualBasic.FileIO.TextFieldParser(
217- csvFileName,
218- System.Text.Encoding.Unicode
219- );
220228 //フィールドが文字で区切られているとする
221229 //デフォルトでDelimitedなので、必要なし
222230 tfp.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited;
Show on old repository browser