FreeTrainの進化系を目指す
Improve text resources management to consider multi language.
Several minor modifications.
| @@ -3,6 +3,7 @@ | ||
| 3 | 3 | using nft.core.game; |
| 4 | 4 | using nft.core.schedule; |
| 5 | 5 | using nft.core; |
| 6 | +using nft.framework; | |
| 6 | 7 | |
| 7 | 8 | namespace nft.impl.game |
| 8 | 9 | { |
| @@ -30,7 +31,7 @@ | ||
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | public GameImpl(ITerrainMap map, Calendar cal) |
| 33 | - : this(Core.GetString("game.new_game","NewGame"), map, cal) { | |
| 34 | + : this(I18n.T("GameManager","NewGame"), map, cal) { | |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | public TerrainMapImpl TerrainMap { |
| @@ -82,7 +82,7 @@ | ||
| 82 | 82 | [Obsolete] |
| 83 | 83 | public static ushort MakeTemplateIDX(int ne, int nw, int sw, int se){ |
| 84 | 84 | throw new NotSupportedException(); |
| 85 | - return GroundPolygon.MakePolygonID(sw, nw, ne, se); | |
| 85 | + //return GroundPolygon.MakePolygonID(sw, nw, ne, se); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public static ushort MakeTemplateID(int near, int left, int far, int right) { |
| @@ -1,12 +0,0 @@ | ||
| 1 | -using System; | |
| 2 | -using System.Collections.Generic; | |
| 3 | -using System.Text; | |
| 4 | - | |
| 5 | -namespace nft.impl.view | |
| 6 | -{ | |
| 7 | - public interface IOperationMode | |
| 8 | - { | |
| 9 | - ITargetSelector Selector { get; set; } | |
| 10 | - | |
| 11 | - } | |
| 12 | -} |
| @@ -1,48 +0,0 @@ | ||
| 1 | -using System; | |
| 2 | -using System.Collections.Generic; | |
| 3 | -using System.Text; | |
| 4 | - | |
| 5 | -namespace nft.impl.view | |
| 6 | -{ | |
| 7 | - //public enum SelectionState { NONE = 0, NORMAL, WARN, DANGER } | |
| 8 | - public delegate void TargetSelectorEvent(); | |
| 9 | - | |
| 10 | - public class SelectionEventArgs | |
| 11 | - { | |
| 12 | - public enum EventTypes {SELECTION_CHANGED, PHASE_PROCEEDED, PHASE_ROLLBACKED, VIEW_CHANGED ,CANCELD } | |
| 13 | - | |
| 14 | - protected ITargetSelector selector; | |
| 15 | - protected EventTypes status; | |
| 16 | - | |
| 17 | - public SelectionEventArgs(ITargetSelector sel, EventTypes stat) { | |
| 18 | - this.selector = sel; | |
| 19 | - this.status = stat; | |
| 20 | - } | |
| 21 | - | |
| 22 | - EventTypes Status { | |
| 23 | - get { | |
| 24 | - return status; | |
| 25 | - } | |
| 26 | - set { | |
| 27 | - status = value; | |
| 28 | - } | |
| 29 | - } | |
| 30 | - | |
| 31 | - ITargetSelector TargetSelector { | |
| 32 | - get { | |
| 33 | - return selector; | |
| 34 | - } | |
| 35 | - } | |
| 36 | - | |
| 37 | - } | |
| 38 | - | |
| 39 | - public interface ITargetSelector | |
| 40 | - { | |
| 41 | - int MaxPhases { get; } | |
| 42 | - int CurrentPhase { get; } | |
| 43 | - object CurrentSelection { get; } | |
| 44 | - event TargetSelectorEvent OnSelectionChanged; | |
| 45 | - event TargetSelectorEvent OnPhaseChanged; | |
| 46 | - event TargetSelectorEvent OnViewChanged; | |
| 47 | - } | |
| 48 | -} |
| @@ -30,6 +30,12 @@ | ||
| 30 | 30 | return conditionedResource; |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | + | |
| 34 | + protected override string ParseName(ParamsReader r) { | |
| 35 | + ParamsReader rn = r["name"]; | |
| 36 | + rn = rn.IsNull? r["default|value"]["src"]:rn; | |
| 37 | + return rn.InnerText; | |
| 38 | + } | |
| 33 | 39 | } |
| 34 | 40 | |
| 35 | 41 | public class ImageResource |
| @@ -1,16 +1,22 @@ | ||
| 1 | 1 | <?xml version="1.0" encoding="utf-8" ?> |
| 2 | 2 | <properties name="core"> |
| 3 | - <properties name="direction"> | |
| 4 | - <property name="names" type="string" readonly="true">北,東,南,西,北東,南東,南西,北西,北北東,東南東,南南西,西北西,東北東,南南東,西南西,北北西</property> | |
| 3 | + <properties name="Direction"> | |
| 4 | + <property name="N,E,S,W,NE,SE,SW,NW,NNE,ESE,SSW,WNW,ENE,SSE,WSW,NNW" type="string" readonly="true">北,東,南,西,北東,南東,南西,北西,北北東,東南東,南南西,西北西,東北東,南南東,西南西,北北西</property> | |
| 5 | 5 | </properties> |
| 6 | - <properties name="world"> | |
| 7 | - <property name="district_replace_prompt" type="string" readonly="true">置き換えによって、地域マップ『{0}』のデータは破棄されます。 | |
| 6 | + <properties name="World"> | |
| 7 | + <property name="Are you sure to over write the district '{0}'? (Current data will be lost.)" type="string" readonly="true">置き換えによって、地域マップ『{0}』のデータは破棄されます。 | |
| 8 | 8 | よろしいですか?</property> |
| 9 | - <property name="create_districts_prompt" type="string" readonly="true">今までのマップは全て破棄します。 | |
| 9 | + <property name="Are you sure to clear and replace all existing map data?" type="string" readonly="true">今までのマップは全て破棄します。 | |
| 10 | 10 | よろしいですか?</property> |
| 11 | 11 | </properties> |
| 12 | - <properties name="game"> | |
| 13 | - <property name="new_game" type="string" readonly="true">新規ゲーム</property> | |
| 14 | - <property name="savefile_filter" type="string" readonly="true">ゲームデータ (*.ftgd)|*.ftgd|ゲームデータ(互換形式) (*.ftgt)|*.ftgt</property> | |
| 12 | + <properties name="GameManager"> | |
| 13 | + <property name="Unsaved game data will be lost. Are you sure?" type="string" readonly="true"> | |
| 14 | + セーブしていないゲームデータは破棄されます。 | |
| 15 | + よろしいですか? | |
| 16 | + </property> | |
| 17 | + <property name="NewGame" type="string" readonly="true">新規ゲーム</property> | |
| 18 | + <property name="Faild to load a game from the file '{0}'." type="string" readonly="true">ファイル{0}からのゲームのロードに失敗しました。</property> | |
| 19 | + <property name="game_create_error" type="string" readonly="true">新規ゲームの作成に失敗しました。</property> | |
| 20 | + <property name="Game data (*.ftgd)|*.ftgd|Game data[full packaged] (*.ftgt)|*.ftgt" type="string" readonly="true">ゲームデータ (*.ftgd)|*.ftgd|ゲームデータ(互換形式) (*.ftgt)|*.ftgt</property> | |
| 15 | 21 | </properties> |
| 16 | 22 | </properties> |
| \ No newline at end of file |
| @@ -123,7 +123,7 @@ | ||
| 123 | 123 | bool b = true; |
| 124 | 124 | if(_curGame!=null && _curGame.Modified) |
| 125 | 125 | { |
| 126 | - string text = Main.resources["game.close_game_warning"].stringValue; | |
| 126 | + string text = I18n.T("Unsaved game data will be lost. Are you sure?"); | |
| 127 | 127 | b = UIUtil.ConfirmMessage(text,UIMessageType.warning,UIInformLevel.normal); |
| 128 | 128 | if( b ) |
| 129 | 129 | { |
| @@ -134,7 +134,7 @@ | ||
| 134 | 134 | return b; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - private readonly string filterString = Core.GetString("game.savefile_filter","All|*.*"); | |
| 137 | + private readonly string filterString = I18n.T("Game data (*.ftgd)|*.ftgd|Game data[full packaged] (*.ftgt)|*.ftgt"); | |
| 138 | 138 | /// <summary> |
| 139 | 139 | /// Saves the current game. |
| 140 | 140 | /// </summary> |
| @@ -0,0 +1,48 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Text; | |
| 4 | + | |
| 5 | +namespace nft.core.view | |
| 6 | +{ | |
| 7 | + //public enum SelectionState { NONE = 0, NORMAL, WARN, DANGER } | |
| 8 | + public delegate void TargetSelectorEvent(SelectionEventArgs args); | |
| 9 | + | |
| 10 | + public class SelectionEventArgs | |
| 11 | + { | |
| 12 | + public enum EventTypes {SELECTION_CHANGED, PHASE_PROCEEDED, PHASE_ROLLBACKED, VIEW_CHANGED ,COMPLETED, CANCELD } | |
| 13 | + | |
| 14 | + protected ITargetSelector selector; | |
| 15 | + protected EventTypes status; | |
| 16 | + | |
| 17 | + public SelectionEventArgs(ITargetSelector sel, EventTypes stat) { | |
| 18 | + this.selector = sel; | |
| 19 | + this.status = stat; | |
| 20 | + } | |
| 21 | + | |
| 22 | + EventTypes Status { | |
| 23 | + get { | |
| 24 | + return status; | |
| 25 | + } | |
| 26 | + set { | |
| 27 | + status = value; | |
| 28 | + } | |
| 29 | + } | |
| 30 | + | |
| 31 | + ITargetSelector TargetSelector { | |
| 32 | + get { | |
| 33 | + return selector; | |
| 34 | + } | |
| 35 | + } | |
| 36 | + | |
| 37 | + } | |
| 38 | + | |
| 39 | + public interface ITargetSelector | |
| 40 | + { | |
| 41 | + int MaxPhases { get; } | |
| 42 | + int CurrentPhase { get; } | |
| 43 | + object CurrentSelection { get; } | |
| 44 | + event TargetSelectorEvent OnSelectionChanged; | |
| 45 | + event TargetSelectorEvent OnPhaseChanged; | |
| 46 | + event TargetSelectorEvent OnViewChanged; | |
| 47 | + } | |
| 48 | +} |
| @@ -117,7 +117,7 @@ | ||
| 117 | 117 | { |
| 118 | 118 | if(!silent && !(_districts.Length>0)) |
| 119 | 119 | {// show confirmation message |
| 120 | - string text = Core.GetString("world.create_districts_prompt","Are you sure to clear current map?"); | |
| 120 | + string text = I18n.T("Are you sure to clear and replace all existing map data?"); | |
| 121 | 121 | if(!UIUtil.ConfirmMessage(text,UIMessageType.warning,UIInformLevel.normal)) |
| 122 | 122 | return; |
| 123 | 123 | } |
| @@ -148,9 +148,8 @@ | ||
| 148 | 148 | throw new ArgumentException("cannnot replace. Location or Size does not match."); |
| 149 | 149 | if(!silent && !(old is ProvisionalDistrict)) |
| 150 | 150 | {// show confirmation message |
| 151 | - string text = Core.GetString("world.district_replace_prompt","Are you sure to replace district '{0}'?"); | |
| 152 | - text = string.Format(text,old.Name); | |
| 153 | - if(!UIUtil.ConfirmMessage(text,UIMessageType.warning,UIInformLevel.normal)) | |
| 151 | + string msg = I18n.F("Are you sure to over write the district '{0}'? (Current data will be lost.)", old.Name); | |
| 152 | + if(!UIUtil.ConfirmMessage(msg,UIMessageType.warning,UIInformLevel.normal)) | |
| 154 | 153 | return; |
| 155 | 154 | } |
| 156 | 155 | districts[districts.IndexOf(old)]=newone; |
| @@ -3,6 +3,7 @@ | ||
| 3 | 3 | using System.Drawing; |
| 4 | 4 | using System.Runtime.Serialization; |
| 5 | 5 | using System.Collections.Generic; |
| 6 | +using nft.framework; | |
| 6 | 7 | |
| 7 | 8 | namespace nft.core.geometry { |
| 8 | 9 | /// <summary> |
| @@ -63,7 +64,7 @@ | ||
| 63 | 64 | private static readonly int[] angles; |
| 64 | 65 | |
| 65 | 66 | static Direction() { |
| 66 | - string names = Core.resources["direction.names"].stringValue; | |
| 67 | + string names = I18n.T("N,E,S,W,NE,SE,SW,NW,NNE,ESE,SSW,WNW,ENE,SSE,WSW,NNW"); | |
| 67 | 68 | DirNames = names.Split(new char[] { ',' }); |
| 68 | 69 | Array db = Enum.GetValues(typeof(Direction16)); |
| 69 | 70 | directions = new Direction[16]; |
| @@ -11,16 +11,13 @@ | ||
| 11 | 11 | public class Core |
| 12 | 12 | { |
| 13 | 13 | /// <summary> Main resources. </summary> |
| 14 | - public static readonly NftProperties resources = NftProperties.LoadFromFile(Directories.AppBaseDir + "nftcore.resource.xml", false); | |
| 14 | + //public static readonly NftProperties resources = NftProperties.LoadFromFile(Directories.AppBaseDir + "nftcore.resource.xml", false); | |
| 15 | 15 | |
| 16 | 16 | static Core() |
| 17 | 17 | { |
| 18 | - ConfigureService.RegisterAssembly(Assembly.GetAssembly(Type.GetType("nft.core.Core"))); | |
| 18 | + I18n.LoadFile(Directories.AppBaseDir + "nftcore.resource.xml"); | |
| 19 | + ConfigureService.RegisterAssembly(Assembly.GetAssembly(Type.GetType("nft.core.Core"))); | |
| 19 | 20 | } |
| 20 | - | |
| 21 | - public static string GetString(string name, string default_val) { | |
| 22 | - return resources.getString(name, default_val); | |
| 23 | - } | |
| 24 | 21 | |
| 25 | 22 | } |
| 26 | 23 | } |
| @@ -79,7 +79,7 @@ | ||
| 79 | 79 | int n = list.Count; |
| 80 | 80 | for(int i=n-1; i>0; i--){ |
| 81 | 81 | HandlerWrapper hw = list[i]; |
| 82 | - if (hw.handler == h) { | |
| 82 | + if (hw.handler == (Delegate)h) { | |
| 83 | 83 | RemoveAt(i); |
| 84 | 84 | } |
| 85 | 85 | } |
| @@ -43,7 +43,7 @@ | ||
| 43 | 43 | |
| 44 | 44 | if( methodName == null ) |
| 45 | 45 | { |
| 46 | - string templ = Main.resources["xml.attribute_not_found"].stringValue; | |
| 46 | + string templ = I18n.T("An attribute '{1}' is required for the node '{0}'."); | |
| 47 | 47 | throw new Exception(string.Format(templ,"method","name",contrib.SourceURI)); |
| 48 | 48 | } |
| 49 | 49 | } |
| @@ -65,9 +65,9 @@ | ||
| 65 | 65 | ICommandEntity_Old entity = CreateTarget() as ICommandEntity_Old; |
| 66 | 66 | if(entity==null) |
| 67 | 67 | { |
| 68 | - string templ = Main.resources["plugin.invalid_command_entity"].stringValue; | |
| 69 | - string[] args = new string[]{ commandType, targetType.Name, methodName }; | |
| 70 | - throw new PluginXmlException(contrib,string.Format(templ,args)); | |
| 68 | + string[] args = new string[] { commandType, targetType.Name, methodName }; | |
| 69 | + string msg = I18n.F("Failed to create CommandEntity[type={0}, class={1}, method={2}].", args); | |
| 70 | + throw new PluginXmlException(contrib,msg); | |
| 71 | 71 | } |
| 72 | 72 | return entity; |
| 73 | 73 | } |
| @@ -100,7 +100,7 @@ | ||
| 100 | 100 | } |
| 101 | 101 | catch( Exception e ) |
| 102 | 102 | { |
| 103 | - string templ = Main.resources["xml.class_load_error"].stringValue; | |
| 103 | + string templ = I18n.T("Failed to create an instance of the class '{0}'."); | |
| 104 | 104 | throw new Exception(string.Format(templ,targetType.FullName,path),e); |
| 105 | 105 | } |
| 106 | 106 | } |
| @@ -1,79 +1,75 @@ | ||
| 1 | 1 | <?xml version="1.0" encoding="utf-8" ?> |
| 2 | 2 | <!--エラーメッセージは、改行やタブがそのまま使用されるので、ご注意ください。--> |
| 3 | 3 | <properties name="framework"> |
| 4 | - <properties name="directories"> | |
| 5 | - <property name="create_dir_prompt" type="string" readonly="true">{0}は存在しません。 | |
| 4 | + <properties name="Directories"> | |
| 5 | + <property name="Directory '{0}' is not exist. Do you want to create?">{0}は存在しません。 | |
| 6 | 6 | 作成しますか?</property> |
| 7 | - <property name="errormsg_on_dir_creation" type="string" readonly="true">{0}は作成できませんでした。 | |
| 7 | + <property name="Failed to create a directory '{0}'. Use default path instead.">{0}は作成できませんでした。 | |
| 8 | 8 | 標準の設定を使用します。</property> |
| 9 | 9 | </properties> |
| 10 | - <properties name="plugin"> | |
| 11 | - <property name="too_many_errors" type="string" readonly="true">プラグインロードエラーが多すぎます。以降のエラーは省略します。 | |
| 12 | - エラーの発生したプラグインを確認するには、プラグイン一覧をご覧下さい。</property> | |
| 13 | - <property name="dependency_not_found" type="string" readonly="true">プラグイン{0}に必要な | |
| 14 | - プラグイン{1}が見つかりません。</property> | |
| 15 | - <property name="contrib_load_error" type="string" readonly="true">ファイル{0} | |
| 16 | -からのコントリビューション[{1}]のロードに失敗しました。 | |
| 17 | - ID={2}</property> | |
| 18 | - <property name="plugin_load_error" type="string" readonly="true">プラグイン{0}がロードできませんでした。</property> | |
| 19 | - <property name="contrib_init_error" type="string" readonly="true">プラグイン{0}内のコントリビューション[{1}]が初期化できませんでした。 | |
| 20 | - ID={2}</property> | |
| 21 | - <property name="invalid_command_entity" type="string" readonly="true">コマンドコントリビューションを初期化できません。 | |
| 22 | - Type={0} | |
| 23 | - Class={1} | |
| 24 | - Method={2}</property> | |
| 25 | - </properties> | |
| 26 | - <properties name="pluginlist"> | |
| 27 | - <property name="normal_message" type="string" readonly="true">コンピューターに使わせたくないプラグインは、 | |
| 10 | + <properties name="PluginListDialog"> | |
| 11 | + <property name="Uncheck to forbid cpu using this plug-in.">コンピューターに使わせたくないプラグインは、 | |
| 28 | 12 | チェックを外して下さい。</property> |
| 29 | - <property name="error_message" type="string" readonly="true">このコントリビューションは無効化できません。</property> | |
| 13 | + <property name="This contribution cannot invalidate.">このコントリビューションは無効化できません。</property> | |
| 30 | 14 | </properties> |
| 31 | - <properties name="xml"> | |
| 32 | - <property name="attribute_not_found" type="string" readonly="true">XMLノード[{0}]には[{1}]属性が必要です。 | |
| 15 | + <properties name="nft.framework.plugin"> | |
| 16 | + <property name="Too many plug-in load errors! Check out remaining errors in the 'Plug-in List'."> | |
| 17 | + プラグインロードエラーが多すぎます。以降のエラーは省略します。 | |
| 18 | + エラーの発生したプラグインを確認するには、プラグイン一覧をご覧下さい。 | |
| 19 | + </property> | |
| 20 | + <property name="Dependent plug-in:{1} (required for the plug-in:{0}) is not found."> | |
| 21 | + プラグイン{0}に必要な | |
| 22 | + プラグイン{1}が見つかりません。 | |
| 23 | + </property> | |
| 24 | + <property name="Failed to load contribution[{1}] (ID={2}) from the file '{0}'."> | |
| 25 | + ファイル{0} | |
| 26 | + からのコントリビューション[{1}]のロードに失敗しました。 | |
| 27 | + ID={2} | |
| 28 | + </property> | |
| 29 | + <property name="Failed to load plug-in:{0}.">プラグイン{0}がロードできませんでした。</property> | |
| 30 | + <property name="Failed to initialize contribution[{1}] in the plug-in:{0}."> | |
| 31 | + プラグイン{0}内のコントリビューション[{1}]が初期化できませんでした。 | |
| 32 | + ID={2} | |
| 33 | + </property> | |
| 34 | + <property name="Failed to create CommandEntity[type={0}, class={1}, method={2}]."> | |
| 35 | + コマンドコントリビューションを初期化できません。 | |
| 36 | + Type={0} | |
| 37 | + Class={1} | |
| 38 | + Method={2} | |
| 39 | + </property> | |
| 40 | + <property name="An attribute '{1}' is required for the node '{0}'.">XMLノード[{0}]には[{1}]属性が必要です。 | |
| 41 | + ソース:{2}</property> | |
| 42 | + <property name="Failed to create an instance of the class '{0}'.">指定されたクラス[{0}]のインスタンス作成に失敗しました。 | |
| 33 | 43 | ソース:{1}</property> |
| 34 | - <property name="class_load_error" type="string" readonly="true">指定されたクラス[{0}]のインスタンス作成に失敗しました。 | |
| 35 | - ソース:{1}</property> | |
| 36 | - <property name="class_cast_error" type="string" readonly="true">クラス[{0}]を[{1}]にキャストできません。 | |
| 44 | + <property name="Cannot cast the class'{0}' to the class'{1}'.">クラス[{0}]を[{1}]にキャストできません。 | |
| 37 | 45 | ソース:{2}</property> |
| 38 | 46 | </properties> |
| 39 | - <properties name="global_modules"> | |
| 40 | - <property name="load_error" type="string" readonly="true">コア・モジュール読み込みエラー</property> | |
| 47 | + <properties name="GlobalModules"> | |
| 48 | + <property name="ERROR while loading a core module.">コア・モジュール読み込みエラー</property> | |
| 41 | 49 | </properties> |
| 42 | - <properties name="webloader"> | |
| 43 | - <property name="web_exception" type="string" readonly="true">ファイルのダウンロードに失敗しました。 | |
| 50 | + <properties name="WebLoader"> | |
| 51 | + <property name="Web Exception: {0}(state={1}, url={2} ).">ファイルのダウンロードに失敗しました。 | |
| 44 | 52 | URL:{0} |
| 45 | 53 | {1} state={2}</property> |
| 46 | - <property name="other_exception" type="string" readonly="true">ダウンロード中に例外が発生しました。 | |
| 54 | + <property name="Exception raised while downloading url={0} .">ダウンロード中に例外が発生しました。 | |
| 47 | 55 | URL:{0}</property> |
| 48 | 56 | </properties> |
| 49 | - <properties name="command"> | |
| 50 | - <property name="exception@execute" type="string" readonly="true">コマンド[ID={0}]の実行中に例外が発生しました。</property> | |
| 57 | + <properties name="nft.ui.command"> | |
| 58 | + <property name="Exception raised while executing the command[ID={0}].">コマンド[ID={0}]の実行中に例外が発生しました。</property> | |
| 51 | 59 | </properties> |
| 52 | - <properties name="game"> | |
| 53 | - <property name="close_game_warning" type="string" readonly="true">セーブしていないゲームデータは破棄されます。 | |
| 54 | - よろしいですか?</property> | |
| 55 | - <property name="game_load_error" type="string" readonly="true">ファイル{0}からのゲームのロードに失敗しました。</property> | |
| 56 | - <property name="game_create_error" type="string" readonly="true">新規ゲームの作成に失敗しました。</property> | |
| 57 | - </properties> | |
| 58 | - <properties name="directxview"> | |
| 59 | - <property name="exception@OnLoad" type="string" readonly="true">DirectXサーフェイスの初期化に失敗しました。</property> | |
| 60 | - <property name="exception@RecreateDrawBuffer" type="string" readonly="true">オフスクリーンサーフェイスの生成に失敗しました。</property> | |
| 61 | - <property name="exception@updateView" type="string" readonly="true">オフスクリーンサーフェイスの生成に失敗しました。</property> | |
| 62 | - <property name="exception@overrideMethod" type="string" readonly="true">描画オーバーライドメソッド{0}が例外を発生しました。</property> | |
| 63 | - </properties> | |
| 64 | - <properties name="imageutil"> | |
| 65 | - <property name="type_rgb" type="string" readonly="true">{0}bit RGB</property> | |
| 66 | - <property name="type_argb" type="string" readonly="true">{0}bit ARGB</property> | |
| 67 | - <property name="type_indexed_color" type="string" readonly="true">{1}色パレット</property> | |
| 68 | - <property name="type_indexed_grayscale" type="string" readonly="true">{1}色グレー</property> | |
| 69 | - <property name="type_grayscale" type="string" readonly="true">{0}bit グレー</property> | |
| 60 | + <properties name="ImageUtil"> | |
| 61 | + <property name="{0}bit RGB">{0}bit RGB</property> | |
| 62 | + <property name="{0}bit ARGB">{0}bit ARGB</property> | |
| 63 | + <property name="Indexed {1} Colors">{1}色パレット</property> | |
| 64 | + <property name="Indexed {1} Gray scales">{1}色グレー</property> | |
| 65 | + <property name="{0}bit Gray scales">{0}bit グレー</property> | |
| 70 | 66 | </properties> |
| 71 | - <properties name="ui_util"> | |
| 72 | - <property name="confirm_exit_message" type="string" readonly="true">NeoFTを終了してよろしいですか?</property> | |
| 67 | + <properties name="UiUtil"> | |
| 68 | + <property name="Are you sure to exit 'NeoFT'?">NeoFTを終了してよろしいですか?</property> | |
| 73 | 69 | </properties> |
| 74 | - <properties name="mainframe"> | |
| 75 | - <property name="long_title" type="string" readonly="true">Neo Free Train</property> | |
| 76 | - <property name="short_title" type="string" readonly="true">NeoFT</property> | |
| 70 | + <properties name="MainFrame"> | |
| 71 | + <property name="long_title">Neo Free Train</property> | |
| 72 | + <property name="short_title">NeoFT</property> | |
| 77 | 73 | </properties> |
| 78 | 74 | |
| 79 | 75 | </properties> |
| \ No newline at end of file |
| @@ -32,7 +32,7 @@ | ||
| 32 | 32 | Register(gm); |
| 33 | 33 | } |
| 34 | 34 | }catch(Exception e){ |
| 35 | - string txt = Main.resources["global_modules.load_error"].stringValue; | |
| 35 | + string txt = I18n.T("ERROR while loading a core module."); | |
| 36 | 36 | if(UIUtil.ShowException(txt,e,UIInformLevel.severe)) |
| 37 | 37 | throw; |
| 38 | 38 | } |
| @@ -58,11 +58,11 @@ | ||
| 58 | 58 | } catch( Exception e ) { |
| 59 | 59 | Debug.WriteLine(e.Message); |
| 60 | 60 | Debug.WriteLine(e.StackTrace); |
| 61 | - string templ = Main.resources["xml.class_load_error"].stringValue; | |
| 61 | + string templ = I18n.T("nft.framework.plugin", "Failed to create an instance of the class '{0}'."); | |
| 62 | 62 | throw new Exception(string.Format(templ,t.FullName,node.SourceURI),e); |
| 63 | 63 | } |
| 64 | 64 | if(!(result is IGlobalModule)){ |
| 65 | - string templ = Main.resources["xml.class_cast_error"].stringValue; | |
| 65 | + string templ = I18n.T("nft.framework.plugin", "Cannot cast the class'{0}' to the class'{1}'."); | |
| 66 | 66 | object[] args = new object[] { t.FullName, "IGlobalModule", node.SourceURI }; |
| 67 | 67 | throw new InvalidCastException(string.Format(templ,args)); |
| 68 | 68 | } |
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | string short_id = contrib["id"].InnerText; |
| 30 | 30 | if( short_id == null ) |
| 31 | 31 | { |
| 32 | - string templ = Main.resources["xml.attribute_not_found"].stringValue; | |
| 32 | + string templ = I18n.T("An attribute '{1}' is required for the node '{0}'."); | |
| 33 | 33 | throw new PluginXmlException(contrib,string.Format( |
| 34 | 34 | templ,"contribution","name",contrib.SourceURI)); |
| 35 | 35 | } |
| @@ -45,27 +45,22 @@ | ||
| 45 | 45 | #endregion |
| 46 | 46 | |
| 47 | 47 | protected Contribution(Plugin owner, ParamsReader contrib) |
| 48 | - : this(owner, contrib, | |
| 49 | - contrib["name"].InnerTextOr("<unknown>"), | |
| 50 | - contrib["description"].InnerTextOr("")) {} | |
| 51 | - | |
| 52 | - protected Contribution(Plugin owner, ParamsReader contrib, string name, string description) | |
| 53 | 48 | { |
| 49 | + this.id = GenerateID(contrib); | |
| 54 | 50 | this.parent = owner; |
| 51 | + this.CtbType = ParseType(contrib); | |
| 52 | + //Debug.WriteLine("name:" + name + " ,baseDir:" + baseDir); | |
| 53 | + this.name = ParseName(contrib); | |
| 54 | + this.description = ParseDescription(contrib); | |
| 55 | + } | |
| 56 | + | |
| 57 | + protected Contribution(Plugin owner, ParamsReader contrib, string name, string description) { | |
| 58 | + this.id = GenerateID(contrib); | |
| 59 | + this.parent = owner; | |
| 60 | + this.CtbType = ParseType(contrib); | |
| 55 | 61 | this.name = name; |
| 56 | 62 | this.description = description; |
| 57 | 63 | //Debug.WriteLine("name:" + name + " ,baseDir:" + baseDir); |
| 58 | - id = GenerateID(contrib); | |
| 59 | - try | |
| 60 | - { | |
| 61 | - CtbType = contrib["type"].InnerText; | |
| 62 | - } | |
| 63 | - catch | |
| 64 | - { | |
| 65 | - string templ = Main.resources["xml.attribute_not_found"].stringValue; | |
| 66 | - throw new PluginXmlException(contrib, string.Format( | |
| 67 | - templ, "contribution", "type", contrib.SourceURI)); | |
| 68 | - } | |
| 69 | 64 | } |
| 70 | 65 | |
| 71 | 66 | // for override use only. please |
| @@ -77,7 +72,25 @@ | ||
| 77 | 72 | this.name = _name; |
| 78 | 73 | this.description = _description; |
| 79 | 74 | } |
| 80 | - | |
| 75 | + | |
| 76 | + protected virtual string ParseName(ParamsReader r) { | |
| 77 | + return r["name"].InnerTextOr("<unknown>"); | |
| 78 | + } | |
| 79 | + | |
| 80 | + protected virtual string ParseDescription(ParamsReader r) { | |
| 81 | + return r["description"].InnerTextOr(""); | |
| 82 | + } | |
| 83 | + | |
| 84 | + protected virtual string ParseType(ParamsReader r) { | |
| 85 | + try { | |
| 86 | + return r["type"].InnerText; | |
| 87 | + } catch { | |
| 88 | + string templ = I18n.T("An attribute '{1}' is required for the node '{0}'."); | |
| 89 | + throw new PluginXmlException(r, string.Format( | |
| 90 | + templ, "contribution", "type", r.SourceURI)); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 81 | 94 | /// <summary> |
| 82 | 95 | /// This method is a backdoor to configure a contribution. |
| 83 | 96 | /// |
| @@ -143,9 +143,8 @@ | ||
| 143 | 143 | if(p!=null) |
| 144 | 144 | p._state = InstallationState.FatalError; |
| 145 | 145 | |
| 146 | - string templ = Main.resources["plugin.plugin_load_error"].stringValue; | |
| 147 | - templ+="\n"+e.Message; | |
| 148 | - if(ReportError(string.Format(templ,Path.GetFileName(dir)),e)) | |
| 146 | + string msg = I18n.F("Failed to load plug-in:{0}.",Path.GetFileName(dir)); | |
| 147 | + if(ReportError(msg+"\n"+e.Message,e)) | |
| 149 | 148 | throw; |
| 150 | 149 | } |
| 151 | 150 | } |
| @@ -265,8 +264,9 @@ | ||
| 265 | 264 | } |
| 266 | 265 | } catch (Exception e) { |
| 267 | 266 | contrib._state = InstallationState.FatalError; |
| 268 | - string templ = Main.resources["plugin.contrib_init_error"].stringValue; | |
| 269 | - if(ReportError(string.Format(templ, contrib.Parent.ID, "contrib.name", contrib.ID), e)) | |
| 267 | + string msg = I18n.F("Failed to initialize contribution[{1}] in the plug-in:{0}.", | |
| 268 | + contrib.Parent.ID, "contrib.name", contrib.ID); | |
| 269 | + if(ReportError(msg, e)) | |
| 270 | 270 | throw; |
| 271 | 271 | } |
| 272 | 272 | } |
| @@ -286,8 +286,9 @@ | ||
| 286 | 286 | catch( Exception e ) |
| 287 | 287 | { |
| 288 | 288 | contrib._state = InstallationState.FatalError; |
| 289 | - string templ = Main.resources["plugin.contrib_init_error"].stringValue; | |
| 290 | - if(ReportError(string.Format(templ,contrib.Parent.ID,"contrib.name",contrib.ID),e)) | |
| 289 | + string msg = I18n.F("Failed to initialize contribution[{1}] in the plug-in:{0}.", | |
| 290 | + contrib.Parent.ID, "contrib.name", contrib.ID); | |
| 291 | + if(ReportError(msg,e)) | |
| 291 | 292 | throw; |
| 292 | 293 | } |
| 293 | 294 | } |
| @@ -300,8 +301,9 @@ | ||
| 300 | 301 | monitor.Progress(2, 1, contrib.ID); |
| 301 | 302 | } catch (Exception e) { |
| 302 | 303 | contrib._state = InstallationState.FatalError; |
| 303 | - string templ = Main.resources["plugin.contrib_init_error"].stringValue; | |
| 304 | - if(ReportError(string.Format(templ, contrib.Parent.ID, "contrib.name", contrib.ID), e)) | |
| 304 | + string msg = I18n.F("Failed to initialize contribution[{1}] in the plug-in:{0}.", | |
| 305 | + contrib.Parent.ID, "contrib.name", contrib.ID); | |
| 306 | + if(ReportError(msg, e)) | |
| 305 | 307 | throw; |
| 306 | 308 | } |
| 307 | 309 | } |
| @@ -330,7 +332,7 @@ | ||
| 330 | 332 | return UIUtil.ShowException(msg, e, UIInformLevel.minor); |
| 331 | 333 | } else { |
| 332 | 334 | if (errCount == SkipTooMenyErrorsCount) { |
| 333 | - string templ = Main.resources["plugin.too_many_errors"].stringValue; | |
| 335 | + string templ = I18n.T("Too many plug-in load errors! Check out remaining errors in the 'Plug-in List'."); | |
| 334 | 336 | Exception ex = new Exception(templ,e); |
| 335 | 337 | UIUtil.ShowException(templ, ex, UIInformLevel.minor); |
| 336 | 338 | } |
| @@ -359,8 +361,8 @@ | ||
| 359 | 361 | string name = depend["on"].InnerText; |
| 360 | 362 | Plugin p2 = GetPlugin(name); |
| 361 | 363 | if (p2 == null) { |
| 362 | - string templ = Main.resources["plugin.dependency_not_found"].stringValue; | |
| 363 | - throw new Exception(String.Format(templ, p.ID, name)); | |
| 364 | + string msg = I18n.F("Dependent plug-in:{1} (required for the plug-in:{0}) is not found.", p.ID, name); | |
| 365 | + throw new Exception(msg); | |
| 364 | 366 | } |
| 365 | 367 | a.Add(p2); |
| 366 | 368 | } |
| @@ -480,10 +482,11 @@ | ||
| 480 | 482 | } |
| 481 | 483 | |
| 482 | 484 | private string MakeContribExceptionMessage(Plugin p, ParamsReader pr) { |
| 483 | - string templ = Main.resources["plugin.contrib_load_error"].stringValue; | |
| 484 | 485 | string _id = pr["id"].InnerTextOr("unknown"); |
| 485 | 486 | string _name = pr["name"].InnerTextOr("unknown"); |
| 486 | - return string.Format(templ, p.Uri.AbsoluteUri, _name, _id); | |
| 487 | + string msg = I18n.F("Failed to load contribution[{1}] (ID={2}) from the file '{0}'.", | |
| 488 | + p.Uri.AbsoluteUri, _name, _id); | |
| 489 | + return msg; | |
| 487 | 490 | } |
| 488 | 491 | |
| 489 | 492 | /// <summary> |
| @@ -79,7 +79,7 @@ | ||
| 79 | 79 | // give XmlNode as first argument of constructor. |
| 80 | 80 | object result = Activator.CreateInstance(t, args); |
| 81 | 81 | if (result == null) { |
| 82 | - string templ = Main.resources["xml.class_load_error"].stringValue; | |
| 82 | + string templ = I18n.T("Failed to create an instance of the class '{0}'."); | |
| 83 | 83 | throw new Exception(string.Format(templ, t.FullName, elm.SourceURI)); |
| 84 | 84 | } |
| 85 | 85 | return result; |
| @@ -86,7 +86,7 @@ | ||
| 86 | 86 | } catch (TargetInvocationException e) { |
| 87 | 87 | Debug.WriteLine(e.Message); |
| 88 | 88 | Debug.WriteLine(e.StackTrace); |
| 89 | - string templ = Main.resources["xml.class_load_error"].stringValue; | |
| 89 | + string templ = I18n.T("Failed to create an instance of the class '{0}'."); | |
| 90 | 90 | throw new Exception(string.Format(templ, t.FullName, elm.SourceURI), e); |
| 91 | 91 | } |
| 92 | 92 | } |
| @@ -124,7 +124,7 @@ | ||
| 124 | 124 | Type t = loadTypeFromManifest(e); |
| 125 | 125 | if (required != null) { |
| 126 | 126 | if (!required.IsAssignableFrom(t)) { |
| 127 | - string templ = Main.resources["xml.class_cast_error"].stringValue; | |
| 127 | + string templ = I18n.T("Cannot cast the class'{0}' to the class'{1}'."); | |
| 128 | 128 | object[] a2 = new object[] { t.FullName, required.Name, e.SourceURI }; |
| 129 | 129 | throw new InvalidCastException(string.Format(templ, a2)); |
| 130 | 130 | } |
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | Type t = PluginUtil.loadTypeFromManifest(reader["class"]); |
| 26 | 26 | if (!t.IsSubclassOf(required)) |
| 27 | 27 | { |
| 28 | - string templ = Main.resources["xml.class_cast_error"].stringValue; | |
| 28 | + string templ = I18n.T("Cannot cast the class'{0}' to the class'{1}'."); | |
| 29 | 29 | object[] a2 = new object[] { t.FullName, required.Name, reader.SourceURI }; |
| 30 | 30 | throw new InvalidCastException(string.Format(templ, a2)); |
| 31 | 31 | } |
| @@ -39,7 +39,7 @@ | ||
| 39 | 39 | { |
| 40 | 40 | Debug.WriteLine(e.Message); |
| 41 | 41 | Debug.WriteLine(e.StackTrace); |
| 42 | - string templ = Main.resources["xml.class_load_error"].stringValue; | |
| 42 | + string templ = I18n.T("Failed to create an instance of the class '{0}'."); | |
| 43 | 43 | throw new Exception(string.Format(templ, t.FullName, reader.SourceURI), e); |
| 44 | 44 | } |
| 45 | 45 | return result; |
| @@ -42,15 +42,14 @@ | ||
| 42 | 42 | catch(WebException e) |
| 43 | 43 | { |
| 44 | 44 | Debug.WriteLine(e); |
| 45 | - string templ = Main.resources["webloader.web_exception"].stringValue; | |
| 46 | - string msg = string.Format(templ,url,e.Message,e.Status); | |
| 45 | + string msg = I18n.F("Web Exception: {0}(state={1}, url={2} ).",e.Message,e.Status.ToString(),url); | |
| 47 | 46 | UIUtil.Message(msg,UIMessageType.warning,UIInformLevel.normal); |
| 48 | 47 | } |
| 49 | 48 | catch(Exception e) |
| 50 | 49 | { |
| 51 | 50 | Debug.WriteLine(e); |
| 52 | - string templ = Main.resources["webloader.other_exception"].stringValue; | |
| 53 | - if(UIUtil.ShowException(string.Format(templ,url),e,UIInformLevel.normal)) | |
| 51 | + string msg = I18n.F("Exception raised while downloading url={0} .", url); | |
| 52 | + if(UIUtil.ShowException(msg,e,UIInformLevel.normal)) | |
| 54 | 53 | throw; |
| 55 | 54 | } |
| 56 | 55 | return null; |
| @@ -70,14 +69,14 @@ | ||
| 70 | 69 | catch(WebException e) |
| 71 | 70 | { |
| 72 | 71 | Debug.WriteLine(e); |
| 73 | - string templ = Main.resources["webloader.web_exception"].stringValue; | |
| 74 | - string msg = string.Format(templ,url,e.Message,e.Status); | |
| 72 | + string msg = I18n.F("Web Exception: {1}(state={2}, url={0} ).", | |
| 73 | + e.Message, e.Status.ToString(), url); | |
| 75 | 74 | UIUtil.Message(msg,UIMessageType.warning,UIInformLevel.normal); |
| 76 | 75 | } |
| 77 | 76 | catch(Exception e) |
| 78 | 77 | { |
| 79 | 78 | Debug.WriteLine(e); |
| 80 | - string templ = Main.resources["webloader.other_exception"].stringValue; | |
| 79 | + string templ = I18n.F("Exception raised while downloading url={0} .",url); | |
| 81 | 80 | if(UIUtil.ShowException(string.Format(templ,url),e,UIInformLevel.normal)) |
| 82 | 81 | throw; |
| 83 | 82 | } |
| @@ -97,15 +96,14 @@ | ||
| 97 | 96 | catch(WebException e) |
| 98 | 97 | { |
| 99 | 98 | Debug.WriteLine(e); |
| 100 | - string templ = Main.resources["webloader.web_exception"].stringValue; | |
| 101 | - string msg = string.Format(templ,url,e.Message,e.Status); | |
| 99 | + string msg = I18n.F("Web Exception: {0}(state={1}, url={2} ).",e.Message,e.Status.ToString(),url); | |
| 102 | 100 | UIUtil.Message(msg,UIMessageType.warning,UIInformLevel.normal); |
| 103 | 101 | } |
| 104 | 102 | catch(Exception e) |
| 105 | 103 | { |
| 106 | 104 | Debug.WriteLine(e); |
| 107 | - string templ = Main.resources["webloader.other_exception"].stringValue; | |
| 108 | - if(UIUtil.ShowException(string.Format(templ,url),e,UIInformLevel.normal)) | |
| 105 | + string msg = I18n.F("Exception raised while downloading url={0} .",url); | |
| 106 | + if(UIUtil.ShowException(msg,e,UIInformLevel.normal)) | |
| 109 | 107 | throw; |
| 110 | 108 | } |
| 111 | 109 | finally |
| @@ -135,15 +133,15 @@ | ||
| 135 | 133 | catch(WebException e) |
| 136 | 134 | { |
| 137 | 135 | Debug.WriteLine(e); |
| 138 | - string templ = Main.resources["webloader.web_exception"].stringValue; | |
| 139 | - string msg = string.Format(templ,url,e.Message,e.Status); | |
| 136 | + string msg = I18n.F("Web Exception: {1}(state={2}, url={0} )." | |
| 137 | + , url, e.Message, e.Status.ToString()); | |
| 140 | 138 | UIUtil.Message(msg,UIMessageType.warning,UIInformLevel.normal); |
| 141 | 139 | } |
| 142 | 140 | catch(Exception e) |
| 143 | 141 | { |
| 144 | 142 | Debug.WriteLine(e); |
| 145 | - string templ = Main.resources["webloader.other_exception"].stringValue; | |
| 146 | - if(UIUtil.ShowException(string.Format(templ,url),e,UIInformLevel.normal)) | |
| 143 | + string msg = I18n.F("Exception raised while downloading url={0} .",url); | |
| 144 | + if (UIUtil.ShowException(msg, e, UIInformLevel.normal)) | |
| 147 | 145 | throw; |
| 148 | 146 | } |
| 149 | 147 | } |
| @@ -179,15 +177,14 @@ | ||
| 179 | 177 | } |
| 180 | 178 | catch(WebException e) |
| 181 | 179 | { |
| 182 | - string templ = Main.resources["webloader.web_exception"].stringValue; | |
| 183 | - string msg = string.Format(templ,url,e.Message,e.Status); | |
| 180 | + string msg = I18n.F("Web Exception: {0}(state={1}, url={2} ).",e.Message,e.Status.ToString(),url); | |
| 184 | 181 | UIUtil.Message(msg,UIMessageType.warning,UIInformLevel.normal); |
| 185 | 182 | } |
| 186 | 183 | catch(Exception e) |
| 187 | 184 | { |
| 188 | 185 | Debug.WriteLine(e); |
| 189 | - string templ = Main.resources["webloader.other_exception"].stringValue; | |
| 190 | - if(UIUtil.ShowException(string.Format(templ,url),e,UIInformLevel.normal)) | |
| 186 | + string msg = I18n.F("Exception raised while downloading url={0} .",url); | |
| 187 | + if(UIUtil.ShowException(msg,e,UIInformLevel.normal)) | |
| 191 | 188 | throw; |
| 192 | 189 | } |
| 193 | 190 | } |
| @@ -227,8 +224,7 @@ | ||
| 227 | 224 | { |
| 228 | 225 | Debug.WriteLine(e); |
| 229 | 226 | Release(); |
| 230 | - string templ = Main.resources["webloader.web_exception"].stringValue; | |
| 231 | - string msg = string.Format(templ,url,e.Message,e.Status); | |
| 227 | + string msg = I18n.F("Web Exception: {0}(state={1}, url={2} ).",e.Message,e.Status.ToString(),url); | |
| 232 | 228 | UIUtil.Message(msg,UIMessageType.warning,UIInformLevel.normal); |
| 233 | 229 | } |
| 234 | 230 | catch(Exception e) |
| @@ -235,8 +231,8 @@ | ||
| 235 | 231 | { |
| 236 | 232 | Debug.WriteLine(e); |
| 237 | 233 | Release(); |
| 238 | - string templ = Main.resources["webloader.other_exception"].stringValue; | |
| 239 | - if(UIUtil.ShowException(string.Format(templ,url),e,UIInformLevel.normal)) | |
| 234 | + string msg = I18n.F("Exception raised while downloading url={0} .",url); | |
| 235 | + if(UIUtil.ShowException(msg,e,UIInformLevel.normal)) | |
| 240 | 236 | throw; |
| 241 | 237 | } |
| 242 | 238 | } |
| @@ -80,8 +80,8 @@ | ||
| 80 | 80 | } |
| 81 | 81 | catch(Exception e) |
| 82 | 82 | { |
| 83 | - string templ = Main.resources["directories.errormsg_on_dir_creation"].stringValue; | |
| 84 | - if(UIUtil.ShowException(string.Format(templ,path),e,UIInformLevel.normal)) | |
| 83 | + string msg = I18n.F("Failed to create a directory '{0}'. Use default path instead.", path); | |
| 84 | + if(UIUtil.ShowException(msg,e,UIInformLevel.normal)) | |
| 85 | 85 | throw; |
| 86 | 86 | } |
| 87 | 87 | return defaultPath; |
| @@ -121,8 +121,8 @@ | ||
| 121 | 121 | { |
| 122 | 122 | if(prompt) |
| 123 | 123 | { |
| 124 | - string templ = Main.resources["directories.create_dir_prompt"].stringValue; | |
| 125 | - if(!UIUtil.YesNoMessage(string.Format(templ,dir))) | |
| 124 | + string msg = I18n.F("Directory '{0}' is not exist. Do you want to create?",dir); | |
| 125 | + if(!UIUtil.YesNoMessage(msg)) | |
| 126 | 126 | return null; |
| 127 | 127 | } |
| 128 | 128 | Directory.CreateDirectory(dir); |
| @@ -0,0 +1,234 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Reflection; | |
| 3 | +using nft.util; | |
| 4 | +using System.Globalization; | |
| 5 | +using System.Collections.Generic; | |
| 6 | +using System.Diagnostics; | |
| 7 | + | |
| 8 | +namespace nft.framework | |
| 9 | +{ | |
| 10 | + /// <summary> | |
| 11 | + /// Internationalization, the utility class for multi language support. | |
| 12 | + /// 多言語対応 | |
| 13 | + /// (I18nとは I-18文字略-n という意味でプログラミング言語の世界でよく使われる略称です。) | |
| 14 | + /// </summary> | |
| 15 | + public class I18n | |
| 16 | + { | |
| 17 | + static readonly string COMMON_GROUP = "common"; | |
| 18 | + static List<NftProperties> properties; | |
| 19 | + static private CultureInfo invariant; | |
| 20 | + | |
| 21 | + static I18n() { | |
| 22 | + invariant = CultureInfo.InvariantCulture; | |
| 23 | + properties = new List<NftProperties>(); | |
| 24 | + } | |
| 25 | + | |
| 26 | + public static void LoadFile(string path) { | |
| 27 | + NftProperties pps = NftProperties.LoadFromFile(path, true); | |
| 28 | + properties.Insert(0,pps); | |
| 29 | + } | |
| 30 | + | |
| 31 | + /// <summary> | |
| 32 | + /// Get localized text by name, pick caller automatically from stack. | |
| 33 | + /// </summary> | |
| 34 | + /// <param name="name"></param> | |
| 35 | + /// <returns></returns> | |
| 36 | + public static string T(string name) { | |
| 37 | + return _T1(name, ToGroupCandidates(1), true); | |
| 38 | + } | |
| 39 | + | |
| 40 | + /// <summary> | |
| 41 | + /// Get localized text by name, suppose caller type as group name. | |
| 42 | + /// </summary> | |
| 43 | + /// <param name="caller">caller object or type</param> | |
| 44 | + /// <param name="name"></param> | |
| 45 | + /// <returns></returns> | |
| 46 | + public static string T(object caller, string name) { | |
| 47 | + return _T2(name, ToGroupCandidates(caller), true); | |
| 48 | + } | |
| 49 | + | |
| 50 | + /// <summary> | |
| 51 | + /// Get localized text by name, pick caller automatically from stack. | |
| 52 | + /// 'args' are inserted using String.Format method. | |
| 53 | + /// </summary> | |
| 54 | + /// <param name="name"></param> | |
| 55 | + /// <param name="args">insert parameters</param> | |
| 56 | + /// <returns></returns> | |
| 57 | + public static string F(string name, params object[] args) { | |
| 58 | + string ret = _T1(name, ToGroupCandidates(1), true); | |
| 59 | + return String.Format(ret,ToString(args)); | |
| 60 | + } | |
| 61 | + | |
| 62 | + /// <summary> | |
| 63 | + /// Get localized text by name, pick caller automatically from stack. | |
| 64 | + /// placeholders of parameters like a part '#{hoge}' are replaced by dictionary value. | |
| 65 | + /// </summary> | |
| 66 | + /// <param name="name"></param> | |
| 67 | + /// <param name="_params">insert parameters</param> | |
| 68 | + /// <returns></returns> | |
| 69 | + public static string F(string name, Dictionary<string, object> _params) { | |
| 70 | + string ret = _T1(name, ToGroupCandidates(1), true); | |
| 71 | + foreach (KeyValuePair<string, object> pair in _params) { | |
| 72 | + ret = ret.Replace("#{" + pair.Key + "}", ToString(pair.Value)); | |
| 73 | + } | |
| 74 | + return ret; | |
| 75 | + } | |
| 76 | + | |
| 77 | + /// <summary> | |
| 78 | + /// Get localized text by name, suppose caller type as group name. | |
| 79 | + /// 'args' are inserted using String.Format method. | |
| 80 | + /// </summary> | |
| 81 | + /// <param name="caller">caller object or type</param> | |
| 82 | + /// <param name="name"></param> | |
| 83 | + /// <param name="args">insert parameters</param> | |
| 84 | + /// <returns></returns> | |
| 85 | + public static string F2(object caller, string name, params object[] args) { | |
| 86 | + string ret = _T2(name, ToGroupCandidates(caller), true); | |
| 87 | + return String.Format(ret, ToString(args)); | |
| 88 | + } | |
| 89 | + | |
| 90 | + /// <summary> | |
| 91 | + /// Get localized text by name, suppose caller type as group name. | |
| 92 | + /// placeholders of parameters like a part '#{hoge}' are replaced by dictionary value. | |
| 93 | + /// </summary> | |
| 94 | + /// <param name="caller">caller object or type</param> | |
| 95 | + /// <param name="name"></param> | |
| 96 | + /// <param name="_params">insert parameters</param> | |
| 97 | + /// <returns></returns> | |
| 98 | + public static string F2(object caller, string name, Dictionary<string, object> _params) { | |
| 99 | + string ret = _T2(name, ToGroupCandidates(caller), true); | |
| 100 | + foreach (KeyValuePair<string, object> pair in _params) { | |
| 101 | + ret = ret.Replace("#{" + pair.Key + "}", ToString(pair.Value)); | |
| 102 | + } | |
| 103 | + return ret; | |
| 104 | + } | |
| 105 | + | |
| 106 | + protected static string _T1(string name, ICollection<string> groupCandidates, bool strict) { | |
| 107 | + string ret = null; | |
| 108 | + foreach (string group in groupCandidates) { | |
| 109 | + ret = GetText(group, name); | |
| 110 | + if (ret != null) return ret; | |
| 111 | + } | |
| 112 | + if (strict) { | |
| 113 | + string tname = name.Trim(); | |
| 114 | + if (!tname.Equals(name)) { | |
| 115 | + ret = _T1(tname, groupCandidates, false); | |
| 116 | + if (ret != null) return '?' + ret; | |
| 117 | + } | |
| 118 | + TextInfo textInfo = invariant.TextInfo; | |
| 119 | + tname = textInfo.ToTitleCase(name); | |
| 120 | + if(!tname.Equals(name)) { | |
| 121 | + ret = _T1(tname, groupCandidates, false); | |
| 122 | + if (ret != null) return '?' + ret; | |
| 123 | + } | |
| 124 | + tname = textInfo.ToLower(name); | |
| 125 | + if(!tname.Equals(name)) { | |
| 126 | + ret = _T1(tname, groupCandidates, false); | |
| 127 | + if (ret != null) return '?' + ret; | |
| 128 | + } | |
| 129 | + } | |
| 130 | + return name; | |
| 131 | + } | |
| 132 | + | |
| 133 | + protected static string _T2(string name, ICollection<string> groupCandidates, bool strict) { | |
| 134 | + string ret = null; | |
| 135 | + int n = 0; | |
| 136 | + foreach (string group in groupCandidates) { | |
| 137 | + ret = GetText(group, name); | |
| 138 | + if (ret != null) { | |
| 139 | + return (n == 0) ? ret : '?' + ret; | |
| 140 | + } | |
| 141 | + n++; | |
| 142 | + } | |
| 143 | + if (strict) { | |
| 144 | + string tname = name.Trim(); | |
| 145 | + if (!tname.Equals(name)) { | |
| 146 | + ret = _T2(tname, groupCandidates, false); | |
| 147 | + if (ret != null) return '?' + ret; | |
| 148 | + } | |
| 149 | + TextInfo textInfo = invariant.TextInfo; | |
| 150 | + tname = textInfo.ToTitleCase(name); | |
| 151 | + if (!tname.Equals(name)) { | |
| 152 | + ret = _T2(tname, groupCandidates, false); | |
| 153 | + if (ret != null) return '?' + ret; | |
| 154 | + } | |
| 155 | + tname = textInfo.ToLower(name); | |
| 156 | + if (!tname.Equals(name)) { | |
| 157 | + ret = _T2(tname, groupCandidates, false); | |
| 158 | + if (ret != null) return '?' + ret; | |
| 159 | + } | |
| 160 | + } | |
| 161 | + return name; | |
| 162 | + } | |
| 163 | + | |
| 164 | + protected static string GetText(string group, string name) { | |
| 165 | + foreach(NftProperties pps in properties){ | |
| 166 | + Property p1 = pps[group + Property.SEPARATOR + name, false]; | |
| 167 | + if (p1 != null) return p1.stringValue; | |
| 168 | + } | |
| 169 | + return null; | |
| 170 | + } | |
| 171 | + | |
| 172 | + protected static string ToString(object param) { | |
| 173 | + return param.ToString(); | |
| 174 | + } | |
| 175 | + | |
| 176 | + protected static object[] ToString(ref object[] _params) { | |
| 177 | + int n = _params.Length; | |
| 178 | + for (int i = 0; i < n; i++) { | |
| 179 | + _params[i] = ToString(_params[i]); | |
| 180 | + } | |
| 181 | + return _params; | |
| 182 | + } | |
| 183 | + | |
| 184 | + protected static ICollection<String> ToGroupCandidates(int stackcount) { | |
| 185 | + StackFrame callerFrame = new StackFrame(++stackcount); | |
| 186 | + Type callerType = callerFrame.GetMethod().ReflectedType; | |
| 187 | + return TypeToGroupCandidates(callerType); | |
| 188 | + } | |
| 189 | + | |
| 190 | + protected static ICollection<String> ToGroupCandidates(object caller) { | |
| 191 | + if (caller is string || caller.GetType().IsPrimitive) { | |
| 192 | + List<String> l1 = new List<string>(1); | |
| 193 | + string name = caller.ToString(); | |
| 194 | + l1.Add(name); | |
| 195 | + string tname = name.ToLower(); | |
| 196 | + if (!tname.Equals(name)) { | |
| 197 | + l1.Add(tname); | |
| 198 | + } | |
| 199 | + tname = name.ToUpper(); | |
| 200 | + if (!tname.Equals(name)) { | |
| 201 | + l1.Add(tname); | |
| 202 | + } | |
| 203 | + l1.Add(COMMON_GROUP); | |
| 204 | + return l1; | |
| 205 | + } else { | |
| 206 | + Type callerType = (Type)((caller is Type) ? caller : caller.GetType()); | |
| 207 | + return TypeToGroupCandidates(callerType); | |
| 208 | + } | |
| 209 | + } | |
| 210 | + | |
| 211 | + protected static ICollection<String> TypeToGroupCandidates(Type callerType) { | |
| 212 | + List<Type> lstTypes = new List<Type>(); | |
| 213 | + lstTypes.Add(callerType); | |
| 214 | + lstTypes.AddRange(callerType.GetInterfaces()); | |
| 215 | + Type btype = callerType.BaseType; | |
| 216 | + while(btype!=null && !btype.Assembly.GlobalAssemblyCache){ | |
| 217 | + lstTypes.Add(btype); | |
| 218 | + btype = btype.BaseType; | |
| 219 | + } | |
| 220 | + List<String> l1 = new List<string>(lstTypes.Count*2); | |
| 221 | + List<String> l2 = new List<string>(lstTypes.Count); | |
| 222 | + foreach (Type t in lstTypes) { | |
| 223 | + l1.Add(t.FullName); | |
| 224 | + l1.Add(t.Name); | |
| 225 | + string ns = t.Namespace; | |
| 226 | + if (!l2.Contains(ns)) l2.Add(ns); | |
| 227 | + } | |
| 228 | + l1.AddRange(l2); | |
| 229 | + l1.Add(COMMON_GROUP); | |
| 230 | + return l1; | |
| 231 | + } | |
| 232 | + | |
| 233 | + } | |
| 234 | +} |
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | { get{ return theFrame; } } |
| 31 | 31 | |
| 32 | 32 | /// <summary> Main resources. </summary> |
| 33 | - public static readonly NftProperties resources = NftProperties.LoadFromFile(Directories.AppBaseDir + "nftfw.resource.xml", false); | |
| 33 | + //public static readonly NftProperties resources = NftProperties.LoadFromFile(Directories.AppBaseDir + "nftfw.resource.xml", false); | |
| 34 | 34 | |
| 35 | 35 | /// <summary> Plug-ins. </summary> |
| 36 | 36 | public static readonly PluginManager pluginManager = new PluginManager(); |
| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | /// </param> |
| 70 | 70 | public static void init( string[] args, MainFrame frame ) |
| 71 | 71 | { |
| 72 | - | |
| 72 | + I18n.LoadFile(Directories.AppBaseDir + "nftfw.resource.xml"); | |
| 73 | 73 | Hashtable h_args = paresArgs(args); |
| 74 | 74 | Directories.Initialize(h_args); |
| 75 | 75 |
| @@ -216,7 +216,7 @@ | ||
| 216 | 216 | subcmds = new Dictionary<string, TriggerCommandUI>(subitems); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - public ISingleSelectCommandEntity CommandEntity { | |
| 219 | + public new ISingleSelectCommandEntity CommandEntity { | |
| 220 | 220 | get { return base.CommandEntity as ISingleSelectCommandEntity; } |
| 221 | 221 | set { |
| 222 | 222 | ISingleSelectCommandEntity old = CommandEntity; |
| @@ -112,8 +112,7 @@ | ||
| 112 | 112 | } |
| 113 | 113 | catch(Exception e) |
| 114 | 114 | { |
| 115 | - string templ = Main.resources["command.exception@execute"].stringValue; | |
| 116 | - string msg = string.Format(templ,new string[]{ID}); | |
| 115 | + string msg = I18n.T("Exception raised while executing the command[ID={0}].",ID); | |
| 117 | 116 | if(UIUtil.ShowException(msg,e,UIInformLevel.normal)) |
| 118 | 117 | throw; |
| 119 | 118 | } |
| @@ -281,8 +281,8 @@ | ||
| 281 | 281 | |
| 282 | 282 | public void SetSubTitle(string subtitle) |
| 283 | 283 | { |
| 284 | - string long_title = Main.resources["mainframe.long_title"].stringValue; | |
| 285 | - string short_title = Main.resources["mainframe.short_title"].stringValue; | |
| 284 | + string long_title = I18n.T("long_title"); | |
| 285 | + string short_title = I18n.T("short_title"); | |
| 286 | 286 | if( subtitle==null || subtitle.Trim().Length==0 ) |
| 287 | 287 | this.Text = long_title; |
| 288 | 288 | else |
| @@ -118,7 +118,7 @@ | ||
| 118 | 118 | public bool ShowException(string text,Exception caused,UIInformLevel level) |
| 119 | 119 | { |
| 120 | 120 | Debug.WriteLine(text); |
| 121 | - Debug.WriteLine(caused.StackTrace); | |
| 121 | + DumpException(caused); | |
| 122 | 122 | return ShowErrorMessageBox(null, text, caused); |
| 123 | 123 | } |
| 124 | 124 | public bool ShowQueryMessage(string text,UIQueryType query,UIMessageType type,UIInformLevel level) |
| @@ -130,6 +130,16 @@ | ||
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | + public static void DumpException(Exception ex) { | |
| 134 | + if (ex.InnerException != null) { | |
| 135 | + DumpException(ex.InnerException); | |
| 136 | + Debug.WriteLine("----wrapped by----"); | |
| 137 | + } | |
| 138 | + Debug.WriteLine(ex.GetType().Name + ":" + ex.Message); | |
| 139 | + if(ex.HelpLink!=null) Debug.WriteLine(ex.HelpLink); | |
| 140 | + Debug.WriteLine(ex.StackTrace); | |
| 141 | + } | |
| 142 | + | |
| 133 | 143 | public static bool ShowErrorMessageBox(IWin32Window owner, string msg, Exception e ) |
| 134 | 144 | { |
| 135 | 145 | Assembly asm = Assembly.LoadFrom(Directories.AppBaseDir+"NFT.UI.DLL"); |
| @@ -137,7 +147,7 @@ | ||
| 137 | 147 | BindingFlags flags = BindingFlags.Public|BindingFlags.Static|BindingFlags.InvokeMethod; |
| 138 | 148 | DialogResult ret = (DialogResult)t.InvokeMember("Show", flags, null, null, new object[] { owner, msg, e }); |
| 139 | 149 | if (DialogResult.Abort==ret && Main.mainFrame!=null) { |
| 140 | - string msg2 = Main.resources["ui_util.confirm_exit_message"].stringValue; | |
| 150 | + string msg2 =I18n.T("Are you sure to exit 'NeoFT'?"); | |
| 141 | 151 | DialogResult r2 = MessageBox.Show(null, msg2, "NeoFT", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); |
| 142 | 152 | if (r2 == DialogResult.Yes) { |
| 143 | 153 | Environment.Exit(0); |
| @@ -69,11 +69,11 @@ | ||
| 69 | 69 | static private readonly string fmt_type_grayscale; |
| 70 | 70 | |
| 71 | 71 | static ImageUtil() { |
| 72 | - fmt_type_rgb = Main.resources["imageutil.type_rgb"].stringValue; | |
| 73 | - fmt_type_argb = Main.resources["imageutil.type_argb"].stringValue; | |
| 74 | - fmt_type_indexed_color = Main.resources["imageutil.type_indexed_color"].stringValue; | |
| 75 | - fmt_type_indexed_grayscale = Main.resources["imageutil.type_indexed_grayscale"].stringValue; | |
| 76 | - fmt_type_grayscale = Main.resources["imageutil.type_grayscale"].stringValue; | |
| 72 | + fmt_type_rgb = I18n.T("{0}bit RGB"); | |
| 73 | + fmt_type_argb = I18n.T("{0}bit ARGB"); | |
| 74 | + fmt_type_indexed_color = I18n.T("Indexed {1} Colors"); | |
| 75 | + fmt_type_indexed_grayscale = I18n.T("Indexed {1} Gray scales"); | |
| 76 | + fmt_type_grayscale = I18n.T("{0}bit Gray scales"); | |
| 77 | 77 | |
| 78 | 78 | Array arr = Enum.GetValues(typeof(PixelFormat)); |
| 79 | 79 | formatTable = new Dictionary<PixelFormat, ImageColorFormat>(arr.Length); |
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | [Serializable] |
| 14 | 14 | public class Property |
| 15 | 15 | { |
| 16 | - public const char SEPARATOR = '.'; | |
| 16 | + public const char SEPARATOR = '/'; | |
| 17 | 17 | public readonly bool isReadonly; |
| 18 | 18 | public readonly string name; |
| 19 | 19 | public readonly bool isStatic; |
| @@ -59,12 +59,15 @@ | ||
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - internal protected Property(XmlNode node) | |
| 62 | + internal protected Property(XmlNode node) : this(node, false) { | |
| 63 | + } | |
| 64 | + | |
| 65 | + internal protected Property(XmlNode node, bool default_readonly) | |
| 63 | 66 | { |
| 64 | 67 | this.name = XmlUtil.GetAttribute(node,"name"); |
| 65 | 68 | this.type = XmlUtil.GetAttribute(node,"type","string"); |
| 66 | 69 | this.isStatic = bool.Parse(XmlUtil.GetAttribute(node,"static","false")); |
| 67 | - this.isReadonly = bool.Parse(XmlUtil.GetAttribute(node,"readonly","false")); | |
| 70 | + this.isReadonly = bool.Parse(XmlUtil.GetAttribute(node,"readonly", default_readonly.ToString())); | |
| 68 | 71 | switch(type) |
| 69 | 72 | { |
| 70 | 73 | case "int": |
| @@ -46,18 +46,24 @@ | ||
| 46 | 46 | XmlNode cn = ie.Current as XmlNode; |
| 47 | 47 | Property p; |
| 48 | 48 | if(cn.Name.Equals("properties")) |
| 49 | - p = new NftProperties(cn); | |
| 49 | + p = new NftProperties(cn, isReadonly); | |
| 50 | 50 | else |
| 51 | - p = new Property(cn); | |
| 51 | + p = new Property(cn, isReadonly); | |
| 52 | 52 | AddProperty(p); |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | + public Property this[string name, bool raise_error] { | |
| 57 | + get { | |
| 58 | + return PickNode(name, raise_error); | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 56 | 62 | public Property this[string name] |
| 57 | 63 | { |
| 58 | 64 | get |
| 59 | 65 | { |
| 60 | - return PickNode(name); | |
| 66 | + return PickNode(name, true); | |
| 61 | 67 | } |
| 62 | 68 | } |
| 63 | 69 | #region get value methods. |
| @@ -121,21 +127,30 @@ | ||
| 121 | 127 | /// </summary> |
| 122 | 128 | /// <param name="name"></param> |
| 123 | 129 | /// <returns></returns> |
| 124 | - protected Property PickNode(string fullpath ) | |
| 130 | + protected Property PickNode(string fullpath, bool raise_error) | |
| 125 | 131 | { |
| 126 | 132 | int i = fullpath.IndexOf(SEPARATOR); |
| 127 | - if(i==0 || i==fullpath.Length) | |
| 128 | - throw new ArgumentException("blank node is not allowed in :"+fullpath); | |
| 129 | - if(i==-1) | |
| 130 | - return table[fullpath] as Property; | |
| 131 | - else | |
| 132 | - { | |
| 133 | - NftProperties p = table[fullpath.Substring(0,i)] as NftProperties; | |
| 134 | - if(p!=null) | |
| 135 | - return p.PickNode(fullpath.Substring(i+1)); | |
| 136 | - else | |
| 137 | - throw new ArgumentException("property node ["+fullpath+"] is not found."); | |
| 138 | - } | |
| 133 | + if (i == 0 || i == fullpath.Length) { | |
| 134 | + if (raise_error) { | |
| 135 | + throw new ArgumentException("blank node is not allowed in :" + fullpath); | |
| 136 | + } else { | |
| 137 | + return null; | |
| 138 | + } | |
| 139 | + } | |
| 140 | + if (i == -1) { | |
| 141 | + return table[fullpath] as Property; | |
| 142 | + } else { | |
| 143 | + NftProperties p = table[fullpath.Substring(0, i)] as NftProperties; | |
| 144 | + if (p != null) { | |
| 145 | + return p.PickNode(fullpath.Substring(i + 1), raise_error); | |
| 146 | + } else { | |
| 147 | + if (raise_error) { | |
| 148 | + throw new ArgumentException("property node [" + fullpath + "] is not found."); | |
| 149 | + } else { | |
| 150 | + return null; | |
| 151 | + } | |
| 152 | + } | |
| 153 | + } | |
| 139 | 154 | } |
| 140 | 155 | |
| 141 | 156 | /// <summary> |
| @@ -5,12 +5,34 @@ | ||
| 5 | 5 | using nft.framework; |
| 6 | 6 | using System.IO; |
| 7 | 7 | using System.Diagnostics; |
| 8 | +using System.Reflection; | |
| 8 | 9 | |
| 9 | 10 | namespace nft.test.test |
| 10 | 11 | { |
| 11 | 12 | class SomeTest |
| 12 | 13 | { |
| 14 | + | |
| 13 | 15 | [TestEntry] |
| 16 | + static private bool TestStackFrame() { | |
| 17 | + for (int i = 1; i < 4; i++) { | |
| 18 | + DumpStack(i); | |
| 19 | + } | |
| 20 | + return true; | |
| 21 | + } | |
| 22 | + | |
| 23 | + static private void DumpStack(int skip) { | |
| 24 | + Debug.WriteLine("####Dump StackFrame of "+skip+" ###"); | |
| 25 | + StackFrame callerFrame = new StackFrame(skip); | |
| 26 | + MethodBase callerMethod = callerFrame.GetMethod(); | |
| 27 | + Type callerType = callerMethod.ReflectedType; | |
| 28 | + Debug.WriteLine("FullName=" + callerType.FullName); | |
| 29 | + Debug.WriteLine("Name=" + callerType.Name); | |
| 30 | + Debug.WriteLine("Namespace=" + callerType.Namespace); | |
| 31 | + Debug.WriteLine("BaseType=" + callerType.BaseType.FullName); | |
| 32 | + Debug.WriteLine("ReflectedType=" + callerType.ReflectedType); | |
| 33 | + } | |
| 34 | + | |
| 35 | + [TestEntry] | |
| 14 | 36 | static private bool TestConverter() { |
| 15 | 37 | object o; |
| 16 | 38 | o = Convert.ChangeType("123", typeof(long)); |
| @@ -52,4 +74,6 @@ | ||
| 52 | 74 | } |
| 53 | 75 | |
| 54 | 76 | } |
| 77 | + | |
| 78 | + | |
| 55 | 79 | } |
| @@ -75,10 +75,9 @@ | ||
| 75 | 75 | private void InitializeComponent() |
| 76 | 76 | { |
| 77 | 77 | this.components = new System.ComponentModel.Container(); |
| 78 | - System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("ノード0"); | |
| 78 | + System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("ノード0"); | |
| 79 | 79 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PluginListDialog)); |
| 80 | 80 | this.panel1 = new System.Windows.Forms.Panel(); |
| 81 | - this.labelMsg = new nft.controls.MsgAndIconLabel(); | |
| 82 | 81 | this.button1 = new System.Windows.Forms.Button(); |
| 83 | 82 | this.plist = new System.Windows.Forms.ListView(); |
| 84 | 83 | this.titleColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
| @@ -93,11 +92,12 @@ | ||
| 93 | 92 | this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
| 94 | 93 | this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
| 95 | 94 | this.tabPage2 = new System.Windows.Forms.TabPage(); |
| 96 | - this.info = new nft.controls.UrlLinkLabel(); | |
| 97 | 95 | this.pluginCtxMenu = new System.Windows.Forms.ContextMenuStrip(this.components); |
| 98 | 96 | this.pluginCtxMenu_OpenFile = new System.Windows.Forms.ToolStripMenuItem(); |
| 99 | 97 | this.pluginCtxMenu_OpenByExplorer = new System.Windows.Forms.ToolStripMenuItem(); |
| 100 | 98 | this.pluginCtxMenu_CopyURI = new System.Windows.Forms.ToolStripMenuItem(); |
| 99 | + this.info = new nft.controls.UrlLinkLabel(); | |
| 100 | + this.labelMsg = new nft.controls.MsgAndIconLabel(); | |
| 101 | 101 | this.panel1.SuspendLayout(); |
| 102 | 102 | this.tabControl1.SuspendLayout(); |
| 103 | 103 | this.tabPage1.SuspendLayout(); |
| @@ -115,17 +115,6 @@ | ||
| 115 | 115 | this.panel1.Size = new System.Drawing.Size(432, 32); |
| 116 | 116 | this.panel1.TabIndex = 0; |
| 117 | 117 | // |
| 118 | - // labelMsg | |
| 119 | - // | |
| 120 | - this.labelMsg.BackColor = System.Drawing.SystemColors.Control; | |
| 121 | - this.labelMsg.ImageIndex = -1; | |
| 122 | - this.labelMsg.ImageList = null; | |
| 123 | - this.labelMsg.Location = new System.Drawing.Point(8, 0); | |
| 124 | - this.labelMsg.Message = ""; | |
| 125 | - this.labelMsg.Name = "labelMsg"; | |
| 126 | - this.labelMsg.Size = new System.Drawing.Size(312, 32); | |
| 127 | - this.labelMsg.TabIndex = 1; | |
| 128 | - // | |
| 129 | 118 | // button1 |
| 130 | 119 | // |
| 131 | 120 | this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
| @@ -194,10 +183,10 @@ | ||
| 194 | 183 | this.tree.ImageList = this.image; |
| 195 | 184 | this.tree.Location = new System.Drawing.Point(0, 0); |
| 196 | 185 | this.tree.Name = "tree"; |
| 197 | - treeNode2.Name = ""; | |
| 198 | - treeNode2.Text = "ノード0"; | |
| 186 | + treeNode1.Name = ""; | |
| 187 | + treeNode1.Text = "ノード0"; | |
| 199 | 188 | this.tree.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { |
| 200 | - treeNode2}); | |
| 189 | + treeNode1}); | |
| 201 | 190 | this.tree.SelectedImageIndex = 0; |
| 202 | 191 | this.tree.Size = new System.Drawing.Size(424, 199); |
| 203 | 192 | this.tree.TabIndex = 1; |
| @@ -227,7 +216,7 @@ | ||
| 227 | 216 | this.tabPage1.Name = "tabPage1"; |
| 228 | 217 | this.tabPage1.Size = new System.Drawing.Size(424, 248); |
| 229 | 218 | this.tabPage1.TabIndex = 0; |
| 230 | - this.tabPage1.Text = "リスト表示"; | |
| 219 | + this.tabPage1.Text = "ファイル別表示"; | |
| 231 | 220 | // |
| 232 | 221 | // clist |
| 233 | 222 | // |
| @@ -274,18 +263,8 @@ | ||
| 274 | 263 | this.tabPage2.Name = "tabPage2"; |
| 275 | 264 | this.tabPage2.Size = new System.Drawing.Size(424, 248); |
| 276 | 265 | this.tabPage2.TabIndex = 1; |
| 277 | - this.tabPage2.Text = "ツリー表示"; | |
| 266 | + this.tabPage2.Text = "タイプ別表示"; | |
| 278 | 267 | // |
| 279 | - // info | |
| 280 | - // | |
| 281 | - this.info.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; | |
| 282 | - this.info.Dock = System.Windows.Forms.DockStyle.Bottom; | |
| 283 | - this.info.Location = new System.Drawing.Point(0, 208); | |
| 284 | - this.info.Name = "info"; | |
| 285 | - this.info.Size = new System.Drawing.Size(424, 40); | |
| 286 | - this.info.TabIndex = 2; | |
| 287 | - this.info.TargetUrl = null; | |
| 288 | - // | |
| 289 | 268 | // pluginCtxMenu |
| 290 | 269 | // |
| 291 | 270 | this.pluginCtxMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { |
| @@ -294,7 +273,7 @@ | ||
| 294 | 273 | this.pluginCtxMenu_CopyURI}); |
| 295 | 274 | this.pluginCtxMenu.Name = "pluginCtxMenu"; |
| 296 | 275 | this.pluginCtxMenu.ShowImageMargin = false; |
| 297 | - this.pluginCtxMenu.Size = new System.Drawing.Size(184, 92); | |
| 276 | + this.pluginCtxMenu.Size = new System.Drawing.Size(184, 70); | |
| 298 | 277 | this.pluginCtxMenu.Opening += new System.ComponentModel.CancelEventHandler(this.pluginCtxMenu_Opening); |
| 299 | 278 | // |
| 300 | 279 | // pluginCtxMenu_OpenFile |
| @@ -318,6 +297,27 @@ | ||
| 318 | 297 | this.pluginCtxMenu_CopyURI.Text = "URIをコピー"; |
| 319 | 298 | this.pluginCtxMenu_CopyURI.Click += new System.EventHandler(this.puginCtxMenu_CopyURI_Click); |
| 320 | 299 | // |
| 300 | + // info | |
| 301 | + // | |
| 302 | + this.info.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; | |
| 303 | + this.info.Dock = System.Windows.Forms.DockStyle.Bottom; | |
| 304 | + this.info.Location = new System.Drawing.Point(0, 208); | |
| 305 | + this.info.Name = "info"; | |
| 306 | + this.info.Size = new System.Drawing.Size(424, 40); | |
| 307 | + this.info.TabIndex = 2; | |
| 308 | + this.info.TargetUrl = null; | |
| 309 | + // | |
| 310 | + // labelMsg | |
| 311 | + // | |
| 312 | + this.labelMsg.BackColor = System.Drawing.SystemColors.Control; | |
| 313 | + this.labelMsg.ImageIndex = -1; | |
| 314 | + this.labelMsg.ImageList = null; | |
| 315 | + this.labelMsg.Location = new System.Drawing.Point(8, 0); | |
| 316 | + this.labelMsg.Message = ""; | |
| 317 | + this.labelMsg.Name = "labelMsg"; | |
| 318 | + this.labelMsg.Size = new System.Drawing.Size(312, 32); | |
| 319 | + this.labelMsg.TabIndex = 1; | |
| 320 | + // | |
| 321 | 321 | // PluginListDialog |
| 322 | 322 | // |
| 323 | 323 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 12); |
| @@ -495,12 +495,12 @@ | ||
| 495 | 495 | private void ShowInfoMessage() |
| 496 | 496 | { |
| 497 | 497 | labelMsg.ImageIndex = (int)UIMessageType.info; |
| 498 | - labelMsg.Text = Main.resources["pluginlist.normal_message"].stringValue; | |
| 498 | + labelMsg.Text = I18n.T("Uncheck to forbid cpu using this plug-in."); | |
| 499 | 499 | } |
| 500 | 500 | private void ShowErrorMessage() |
| 501 | 501 | { |
| 502 | 502 | labelMsg.ImageIndex = (int)UIMessageType.alert; |
| 503 | - labelMsg.Text = Main.resources["pluginlist.error_message"].stringValue; | |
| 503 | + labelMsg.Text = I18n.T("This contribution cannot invalidate."); | |
| 504 | 504 | Win32Util.MessageBeep(); |
| 505 | 505 | } |
| 506 | 506 |