//──────────────────────────────────────── protected virtual Configurationtree_Node CreateMyself( XmlElement cur_X, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports) { Configurationtree_Node cf_Cur = new Configurationtree_NodeImpl(cur_X.Name, parent_Cf); return(cf_Cur); }
//──────────────────────────────────────── protected override Configurationtree_Node CreateMyself( XmlElement cur_X, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports) { Configurationtree_Node cur_Cf; cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf); return(cur_Cf); }
//──────────────────────────────────────── /// <summary> /// 実行。 /// /// 全てのコントロールの、指定のイベントを実行します。 /// /// アプリケーション起動時に、"OnLoad"を全て実行するなど。 /// /// 別の関数から呼び出されます。 /// </summary> /// <param name="oEventName"></param> /// <param name="oEventName"></param> /// <param name="log_Reports"></param> public void Execute1_AllUsercontrols( List <string> sFcNameList, object sender, XenonName o_Name_Event, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute1_AllUsercontrols", log_Reports); // // Configurationtree_Node cf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null); foreach (string sName_Usercontrol in sFcNameList) { if ("" == sName_Usercontrol) { // 空行。飛ばす。 goto end_row; } Expression_Leaf_StringImpl ec_FcName = new Expression_Leaf_StringImpl(null, cf_ThisMethod); ec_FcName.SetString(sName_Usercontrol, log_Reports); List <Usercontrol> list_UcFc = owner_MemoryApplication.MemoryForms.GetUsercontrolsByName(ec_FcName, true, log_Reports); if (list_UcFc.Count < 1) { // 正常。 // 特に設定をすることのないコントロールは、XMLファイルが用意されていない。 // 無視する。 } else { Usercontrol ucFc = list_UcFc[0]; this.Execute1_UsercontrolImpl( sender, ucFc, o_Name_Event, owner_MemoryApplication, log_Reports ); } end_row: ; } // // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// tool-saveファイルへの絶対パスを取得します。 /// 取得できなかった場合、空文字列を返します。 /// </summary> /// <returns></returns> public string GetFilepathabsolute( string sFpath, bool bRequired, Log_Reports pg_Logging ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Toolwindow.Name_Library, this, "GetFilepathabsolute", pg_Logging); string sFpatha_xml; if (pg_Logging.Successful) { // 正常時 // ツールの設定のファイルパス Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("!ハードコーディング_Flow0010#GetFileAbsPath", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09TcDlg_1", parent_Cf); cf_Fpath.InitPath( sFpath, pg_Logging ); if (!pg_Logging.Successful) { // 既エラー。 sFpatha_xml = ""; goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); sFpatha_xml = ec_Fpath.Execute4_OnExpressionString( EnumHitcount.Unconstraint, pg_Logging); if (!pg_Logging.Successful) { // 既エラー。 sFpatha_xml = ""; goto gt_EndMethod; } } else { // 既エラー。 sFpatha_xml = ""; goto gt_EndMethod; } goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(pg_Logging); return(sFpatha_xml); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public Request_ReadsTableImpl() { this.name_PutToTable = ""; this.use = ""; { Configurationtree_Node s_ParentNode = new Configurationtree_NodeImpl("!ハードコーディング_Request_TableReadsImpl#<init>", null); Configurationtree_NodeFilepath s_fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L02_1", s_ParentNode); this.expression_Filepath = new Expression_Node_FilepathImpl(s_fpath); } }
//──────────────────────────────────────── protected override Configurationtree_Node CreateMyself( XmlElement cur_X, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports) { Configurationtree_Node cur_Cf; if (NamesNode.S_CODEFILE_TOGETHERS == parent_Cf.Name) { cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_TOGETHER, parent_Cf); cur_Cf.Dictionary_Attribute.Set(PmNames.S_IN.Name_Pm, "", log_Reports); } else { cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_TOGETHER, parent_Cf); } return(cur_Cf); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public ControlCommonImpl() { Log_Method log_Method = new Log_MethodImpl(); Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(log_Method); log_Method.BeginMethod(Info_Controls.Name_Library, this, "ControlCommonImpl", log_Reports_ThisMethod); // コントロールを作った時に、必ずnameプロパティを設定してください。 // ただし、直接 Visual Studio のビジュアルエディターで配置した場合は設定できません。 Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname + "<init>", null); this.configurationtree_Control = new Configurationtree_NodeImpl(NamesNode.S_CONTROL1, cur_Cf);//ダミーのデフォルト・オブジェクト? this.expression_Name_Control = new Expression_Node_StringImpl(null, cur_Cf); log_Method.EndMethod(log_Reports_ThisMethod); log_Reports_ThisMethod.EndLogging(log_Method); }
//──────────────────────────────────────── private List <Configurationtree_Node> ConvertTarget2(Configurationtree_Node cf_Together, Log_Reports log_Reports) { List <Configurationtree_Node> cfList_Result = new List <Configurationtree_Node>(); string sTargetList; cf_Together.Dictionary_Attribute.TryGetValue(PmNames.S_TARGET1, out sTargetList, false, log_Reports); List <string> sList_Target = new CsvTo_ListImpl().Read(sTargetList); foreach (string sTarget in sList_Target) { Configurationtree_NodeImpl cf_RfrTarget = new Configurationtree_NodeImpl(NamesNode.S_TARGET, cf_Together); cf_RfrTarget.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sTarget, log_Reports); cfList_Result.Add(cf_RfrTarget); } return(cfList_Result); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// アクション実行。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override string Execute5_Main(Log_Reports log_Reports) { // // // //()メソッドの開始。 // // // Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); if (this.EnumEventhandler == EnumEventhandler.O_Lr) { this.Execute6_Sub( this.Functionparameterset.Sender, log_Reports ); // // } else if (this.EnumEventhandler == EnumEventhandler.O_Ea) { Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null); Configuration_Node cf_Event = this.Cur_Configuration.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports); this.Execute6_Sub( this.Functionparameterset.Sender, log_Reports ); } // // log_Method.EndMethod(log_Reports); return(""); }
//──────────────────────────────────────── protected void Execute6_Sub( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); string sName_Fnc; this.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sName_Fnc + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // 変数は、登録されている名前の変数は存在し、登録されていない名前の変数は(自動作成されたもの以外は)存在しない。 // // 元となるテーブルを見ながら、変数オブジェクトの内容を調べていく。 // // Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname, null); // 変数ログを吐く。 { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); sb.Append(","); sb.Append(NamesFld.S_ID); sb.Append(","); sb.Append(NamesFld.S_EXPL); sb.Append(","); sb.Append(NamesFld.S_NAME); sb.Append(","); sb.Append(NamesFld.S_FOLDER); sb.Append(","); sb.Append(NamesFld.S_VALUE); sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT); //NO sb.Append(","); sb.Append(NamesTypedb.S_INT); //ID sb.Append(","); sb.Append(NamesTypedb.S_STRING); //Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING); //NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING); //FOLDER sb.Append(","); sb.Append(NamesTypedb.S_STRING); //VALUE sb.Append(","); sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); //3行目 sb.Append("-1,"); //NO sb.Append("使わない,"); //ID sb.Append("解説,"); //Expl sb.Append("変数名,"); //NAME sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,"); //FOLDER sb.Append("初期値,"); //VALUE sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); int nAuto = 0; this.Owner_MemoryApplication.MemoryVariables.EachVariable(delegate(string sKey, Expression_Node_String ec_String, ref bool bBreak) { if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("[" + sKey + "]=[" + ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]"); } sb.Append(nAuto);//NO sb.Append(","); //ID 使わない sb.Append(","); //Expl 消えてしまう sb.Append(","); sb.Append(sKey);//NAME sb.Append(","); //FOLDER TODO:逆算が必要 sb.Append(","); sb.Append(ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); //VALUE sb.Append(","); sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); nAuto++; }); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(sb.ToString()); } //ログ出力 { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOG_VARIABLES; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } //変数CSVを吐き出したい。(登録されている順序を保って) { // 変数ファイルの読取り Table_Humaninput o_Table_Variables; this.Owner_MemoryApplication.MemoryVariables.TryGetTable_Variables( out o_Table_Variables, Application.StartupPath, log_Reports ); if (null != o_Table_Variables) { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); sb.Append(","); sb.Append(NamesFld.S_ID); sb.Append(","); sb.Append(NamesFld.S_EXPL); sb.Append(","); sb.Append(NamesFld.S_NAME); sb.Append(","); sb.Append(NamesFld.S_FOLDER); sb.Append(","); sb.Append(NamesFld.S_VALUE); sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT); //NO sb.Append(","); sb.Append(NamesTypedb.S_INT); //ID sb.Append(","); sb.Append(NamesTypedb.S_STRING); //Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING); //NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING); //FOLDER sb.Append(","); sb.Append(NamesTypedb.S_STRING); //VALUE sb.Append(","); sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); //3行目 sb.Append("-1,"); //NO sb.Append("使わない,"); //ID sb.Append("解説,"); //Expl sb.Append("変数名,"); //NAME sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,"); //FOLDER sb.Append("初期値,"); //VALUE sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); int nAuto = 0; foreach (DataRow row in o_Table_Variables.DataTable.Rows) { if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NO)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_NO], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } // IDは空欄が正しいが、int型なので空欄にできないので 0 を入れる。 if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_ID)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_ID], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_EXPL)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_EXPL], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); } string sName_Var = ""; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NAME)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_NAME], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); sName_Var = sValue; } // 現在の変数の内容 string sValue_Var = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); //現在の変数の内容を検索 if (NamesVar.Test_Filepath(sName_Var)) { Expression_Node_Filepath ec_Fpath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); // 絶対パスとは限らない。フォルダーを指していることもある。 string sFpath = ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //フォルダー列値を取得。 string sNamevar_Folder_Src; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_FOLDER)) { String_HumaninputImpl.TryParse(row[NamesFld.S_FOLDER], out sNamevar_Folder_Src, "", "", log_Method, log_Reports); //フォルダーパス Expression_Node_Filepath ec_Folder = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sNamevar_Folder_Src, null, cur_Cf), false, log_Reports); if (null != ec_Folder) { // FOLDER列に入力があれば。 string sFpath_Folder = ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (sValue_Var.StartsWith(sFpath_Folder)) { // FOLDER列値をそのままキープ。 sb.Append(sNamevar_Folder_Src); // 値のフォルダー部分を削る。 sValue_Var = sValue_Var.Substring(sFpath_Folder.Length); // 先頭が ディレクトリー区切り文字なら削る。 if (sValue_Var.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { sValue_Var = sValue_Var.Substring(System.IO.Path.DirectorySeparatorChar.ToString().Length); } } else { // FOLDER列値はそのまま使えない。 } } sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { //string sValue; //String_HumaninputImpl.TryParse(row[NamesFld.S_VALUE], out sValue, "", "", log_Method, log_Reports); //sb.Append(sValue); //sb.Append(","); // 現在の変数の値(の削った残り)を入れる。 sb.Append(sValue_Var); sb.Append(","); } } else// if (NamesVar.Test_String(sName_Var)) { // FOLDER列値は無し。 sb.Append(","); if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { // 現在の変数の値を入れる。 sb.Append(sValue_Var); sb.Append(","); } } sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); nAuto++; } //ファイル書出し { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_SAVE_VARIABLES; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } } // // メッセージボックスの表示。 { StringBuilder sb = new StringBuilder(); sb.Append(this.GetType().Name); sb.Append("#Execute6_Sub:"); sb.Append(Environment.NewLine); string sArgMessage; this.TrySelectAttribute(out sArgMessage, Expression_Node_Function45Impl.PM_MESSAGE, EnumHitcount.One_Or_Zero, log_Reports); sb.Append(sArgMessage); MessageBox.Show(sb.ToString(), "変数をCSVファイルに書き出したい。"); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 「変数設定ファイル」のテーブルを読み取り、変数を登録します。 /// </summary> /// <param oVariableName="varOTable"></param> /// <param oVariableName="log_Reports"></param> public void Load( Table_Humaninput o_Table_Var, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "Load", log_Reports); // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「変数登録ファイル」を Load します。"); } // // // // if (null == o_Table_Var) { goto gt_Error_NullTable; } if (null != this.parent_Variablesconfig_Configurationtree) { goto gt_Error_DoubleLoad; } string err_SFolder; string err_SName; if (log_Reports.Successful) { this.parent_Variablesconfig_Configurationtree = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_CONFIG, o_Table_Var.Expression_Filepath_ConfigStack.Cur_Configuration); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } foreach (DataRow dataRow in o_Table_Var.DataTable.Rows) { string sStringValue;// = ""; // ソース情報として使うだけ。 Configurationtree_Node cf_VarRecord1 = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_RECORD, parent_Variablesconfig_Configurationtree); // 注意: dataRow[]の連想配列は大文字・小文字を区別しないのが欠点。 //NAME列 { string sFldName = NamesFld.S_NAME;//フィールド名。 if (o_Table_Var.ContainsField(sFldName, true, log_Reports)) { if (String_HumaninputImpl.TryParse( dataRow[sFldName], out sStringValue, o_Table_Var.Name, sFldName, log_Method, log_Reports)) { } else { sStringValue = ""; } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sStringValue, log_Reports); } } // FOLDER列 (オプション) { string sFldName = NamesFld.S_FOLDER; if (o_Table_Var.ContainsField(sFldName, false, log_Reports)) { if (String_HumaninputImpl.TryParse( dataRow[sFldName], out sStringValue, o_Table_Var.Name, sFldName, log_Method, log_Reports)) { } else { sStringValue = ""; } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列=[" + sStringValue + "]"); //} cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sStringValue, log_Reports); } else { //なければ無視。 } } // VALUE列 { string sFldName = NamesFld.S_VALUE;//フィールド名。 if (o_Table_Var.ContainsField(sFldName, true, log_Reports)) { if (String_HumaninputImpl.TryParse( dataRow[sFldName], out sStringValue, o_Table_Var.Name, sFldName, log_Method, log_Reports)) { } else { sStringValue = ""; } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sStringValue, log_Reports); } } // // 変数を登録。 // if (log_Reports.Successful) { //NAME列 string sName; cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName, true, log_Reports); //FOLDER列 (オプション) string sFolder; bool bExistsFolder = cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_FOLDER, out sFolder, false, log_Reports); string sValue; cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, false, //空文字列でも可。 log_Reports); if (NamesVar.Test_Filepath(sName)) { //ファイルパス変数の場合。 Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("変数[" + sName + "]", this.parent_Variablesconfig_Configurationtree); cf_Fpath.InitPath( sValue, log_Reports ); if ("" != sFolder) { //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定あり=[" + sFolder + "]"); //} Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sFolder, null, this.parent_Variablesconfig_Configurationtree); Expression_Node_Filepath ec_Fopath_Folder = this.GetExpressionfilepathByVariablename( ec_Namevar_Folder, true, log_Reports ); cf_Fpath.SetDirectory_Base(ec_Fopath_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); } //else //{ // if (log_Method.CanDebug(1)) // { // log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定なし"); // } //} Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); this.PutFilepath( sName, ec_Fpath, true, log_Reports ); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス変数=[" + sName + "] 値=[" + ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]"); //} } else { //ファイルパス以外の変数の場合。 //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス以外の変数=[" + sName + "]"); //} if (bExistsFolder && "" != sFolder) { //ファイルパス変数以外の変数で、FOLDER列値を指定しているのはエラーです。 //※FOLDER列が存在する場合だけエラーチェックします。FOLDER列値がない場合は、sFolderには"null"が入っているので無視します。 err_SName = sName; err_SFolder = sFolder; goto gt_Error_InputFolder; } this.PutString( sName, sValue, log_Reports ); } } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_InputFolder: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("Er:402;", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("["); s.Append(err_SName); s.Append("]変数に、"); s.Append(PmNames.S_FOLDER.Name_Attribute); s.Append("列値を指定しているのはエラーです。"); s.Newline(); s.Append(PmNames.S_FOLDER.Name_Attribute); s.Append("列値は、ファイルパス変数にしか書いてはいけません。"); s.Newline(); s.Append("ファイルパス変数は、「"); s.Append(NamesVar.S_SP_); s.Append("」、「"); s.Append(NamesVar.S_UP_); s.Append("」で始まる名前の変数です。"); s.Newline(); s.Newline(); s.AppendI(1, PmNames.S_FOLDER.Name_Attribute); if (null == err_SFolder) { s.Append("=ヌル。"); } else { s.Append("=["); s.Append(err_SFolder); s.Append("]"); } s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullTable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー918!", log_Method); StringBuilder t = new StringBuilder(); t.Append("指定されたテーブルは、ヌルでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_DoubleLoad: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー919!", log_Method); StringBuilder t = new StringBuilder(); t.Append("既に「変数設定ファイル」はロードされているのに、"); t.Append(Environment.NewLine); t.Append("また 「変数設定ファイル」をロードしようとしました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 例えば、次の2つの物を与えると、 /// ●ID=10、EXPL=赤、と入っている行。 /// ●「%1%:%2%|ID|EXPL」という文字列。 /// /// すると、次の文字列が返ってくる。 /// ●「10:EXPL」 /// /// %1%はID、%2%はEXPLに当たる。 /// </summary> /// <param name="sFormat"></param> /// <param name="dataRowView"></param> /// <param name="xenonTable"></param> /// <param name="sErrorMsg"></param> /// <returns></returns> public string Perform( string sFormat, DataRowView dataRowView, Table_Humaninput xenonTable, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Perform", log_Reports); string result; if (null == xenonTable) { // エラー // テーブルが未指定の場合 goto gt_Error_NullTable; } CsvTo_DataTableImpl reader = new CsvTo_DataTableImpl(); reader.CharSeparator = '|'; DataTable scriptParameters = reader.Read( sFormat ); if (scriptParameters.Rows.Count < 1) { // 警告 // 項目の表示書式が指定されていない場合 // result = "(【Er:301;】表示書式未指定、レイアウト設定で)"; // エラーにはしない。 if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole("(【Er:301;】表示書式未指定、レイアウト設定で)"); } goto gt_EndMethod; } DataRow dataRow = scriptParameters.Rows[0]; object[] recordFields = dataRow.ItemArray;// ItemArrayは1回の呼び出しが重い。 Builder_TexttemplateP1pImpl formatString = new Builder_TexttemplateP1pImpl(); formatString.Text = recordFields[0].ToString();//例:"%1%:%2%" //.Console.WriteLine(this.GetType().Name + "#CreateText: recordFields[0].ToString()=[" + recordFields[0].ToString() + "]"); FieldToParameters fieldToParameters = new FieldToParameters(); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_RecordFormatStringImpl#CreateText", null); // フィールド名のリストが続く。 for (int nIndex = 1; nIndex < recordFields.Length; nIndex++) { //.Console.WriteLine(this.GetType().Name + "#CreateText: index=[" + index + "] recordFields[index].ToString()=[" + recordFields[index].ToString() + "]"); string sFieldName = recordFields[nIndex].ToString(); fieldToParameters.AddField( sFieldName, xenonTable, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 result = "(エラー)"; goto gt_EndMethod; } } fieldToParameters.Perform(ref formatString, dataRowView, xenonTable, log_Reports); if (!log_Reports.Successful) { // 既エラー。 result = "(エラー)"; goto gt_EndMethod; } result = formatString.Perform(log_Reports); goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullTable: result = "(テーブルが未指定です)"; if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー131!", log_Method); r.Message = "(エラー。テーブルが未指定です)"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(result); }
//──────────────────────────────────────── protected override Configurationtree_Node CreateMyself( XmlElement cur_X, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "CreateMyself", log_Reports); if (log_Method.CanDebug(1)) { } // // Configurationtree_Node cur_Cf = null; // // name属性は必須。 // string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute); if ("" == sName_Fnc) { goto gt_Error_UndefinedFncNameAttr; } // // if ( NamesFnc.S_CELL == sName_Fnc || //Sf:cell; NamesFnc.S_WHERE == sName_Fnc || //Sf:where; NamesFnc.S_REC_COND == sName_Fnc || //Sf:rec-cond; NamesFnc.S_VALUE_CONTROL == sName_Fnc || NamesFnc.S_CASE == sName_Fnc || //Sf:case;” NamesFnc.S_LISTBOX_LABELS == sName_Fnc || //Sf:list-box-labels; NamesFnc.S_SWITCH == sName_Fnc || //Sf:switch; NamesFnc.S_ITEM_LABEL2 == sName_Fnc || //Sf:item-label; NamesFnc.S_ITEM_VALUE == sName_Fnc || //Sf:item-value; NamesFnc.S_ITEM_GRAY_OUT == sName_Fnc || //Sf:item-gray-out; NamesFnc.S_TEXT_TEMPLATE == sName_Fnc || //Sf:text-template; NamesFnc.S_EMPTY_FIELD == sName_Fnc || NamesFnc.S_ALL_TRUE == sName_Fnc ) { cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf); } else if (NamesNode.S_DATA == cur_X.Name) { // 【追加】 cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_DATA, parent_Cf); } else if (NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc) { // ノード名は fnc では。 cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_A_RECORD_SET_SAVE_TO, parent_Cf); } else { // <fnc name=”Sa:入力値の確定;”> // などがここにくる。 cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedFncNameAttr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー412!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<fnc>要素に、name属性が指定されていませんでした。"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(cur_Cf); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public override void XmlToConfigurationtree( //override XmlElement cur_X, Configurationtree_Node parent_Cf, //トゥゲザー設定ファイル MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports); // // // // // // 自 // // // Configurationtree_Node cur_Cf = this.CreateMyself(cur_X, parent_Cf, memoryApplication, log_Reports); // // // //「トゥゲザー登録ファイル」に書かれているのか、 //「コントロール設定ファイル」に書かれているのかで、処理を変えます。 // // // bool bGlobalRfr; if (NamesNode.S_CODEFILE_TOGETHERS == parent_Cf.Name) { bGlobalRfr = true; //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("親要素がトゥゲザーコンフィグってことは、グローバル・トゥゲザー?"); //} } else { bGlobalRfr = false; //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("トゥゲザーコンフィグじゃないって何?"); //} } // // // // 属性 // // // //name(未設定可) if (log_Reports.Successful) { XmlNode xNd = cur_X.Attributes.GetNamedItem(PmNames.S_NAME.Name_Attribute); if (null != xNd) { cur_Cf.Dictionary_Attribute.Add(PmNames.S_NAME.Name_Pm, xNd.Value, cur_Cf, false, log_Reports); } } //in(未設定可。コントロール設定ファイルには無い) if (log_Reports.Successful) { if (bGlobalRfr) { XmlNode xNd = cur_X.Attributes.GetNamedItem(PmNames.S_IN.Name_Pm); if (null != xNd) { cur_Cf.Dictionary_Attribute.Set(PmNames.S_IN.Name_Pm, xNd.Value, log_Reports); } } } //on(コントロール設定ファイルでは必須、グローバル・トゥゲザー登録ファイルには無い) if (log_Reports.Successful) { if (!bGlobalRfr) { XmlNode xNd = cur_X.Attributes.GetNamedItem(PmNames.S_ON.Name_Attribute); if (null != xNd) { cur_Cf.Dictionary_Attribute.Add(PmNames.S_ON.Name_Pm, xNd.Value, cur_Cf, false, log_Reports); } else { // エラー goto gt_Error_NoOn; } } } // target(コントロール設定ファイルでは必須、グローバル・トゥゲザー登録ファイルには無い) if (log_Reports.Successful) { if (!bGlobalRfr) { XmlNode xNd = cur_X.Attributes.GetNamedItem(PmNames.S_TARGET1.Name_Attribute); if (null != xNd) { cur_Cf.Dictionary_Attribute.Add(PmNames.S_TARGET1.Name_Pm, xNd.Value, cur_Cf, false, log_Reports); } else { // エラー goto gt_Error_NoTarget; } } } //description(未設定可) if (log_Reports.Successful) { XmlNode xNd = cur_X.Attributes.GetNamedItem(PmNames.S_DESCRIPTION.Name_Attribute); if (null != xNd) { cur_Cf.Dictionary_Attribute.Add(PmNames.S_DESCRIPTION.Name_Pm, xNd.Value, cur_Cf, true, log_Reports); } } // // // // 子 // // // XmlElement err_Child_X; if (log_Reports.Successful) { if (bGlobalRfr) { if (log_Reports.Successful) { // // target要素 // XmlNodeList child_XNl = cur_X.ChildNodes; foreach (XmlNode child_XNode in child_XNl) { if (XmlNodeType.Element == child_XNode.NodeType) { XmlElement xChild = (XmlElement)child_XNode; if (NamesNode.S_TARGET == xChild.Name) { // // target要素 // string sName_Target = xChild.Attributes.GetNamedItem(PmNames.S_NAME.Name_Attribute).Value; Configurationtree_Node cfRfr_Target = new Configurationtree_NodeImpl(NamesNode.S_TARGET, cur_Cf); cfRfr_Target.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sName_Target, log_Reports); cur_Cf.List_Child.Add(cfRfr_Target, log_Reports); } else { // エラー err_Child_X = xChild; goto gt_Error_Child; } } } } } } // // // // 親 // // // string err_SIn; if (bGlobalRfr) { string sIn; if (log_Reports.Successful) { // 重複チェック用。 List <string> sList_In = new List <string>(); List <string> sList_Name = new List <string>(); // // // // (1)in属性が付いていれば そちらへ、 // (2)nameが付いていれば そちらへ。 // 重複名があれば発見したい。 // // // cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_IN, out sIn, false,//空文字列でも構わない。 log_Reports); string sName_Rfr; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Rfr, false, log_Reports); if ("" != sIn) { // トゥゲザー登録ファイルに、in指定での<together>要素を追加。 // 重複チェック。 if (!sList_In.Contains(sIn)) { sList_In.Add(sIn); parent_Cf.List_Child.Add(cur_Cf, log_Reports); } else { // エラー。 err_SIn = sIn; goto gtj_Error_DuplicationIn; } } else if ("" != sName_Rfr) { // トゥゲザー設定ファイルに、name指定での<together>要素を追加。 // 重複チェック。 if (!sList_Name.Contains(sName_Rfr)) { sList_Name.Add(sName_Rfr); parent_Cf.List_Child.Add(cur_Cf, log_Reports); } else { // エラー goto gt_Error_DuplicationTogether; } } else { // エラー goto gt_Error_Attr; } } goto gt_EndMethod; } else { // // // // 親 // // // if (log_Reports.Successful) { string sOn; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_ON, out sOn, false, log_Reports); List <Configurationtree_Node> listCf_Together = parent_Cf.GetChildrenByNodename(NamesNode.S_TOGETHER, false, log_Reports); foreach (Configurationtree_Node cf_Together in listCf_Together) { string sOn2; cf_Together.Dictionary_Attribute.TryGetValue(PmNames.S_ON, out sOn2, false, log_Reports); if (sOn == sOn2) { // エラー goto gt_Error_DuplicationOn; } } parent_Cf.List_Child.Add(cur_Cf, log_Reports); } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gtj_Error_DuplicationIn: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_TOGETHER, log_Reports); //ノード名 tmpl.SetParameter(2, PmNames.S_IN.Name_Attribute, log_Reports); //引数名 tmpl.SetParameter(3, err_SIn, log_Reports); //in属性値 tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports); //設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:8026;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_DuplicationTogether: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_TOGETHER, log_Reports);//ノード名 string sName_Tg; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Tg, false, log_Reports); tmpl.SetParameter(2, sName_Tg, log_Reports); //指定したtogether名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports); //設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:8027;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_DuplicationOn: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, PmNames.S_ON.Name_Attribute, log_Reports); //属性名on tmpl.SetParameter(2, NamesNode.S_TOGETHER, log_Reports); //ノード名トゥゲザー tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(parent_Cf), log_Reports); //設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:8028;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Attr: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_TOGETHER, log_Reports); //ノード名 tmpl.SetParameter(2, "in,name", log_Reports); //属性名リスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports); //設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:8029;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Child: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_TOGETHER, log_Reports); //ノード名 tmpl.SetParameter(2, NamesNode.S_TARGET, log_Reports); //期待する子ノード名 tmpl.SetParameter(3, err_Child_X.Name, log_Reports); //実際の子ノード名 tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports); //設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:8030;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoTarget: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_TOGETHER, log_Reports); //ノード名 tmpl.SetParameter(2, PmNames.S_TARGET1.Name_Attribute, log_Reports); //期待する属性名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(parent_Cf), log_Reports); //設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:8031;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoOn: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_TOGETHER, log_Reports); //ノード名 tmpl.SetParameter(2, PmNames.S_ON.Name_Attribute, log_Reports); //期待する属性名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(parent_Cf), log_Reports); //設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:8032;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── /// <summary> /// 『ユーザー定義関数設定ファイル(Fnc)』を読み取ります。 /// </summary> public void LoadFile( Expression_Node_Filepath filepath_Userfunctionconfig_Expr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile", log_Reports); // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数設定ファイルの読み取り。"); } Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_FUNCTIONS, filepath_Userfunctionconfig_Expr.Cur_Configuration);//Info_OpyopyoImpl.LibraryName + ":" + this.GetType().Name + ".LoadFile_Fnc" Expression_Node_String userfunctionconfig_Expr = new Expression_Node_StringImpl(null, parent_Conf); string filepathabsolute = filepath_Userfunctionconfig_Expr.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { goto gt_Error_Fpath; } if (!System.IO.File.Exists(filepathabsolute)) { goto gt_Error_File; } XmlDocument xDoc = new XmlDocument(); Exception err_Excp = null; try { xDoc.Load(filepathabsolute); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (ArgumentException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } XmlElement xRoot = null; if (log_Reports.Successful) { // ルート要素を取得 xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(関数登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(filepathabsolute, null), NamesNode.S_CODEFILE_FUNCTIONS ); } string sErrorElementName = ""; if (log_Reports.Successful) { XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { if (NamesNode.S_COMMON_FUNCTION == xTopNode.Name) { XmlElement x_Cur = (XmlElement)xTopNode; string sNameValue = x_Cur.GetAttribute(PmNames.S_NAME.Name_Attribute); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数の追加を開始:" + sNameValue); } // XToCf XmlToConfigurationtree_C15_Elm xToCf = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_COMMON_FUNCTION, log_Reports); xToCf.XmlToConfigurationtree( x_Cur, parent_Conf, this.Owner_MemoryApplication, log_Reports ); Configurationtree_Node s_Cur = null; parent_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak) { s_Cur = s_Child; bBreak = true; }); // SToE Expression_Node_FunctionImpl ec_CommonFunction = new Expression_Node_FunctionImpl(userfunctionconfig_Expr, s_Cur, new List <string>()); Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; ConfigurationtreeToExpression_AbstractImpl.ParseChild_InAnotherLibrary( s_Cur, ec_CommonFunction, this.Owner_MemoryApplication, pg_ParsingLog, log_Reports ); if (log_Method.CanInfo() && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" d_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString()); } this.Owner_MemoryApplication.MemoryFunctions.AddFunction(sNameValue, ec_CommonFunction, log_Reports); } else { // // エラー。 sErrorElementName = xTopNode.Name; goto gt_Error_UndefinedChild; } } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Fpath: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー101!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルへのパスにエラーがありました。"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_File: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー102!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルがありません。"); s.Newline(); s.Append("file=["); s.Append(filepathabsolute); s.Append("]"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Doc: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー103!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エラー:" + err_Excp.Message); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Log_RecordReportsImpl.ToText_Configuration(filepath_Userfunctionconfig_Expr.Cur_Configuration)); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChild: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー104!", log_Method); StringBuilder s = new StringBuilder(); s.Append("未定義の要素:" + sErrorElementName); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// Rfrファイル読取。 /// /// 呼び出し元で、memoryApplicationに Stg をセットする。 /// </summary> public Configurationtree_Node XmlToConfigurationtree( string sFpatha,//絶対ファイルパス MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports); // // // リローディング設定。 Configurationtree_Node sTg_Cnf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_TOGETHERS, new Configurationtree_NodeImpl(sFpatha, null)); System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); XmlElement err_XTop; Exception err_Excp; try { xDoc.Load(sFpatha); // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(関数登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(sFpatha, null), NamesNode.S_CODEFILE_TOGETHERS ); if (log_Reports.Successful) { XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { XmlElement xTop = (XmlElement)xTopNode; if (NamesNode.S_TOGETHER == xTop.Name) { XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_TOGETHER, log_Reports); to.XmlToConfigurationtree( xTop, sTg_Cnf, memoryApplication, log_Reports ); } else { err_XTop = xTop; goto gt_Error_NotSupportedChild; } } } } } catch (System.IO.IOException ex) { err_Excp = ex; goto gt_Error_IOException; } catch (Exception ex) { err_Excp = ex; goto gt_Error_Exception; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotSupportedChild: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー387!", log_Method); StringBuilder t = new StringBuilder(); t.Append("トゥゲザー登録ファイルに、<" + NamesNode.S_TOGETHER + ">要素以外の要素["); t.Append(err_XTop.Name); t.Append("]が含まれていました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(sTg_Cnf)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_IOException: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー388!", log_Method); StringBuilder t = new StringBuilder(); t.Append("ファイルが見つかりません。"); t.Append(Environment.NewLine); t.Append("absoluteFilePath=["); t.Append(sFpatha); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(sTg_Cnf)); t.Append(r.Message_SException(err_Excp)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー344!", log_Method); StringBuilder t = new StringBuilder(); t.Append("読み込むファイルを間違えているかも?"); t.Append(Environment.NewLine); t.Append("トゥゲザー登録ファイル(絶対パス)=[" + sFpatha + "]"); t.Append(Environment.NewLine); t.Append("ex.Message=[" + err_Excp.Message + "]"); t.Append(Environment.NewLine); t.Append("ex.GetType().Name=[" + err_Excp.GetType().Name + "]"); // ヒント t.Append(r.Message_Configuration(sTg_Cnf)); t.Append(r.Message_SException(err_Excp)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(sTg_Cnf); }
//──────────────────────────────────────── /// <summary> /// 「Aa_Files.csv」に書かれている「テーブル」と「スクリプト」を読取り、登録します。 /// </summary> private void ReadAndRegisterFiles( Table_Humaninput xenonTable_Aafilescsv, Log_Reports log_Reports ) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "ReadAndRegisterFiles", log_Reports); string err_STypedata; // // // // 「Aa_Files.csv」自身の絶対ファイルパス // // // string sFpatha_Aafilescsv; if (log_Reports.Successful) { sFpatha_Aafilescsv = xenonTable_Aafilescsv.Expression_Filepath_ConfigStack.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } else { sFpatha_Aafilescsv = null; } // // // //「TYPE_DATA」というフィールドは必須です。 // // // bool isExists_FieldTypedata; if (log_Reports.Successful) { if (xenonTable_Aafilescsv.DataTable.Columns.Contains(NamesFld.S_TYPE_DATA)) { isExists_FieldTypedata = true; } else { isExists_FieldTypedata = false; } } else { isExists_FieldTypedata = false; } int err_NRow = 1;//行番号 if (log_Reports.Successful) { // // テーブルを全て(読み込まないもの除く)読み取ります。 // foreach (DataRow datarow in xenonTable_Aafilescsv.DataTable.Rows) { Request_ReadsTable requestRead = this.CreateReadRequest( datarow, xenonTable_Aafilescsv, log_Reports); if (!log_Reports.Successful) { //既エラー時、ループ抜け。 break; } // // テーブルを読み取るのか、XMLを読み取るのかの区別。 // if ( ValuesTypeData.TestTable(requestRead.Typedata) || !isExists_FieldTypedata //TYPE_DATAフィールドそのものが無ければ、エラーとはせず、テーブルとして読み込みます。 ) { // // テーブルなら。 // Format_Table_Humaninput forTable_format = this.Read_RequestPart_Table( datarow, sFpatha_Aafilescsv, log_Reports); Table_Humaninput oTable; // テーブル読取の実行。(書き出し専用の場合は、登録だけする) oTable = this.ReadTable( requestRead, forTable_format, log_Reports ); // テーブルは読み込まなくても、登録はする。 if (log_Reports.Successful) { // アプリケーション・モデルに、テーブルを登録 this.Owner_MemoryApplication.MemoryTables.AddTable_Humaninput( oTable, log_Reports ); } // } else if ( ValuesTypeData.TestCode(requestRead.Typedata) ) { // // XMLなら。 // MemoryCodefileinfo moScriptfileInfo = this.Read_RequestPart_Script( datarow, sFpatha_Aafilescsv, xenonTable_Aafilescsv, log_Reports ); // 登録 if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryCodefiles.Add( moScriptfileInfo, log_Reports ); } //requestRead. log_Method.WriteDebug_ToConsole("sTypeData=[" + requestRead.Typedata + "]"); } else { //エラー。 err_STypedata = requestRead.Typedata; goto gt_Error_TypeData; } //エラー報告用の行カウンター。 err_NRow++; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_TypeData: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesFld.S_TYPE_DATA, log_Reports); //フィールド名TYPE_DATA tmpl.SetParameter(2, err_STypedata, log_Reports); //TYPE_DATAフィールドの値 tmpl.SetParameter(3, ValuesTypeData.Message_Allitems(), log_Reports); //TYPE_DATAフィールドに設定できる値のリスト Configurationtree_Node cf = new Configurationtree_NodeImpl("データ部" + err_NRow + "行", xenonTable_Aafilescsv.Parent); tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(cf), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110011;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// エラーログを出力します。(エラーが発生したときに呼び出してください) /// </summary> /// <param oVariableName="output_d_Logging"></param> /// <param name="runningHintName">このメソッドが呼び出された場所が分かるようなヒント。</param> public void WriteErrorLog( MemoryApplication moApplication, Log_Reports log_ReportsBuffer_Output, string sRunningHintName ) { Log_Method log_Method = new Log_MethodImpl(0); // メタ。 Log_Reports log_Reports_Meta = new Log_ReportsImpl(log_Method); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "WriteErrorLog", log_Reports_Meta); // // // 書き出すテキスト // string sOutput; { sOutput = log_ReportsBuffer_Output.ToText(); } // // 書き出し先ファイルへのパス // Expression_Node_Filepath ec_Fpath; if (log_Reports_Meta.Successful) { XenonName o_Name_Variable = new XenonNameImpl(NamesVar.S_SP_LOGS, new Configurationtree_NodeImpl("!ハードコーディング_MoOpyopyoImpl#WriteLog", null)); // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(null, o_Name_Variable.Cur_Configuration); ec_Atom.SetString( o_Name_Variable.SValue, log_Reports_Meta ); // ファイルパス。 log_Reports_Meta.Log_Callstack.Push(log_Method, "③"); ec_Fpath = moApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Atom, true, log_Reports_Meta ); log_Reports_Meta.Log_Callstack.Pop(log_Method, "③"); } else { ec_Fpath = null; } // // ファイルの書き出し // string err_SFpatha; { string sFpatha; if (log_Reports_Meta.Successful) { // フォルダーへの絶対パス string sFopatha_Logs = ec_Fpath.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports_Meta); if (!log_Reports_Meta.Successful) { // 既エラー。 goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath2; { Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("!ハードコーディング_MoOpyopyoImpl#WriteLog", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_6", parent_Cf); cf_Fpath.InitPath( sFopatha_Logs, "error-log.txt", log_Reports_Meta ); if (!log_Reports_Meta.Successful) { // 既エラー。 goto gt_EndMethod; } ec_Fpath2 = new Expression_Node_FilepathImpl(cf_Fpath); } sFpatha = ec_Fpath2.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports_Meta); } else { sFpatha = "<エラー>"; } if (log_Reports_Meta.Successful) { try { System.IO.File.WriteAllText(sFpatha, sOutput, Global.ENCODING_LOG); //#正常な、エラー出力 StringBuilder s0 = new StringBuilder(); s0.Append("エラーが発生しました!"); s0.Append(Environment.NewLine); s0.Append(Environment.NewLine); s0.Append("アプリケーションは正常に動作していない可能性があります。"); s0.Append(Environment.NewLine); s0.Append(Environment.NewLine); s0.Append("エラーログを書き出しました。"); s0.Append(Environment.NewLine); s0.Append("["); s0.Append(sFpatha); s0.Append("]"); s0.Append(Environment.NewLine); s0.Append(Environment.NewLine); s0.Append("このアプリケーションの開発者にエラーログをお知らせください。"); MessageBox.Show( s0.ToString(), "▲エラーが発生しました! " + Info_MiddleImpl.Name_Library + ":" + this.GetType().Name + "#WriteErrorLog"); } catch (Exception) { err_SFpatha = sFpatha; goto gt_Error_CanNotWriteErrorLog; } } else { // メタのロガーが、エラーを検知。 goto gt_Error_MetaNotSuccessful; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_CanNotWriteErrorLog: { StringBuilder s0 = new StringBuilder(); s0.Append("▲312!エラーが発生しましたが、エラーログを出力できませんでした。("); s0.Append(Info_MiddleImpl.Name_Library); s0.Append(") ファイルパス=["); s0.Append(err_SFpatha); s0.Append("]"); MessageBox.Show(sOutput, s0.ToString()); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_MetaNotSuccessful: { Log_TextIndented s0 = new Log_TextIndentedImpl(); s0.Append("エラーが発生しましたが、エラーログを出力できませんでした。"); s0.Newline(); s0.Newline(); s0.Append("もしかして?"); s0.Newline(); s0.Append(" ・設定ファイルの「エラーログの書出し先」を読み込む前に、エラーが出てしまった?"); s0.Newline(); s0.Append(" ・「ログファイル書き出し先」は指定されていますか?"); s0.Newline(); s0.Newline(); s0.Append("実行箇所ヒント:"); s0.Newline(); s0.Append(" ・"); s0.Append(sRunningHintName); s0.Newline(); s0.Newline(); MessageBox.Show( s0.ToString(), //sOutput, "▲エラー!【Er:101;】(" + log_Method.Fullname + ")"); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports_Meta); return; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// プロジェクト読取り時の定形アクション実行。 /// </summary> /// <param name="sender"></param> /// <param name="st_PrevProjectElm_OrNull"></param> /// <param name="bProjectValid"></param> /// <param name="log_Reports"></param> public override string Execute5_Main(Log_Reports log_Reports) { //()メソッド開始 Log_Method log_Method = new Log_MethodImpl(1); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「プロジェクト選択時」用のイベントハンドラーを実行します。"); } //()タスク_デスクリプション { string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)this.Functionparameterset.Sender; string sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe += "/追加:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe += "/追加:[" + sFncName0 + "]アクションを実行。"; } } Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null); if (this.EnumEventhandler == EnumEventhandler.Editor_B_Lr) { //(4)独自モデルの取得 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(4)独自モデルの取得"); } // this.On_P04_ReadNewModel(log_Reports); //(5)エディター名。ツール設定ファイルに記載されている方。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(5)エディター名。ツール設定ファイルに記載されている方。"); } // 表示用の名称。 string sName_SelectingEditor; if (this.Functionparameterset.SelectedProjectElement_Configurationtree == null) { // // 切り替えるプロジェクトが判明していない場合は、空文字列。 // sName_SelectingEditor = ""; } else { // // todo: エディター設定ファイルの方のエディター名を入れても意味ないのでは? // sName_SelectingEditor = ((MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree).Name; } //(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用) if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用)"); } // todo:イベントハンドラーを外してから、フォームを外すこと。リストボックスが誤挙動を起こしている。 this.On_P06_ClearProject(this.Functionparameterset.Sender, log_Reports); //(7)「Aa_Editor.xml」読取。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(7)「Aa_Editor.xml」読取。"); } // if (!this.Functionparameterset.IsProjectValid || this.Functionparameterset.SelectedProjectElement_Configurationtree == null) { MemoryAatoolxml_Editor moAatoolxml_PrevEditorElm_OrNull = null; // // // // デフォルト・プロジェクト名が指定されていない場合、 // ツール設定ファイルの最初に記述されているプロジェクトを選択します。 // // // if (log_Reports.Successful) { if ("" == sName_SelectingEditor) { // // デフォルト・エディター名が未指定の場合。 // MemoryAatoolxml_Editor moAatoolxml_DefaultEditor = this.Owner_MemoryApplication.MemoryAatoolxml.GetDefaultEditor(true, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } // ↓これ要る? sName_SelectingEditor = moAatoolxml_DefaultEditor.Name; } } this.On_P07_SelectDefaultProject(ref sName_SelectingEditor, ref moAatoolxml_PrevEditorElm_OrNull, this.Functionparameterset.IsProjectValid, log_Reports); this.Functionparameterset.SelectedProjectElement_Configurationtree = moAatoolxml_PrevEditorElm_OrNull; // // // //「プロジェクトを開いた時の初期化」イベントハンドラーで使うために、ここで設定します。 // // // this.Functionparameterset.SelectedProjectElement_Configurationtree = this.Owner_MemoryApplication.MemoryAatoolxml.GetEditorByName(sName_SelectingEditor, true, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } // ↓追加 if (null == this.Functionparameterset.SelectedProjectElement_Configurationtree) { { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_SelectingEditor, log_Reports);//エディター名 this.Owner_MemoryApplication.CreateErrorReport("Er:110003;", tmpl, log_Reports); } } // ↑追加 //(13a)エディター・フォルダー。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(13a)エディター・フォルダーパス類推。"); } // // // Expression_Node_Filepath ec_Fopath_Editor; if (log_Reports.Successful) { MemoryAatoolxml_Editor moAatoolxml_SelectedEditor = (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree; ec_Fopath_Editor = moAatoolxml_SelectedEditor.GetFilepathByFsetvarname( NamesVar.S_SP_EDITOR, this.Owner_MemoryApplication.MemoryVariables, true, log_Reports ); } else { ec_Fopath_Editor = null; } //(13b)「Aa_Editor.xml」読取。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(13b)「Aa_Editor.xml」ファイルパス類推。"); } // Expression_Node_Filepath ec_Fpath_AaEditorXml; if (log_Reports.Successful) { // // ツール設定ファイルで指定された値から、自動類推で設定されているはず。 // Configurationtree_NodeFilepath cf_Fpath_EditorXml = new Configurationtree_NodeFilepathImpl( "ツール設定ファイル[" + Application.StartupPath + System.IO.Path.DirectorySeparatorChar + ValuesAttr.S_FPATHR_AATOOLXML + "]の中の[" + sName_SelectingEditor + "]エディターへの指定から自動類推", null); // フォルダーパス + \Aa_Editor.xml string sFpatha_Aaeditorxml = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML; // プロジェクト起動時に。 cf_Fpath_EditorXml.InitPath( sFpatha_Aaeditorxml, log_Reports ); ec_Fpath_AaEditorXml = new Expression_Node_FilepathImpl(cf_Fpath_EditorXml); } else { ec_Fpath_AaEditorXml = null; } //(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M。この時点で「Sp:Engine;」といったシステム変数は自動類推が終わっている必要があります。"); } // MemoryAaeditorxml_Editor moAaeditorxml_Editor = null; if (log_Reports.Successful) { this.On_P08_SpToVar_( out moAaeditorxml_Editor, ec_Fpath_AaEditorXml, ec_Fopath_Editor, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, log_Reports ); } // // // // ここで「Aa_Files.csv」を読み込みたい。 // // // if (log_Reports.Successful) { //(9)変数ファイル読取 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(9)変数ファイル読取"); } // this.Owner_MemoryApplication.MemoryVariables.LoadVariables( Application.StartupPath, log_Reports ); } if (log_Reports.Successful) { //(10)プログラマー用・デバッグモードのON/OFF。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(10)プログラマー用・デバッグモードのON/OFF。"); } // //mainWndの作成より先に設定する必要がある。ステータスバーを出す、出さないについて。 { Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent); ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_PROGRAMMER, log_Reports); string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports); if (ValuesAttr.S_ON == sValue) { Log_ReportsImpl.BDebugmode_Static = true; } else if (ValuesAttr.S_OFF == sValue) { Log_ReportsImpl.BDebugmode_Static = false; } else if (ValuesAttr.S_EMPTY == sValue) { // 無視 } else { // TODO:エラー } } } if (log_Reports.Successful) { //(11)画面レイアウト・デバッグモードのON/OFF。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(11)フォーム・デバッグモードのON/OFF。"); } // Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent); ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_FORM, log_Reports); string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports); if (ValuesAttr.S_ON == sValue) { Log_ReportsImpl.BDebugmode_Form = true; } else if (ValuesAttr.S_OFF == sValue) { Log_ReportsImpl.BDebugmode_Form = false; } else if (ValuesAttr.S_EMPTY == sValue) { // 無視 } else { // TODO:エラー } } //(14)「Aa_Files.csv」読取。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(14)「Aa_Files.csv」読取。"); } // List <Expression_Node_Filepath> ecList_Fpath_BackupRequest; { if (log_Reports.Successful) { // 正常時 Expression_Node_Function function_Expr = Collection_Function.NewFunction2( Expression_Node_Function22Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); // 実行 function_Expr.Execute4_OnLr(this.Functionparameterset.Sender, log_Reports); // 実行後 ecList_Fpath_BackupRequest = ((Expression_Node_Function22Impl)function_Expr).List_Expression_Filepath_BackupRequest_Out; } else { // // エラー // ecList_Fpath_BackupRequest = null; } } //(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】"); } // if (log_Reports.Successful) { // タイプデータ値。 Expression_Leaf_StringImpl ec_NameVariable = new Expression_Leaf_StringImpl(this, new Configurationtree_NodeImpl("!ハードコーディング", null)); ec_NameVariable.SetString(ValuesTypeData.S_CODE_FUNCTIONS, log_Reports); List <MemoryCodefileinfo> listInfo = null; if (log_Reports.Successful) { listInfo = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_NameVariable, true, log_Reports); } if (log_Reports.Successful) { foreach (MemoryCodefileinfo scriptfile in listInfo) { if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryFunctions.LoadFile( scriptfile.Expression_Filepath, log_Reports); } else { break; } } } } //(16)『スタイルシート設定ファイル』読取 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(16)『スタイルシート設定ファイル』読取"); } // if (log_Reports.Successful) { Expression_Node_Function expr_Func = Collection_Function.NewFunction2( Expression_Node_Function19Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(this, conf_ThisMethod); ec_Str.AppendTextNode(NamesVar.S_ST_STYLESHEET, this.Cur_Configuration, log_Reports); expr_Func.SetAttribute(Expression_Node_Function19Impl.PM_NAME_TABLE_STYLESHEET, ec_Str, log_Reports); expr_Func.Execute4_OnLr( this.Functionparameterset.Sender, log_Reports ); } //(17a)「バックアップを取る」前にしておく独自実装をするタイミング。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(17a)「バックアップを取る」前にしておく独自実装をするタイミング。"); } // this.On_P17a_PreviousBackup( this.Functionparameterset.Sender, moAaeditorxml_Editor, ec_Fpath_AaEditorXml, ec_Fopath_Editor, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, log_Reports); //(17b)今日の分のバックアップを取ります。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(17b)今日の分のバックアップを取ります。"); } // this.On_P17b_DateBackup(ecList_Fpath_BackupRequest, this.Functionparameterset.Sender, log_Reports); //(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。"); } // this.On_P17c_PreviousOpenWindow( this.Functionparameterset.Sender, moAaeditorxml_Editor, ec_Fpath_AaEditorXml, ec_Fopath_Editor, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, log_Reports); //(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。"); } // { Expression_Node_Function expr_Func = Collection_Function.NewFunction2( Expression_Node_Function30Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); { //Expression_Node_Function30Impl f1 = { Expression_Node_StringImpl ec_FormStart; { Expression_FvarImpl ec_Fvar = new Expression_FvarImpl(this, this.Cur_Configuration, this.Owner_MemoryApplication); ec_Fvar.AppendTextNode(NamesVar.S_SS_FORM_START, this.Cur_Configuration, log_Reports); ec_FormStart = new Expression_Node_StringImpl(this, this.Cur_Configuration); ec_FormStart.List_Expression_Child.Add(ec_Fvar, log_Reports); } ((Expression_Node_Function30Impl)expr_Func).SetAttribute(Expression_Node_Function30Impl.PM_NAME_FORM, ec_FormStart, log_Reports); } ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_1 = this.In_Subroutine_Function30_1_OrNull; ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_2 = this.In_Subroutine_Function30_2_OrNull; ((Expression_Node_Function30Impl)expr_Func).SetAttribute( Expression_Node_Function30Impl.PM_NAME_TOGETHER, new Expression_Leaf_StringImpl(NamesStg.S_STG_BEGIN_APPLICATION, null, conf_ThisMethod), log_Reports); } expr_Func.Execute4_OnLr( this.Functionparameterset.Sender, log_Reports ); } //(19)最後に if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(19)最後に"); } // this.On_P19_AtLast( this.Functionparameterset.Sender, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, this.Functionparameterset.IsProjectValid, log_Reports); // // 「S」と「E」を出力したい。 if (false) { // 「S」全てのコントロールと、ユーザー定義関数について。 log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのコントロールについて。"); this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); fcUc.ControlCommon.Expression_Control.Cur_Configuration.ToText_Content(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのユーザー定義関数について。"); this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); ec_CommonFunction.Cur_Configuration.ToText_Content(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); // 「E」全てのコントロールと、ユーザー定義関数について。 log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのコントロールについて。"); this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); fcUc.ControlCommon.Expression_Control.ToText_Snapshot(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのユーザー定義関数について。"); this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); ec_CommonFunction.ToText_Snapshot(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); } log_Method.WriteInfo_ToConsole("◆起動終了"); goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); } return(""); }
//──────────────────────────────────────── /// <summary> /// トゥゲザー名で指定しなかった場合の、 /// (2)なければ「トゥゲザー設定ファイル(Frfr)」の<refresher>を読みにいく。 /// </summary> /// <param name="log_Reports"></param> private void Execute3b_ByNoName_2Frfr( out Configurationtree_Node cf_TgTogether, Configurationtree_Node s_Fc, Configurationtree_Node cf_Event, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute3b_ByNoName_2Frfr", log_Reports); // // // 11:トゥゲザー名の作成 // 所要時間目安[0]ミリ秒ほど // // string sFcName3; s_Fc.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sFcName3, true, log_Reports); string sEventName; cf_Event.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, true, log_Reports); StringBuilder sIn = new StringBuilder(); sIn.Append(sFcName3); sIn.Append("/"); sIn.Append(sEventName); Configurationtree_Node sTg_TogetherIn = new Configurationtree_NodeImpl(NamesNode.S_TOGETHER_IN, this.Cur_Configuration); sTg_TogetherIn.Dictionary_Attribute.Add(PmNames.S_VALUE.Name_Pm, sIn.ToString(), this.Cur_Configuration, false, log_Reports); // // // 12:トゥゲザーの取得 // 所要時間目安[0]ミリ秒ほど // // // // // // (0)トゥゲザーの取得 // // // cf_TgTogether = null; if (log_Reports.Successful) { string sExpectedValue; sTg_TogetherIn.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sExpectedValue, false, log_Reports); if ("" != sExpectedValue) { List <Configurationtree_Node> listCf_Together = this.Owner_MemoryApplication.MemoryTogethers.Configurationtree_Togetherconfig.GetChildrenByNodename(NamesNode.S_TOGETHER, false, log_Reports); foreach (Configurationtree_Node cf_Together in listCf_Together) { string sIn2; cf_Together.Dictionary_Attribute.TryGetValue(PmNames.S_IN, out sIn2, false, log_Reports); if (sExpectedValue == sIn2) { cf_TgTogether = cf_Together; } } } } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// アクション実行。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); if (log_Reports.CanStopwatch) { string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // if (this.EnumEventhandler == EnumEventhandler.O_Kea) { Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null); Keys keys = this.Functionparameterset.KeyEventArgs.KeyCode; // // Form1のKeyPreview属性を true にしておく必要があります。 // switch (keys) { case Keys.F8: // // 「ツール設定ウィンドウ」を開きます。 // //OWrittenPlace oWrittenPlace = new OWrittenPlaceImpl(this.OWrittenPlace.WrittenPlace + "!ハードコーディング_NAction21#(10)"); Expression_Node_Function expr_Func = Collection_Function.NewFunction2( Expression_Node_Function11Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); Configuration_Node cf_Event; { cf_Event = this.Cur_Configuration.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports); } expr_Func.Execute4_OnLr( this.Functionparameterset.Sender, log_Reports ); //essageBox.Show("[F8]キーを押しました。", "△情報103!"); break; } } // // log_Method.EndMethod(log_Reports); return(""); }
//──────────────────────────────────────── /// <summary> /// 変数を設定します。 /// </summary> public void SetVariable( XenonName o_Name_Variable, Expression_Node_String ec_Value, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetVariable", log_Reports); // // if ( o_Name_Variable.SValue.StartsWith(NamesVar.S_SP_) || o_Name_Variable.SValue.StartsWith(NamesVar.S_UP_) ) { string sFilePath = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_" + this.GetType().Name + "#SetVariable", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_4", parent_Configurationtree_Node); cf_Fpath.InitPath( sFilePath, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); this.SetFilepathValue( o_Name_Variable.SValue, ec_Fpath, bRequired, log_Reports ); } else if ( // 新仕様 o_Name_Variable.SValue.StartsWith(NamesVar.S_SS_) || o_Name_Variable.SValue.StartsWith(NamesVar.S_US_) ) { string str1 = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); this.SetStringValue( o_Name_Variable, str1, bRequired, log_Reports ); } else { } // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// UsercontrolPerformerImpl#Perform_FcImpl で使用。 /// UsercontrolPerformerImpl#Perform で使用。 /// /// cf_Eventは、ucFc.ControlCommon.Configurationtree_Control.SDic_Event から取っている。 /// </summary> /// <param name="sender"></param> /// <param name="event_Conf"></param> /// <param name="moWorkbench"></param> /// <param name="log_Reports"></param> public void Execute2_Event( object sender, Configurationtree_Node event_Conf, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute2_Event", log_Reports); Configurationtree_Node cf_ThisMethod = new Configurationtree_NodeImpl("<" + log_Method.Fullname + ":>", null); if (log_Reports.CanStopwatch) { // コメント作成 { StringBuilder sb = new StringBuilder(); string sName_Control; { Configuration_Node owner_Configurationtree_Control = event_Conf.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Control, false, log_Reports); } string sEventName; { event_Conf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, false, log_Reports); } int nActionCount; { nActionCount = event_Conf.List_Child.Count; } sb.Append(Info_Functions.Name_Library); sb.Append(":"); sb.Append(this.GetType().Name); sb.Append("#ToString: イベント計測 "); sb.Append(" FC["); sb.Append(sName_Control); sb.Append("].EV["); sb.Append(sEventName); sb.Append("]"); if (0 < nActionCount) { sb.Append("アクション数=["); sb.Append(nActionCount); sb.Append("]"); } log_Method.Log_Stopwatch.Message = sb.ToString(); log_Method.Log_Stopwatch.Begin(); } } // ステータスバーに表示する文字列。 { if (sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)sender; if (null == ccFc.ControlCommon.Owner_MemoryApplication) { log_Method.WriteDebug_ToConsole("null==ccFc.ControlCommon.Owner_MemoryApplication がヌルでした。"); } else { ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolNameBegin(log_Reports); string sName_Usercontrol = sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolName(sName_Usercontrol, log_Reports); } } } event_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Action, ref bool bBreak) { Executer3_FunctionImpl exe2 = new Executer3_FunctionImpl(); // イベントハンドラーの作成 Expression_Node_Function expr_Func = exe2.ConfigurationtreeToFunction( s_Action, owner_MemoryApplication, log_Reports ); // システム定義関数の実行 exe2.Execute3_Function( expr_Func, sender, owner_MemoryApplication, log_Reports ); // 他の待機スレッドに、実行順番を譲る。 //TODO: System.Threading.Thread.Sleep(0); //if (Log_ReportsImpl.BDebugmode_Static) //{ // //.WriteLine(this.GetType().Name + "#:\n│\n│\n│\n│"); //} }); log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public string GetSFilepath_UsercontrolconfigAbsolute( Expression_Node_Filepath ec_Fpath_Fcnf, Expression_Node_Filepath ec_Fopath_Forms, Log_Reports log_Reports ) { string sFpatha_Fcnf; // // forms フォルダー // string sFopatha_Forms = ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } // // Fcnf 絶対ファイルパス // if (log_Reports.Successful) { // 正常時 Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("formsフォルダーパス+コンポーネント設定ファイルパス", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L08_1", parent_Cf); cf_Fpath.InitPath( sFopatha_Forms, ec_Fpath_Fcnf.Humaninput, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } Expression_Node_Filepath ec_Fpatha_Fcnf = new Expression_Node_FilepathImpl(cf_Fpath); sFpatha_Fcnf = ec_Fpatha_Fcnf.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } } else { // エラー sFpatha_Fcnf = ""; } goto gt_EndMethod; // // gt_EndMethod: return(sFpatha_Fcnf); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public void CreateErrorReport( string errorSymbol, Builder_TexttemplateP1p texttemplateBuilder_ParameterSetted, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "CreateErrorReport", log_Reports); // int errorNumber; { string tempErrorSymbol = errorSymbol; if (tempErrorSymbol.StartsWith("Er:")) { tempErrorSymbol = tempErrorSymbol.Substring(3); if (tempErrorSymbol.EndsWith(";")) { tempErrorSymbol = tempErrorSymbol.Substring(0, tempErrorSymbol.Length - 1); if (int.TryParse(tempErrorSymbol, out errorNumber)) { } else { goto gt_Error_Symbol; } } else { goto gt_Error_Symbol; } } else { goto gt_Error_Symbol; } } if (log_Reports.CanCreateReport) { string strTypedata = ValuesTypeData.S_TABLE_ERRORMESSAGES; Configurationtree_Node cur_Ct = new Configurationtree_NodeImpl(log_Method.Fullname, null); List <Table_Humaninput> tables = this.MemoryTables.GetTable_HumaninputByTypedata( new Expression_Leaf_StringImpl(strTypedata, null, cur_Ct), true, log_Reports); bool hit = false; foreach (Table_Humaninput table in tables) { foreach (DataRow dataRow in table.DataTable.Rows) { Int_HumaninputImpl xenonValue_Int = (Int_HumaninputImpl)dataRow["ID"]; int valueInt; xenonValue_Int.TryGet(out valueInt); if (valueInt == errorNumber) { //ヒット hit = true; Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("Er:" + errorNumber + ";", log_Method); String_HumaninputImpl xenonValue_String = (String_HumaninputImpl)dataRow["MESSAGE"]; string valueStr; xenonValue_String.TryGet(out valueStr); texttemplateBuilder_ParameterSetted.Text = valueStr; r.Message = texttemplateBuilder_ParameterSetted.Compile(log_Reports).Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //log_Method.WriteDebug_ToConsole(texttemplateBuilder_ParameterSetted.Compile(log_Reports).Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); goto gt_EndLoop1; } } } gt_EndLoop1: if (!hit) { //エラーメッセージの登録がない。 Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("Er:0;", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("エラーメッセージテーブルに、エラーメッセージの登録がありませんでした。\n%1%=[%2%]\nテーブル数=[%3%]"); Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(s.ToString()); tmpl.SetParameter(1, NamesFld.S_TYPE_DATA, log_Reports); tmpl.SetParameter(2, strTypedata, log_Reports); tmpl.SetParameter(3, tables.Count.ToString(), log_Reports); r.Message = tmpl.Compile(log_Reports).Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } log_Reports.EndCreateReport(); } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_Symbol: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー204!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エラーシンボルがおかしい。[" + errorSymbol + "]。プログラムのミス?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── protected void Execute6_Sub( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); string sName_Fnc; this.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sName_Fnc + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // 変数は、登録されている名前の変数は存在し、登録されていない名前の変数は(自動作成されたもの以外は)存在しない。 // // 元となるテーブルを見ながら、変数オブジェクトの内容を調べていく。 // // Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname, null); // 変数ログを吐く。 { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); //NO sb.Append(","); sb.Append(NamesFld.S_ID); //ID sb.Append(","); sb.Append(NamesFld.S_TREE); //TREE sb.Append(","); sb.Append(NamesFld.S_EXPL); //Expl sb.Append(","); sb.Append(NamesFld.S_FILE); //FILE sb.Append(","); sb.Append(NamesFld.S_NAME); //NAME sb.Append(","); sb.Append(NamesFld.S_TYPE); //TYPE sb.Append(","); sb.Append(NamesFld.S_TEXT); //TEXT sb.Append(","); sb.Append(NamesFld.S_FONT_SIZE_PT); //FONT_SIZE_PT sb.Append(","); sb.Append(NamesFld.S_X_LT); //X_LT sb.Append(","); sb.Append(NamesFld.S_Y_LT); //Y_LT sb.Append(","); sb.Append(NamesFld.S_WIDTH); //WIDTH sb.Append(","); sb.Append(NamesFld.S_HEIGHT); //HEIGHT sb.Append(","); sb.Append(NamesFld.S_ENABLED); //ENABLED sb.Append(","); sb.Append(NamesFld.S_VISIBLE); //VISIBLE sb.Append(","); sb.Append(NamesFld.S_READ_ONLY); //READ_ONLY sb.Append(","); sb.Append(NamesFld.S_WORD_WRAP); //WORD_WRAP sb.Append(","); sb.Append(NamesFld.S_NEW_LINE); //NEW_LINE sb.Append(","); sb.Append(NamesFld.S_SCROLL_BARS); //SCROLL_BARS sb.Append(","); sb.Append(NamesFld.S_CHK_VALUE_TYPE); //CHK_VALUE_TYPE sb.Append(","); sb.Append(NamesFld.S_PIC_ZOOM); //PIC_ZOOM sb.Append(","); sb.Append(NamesFld.S_TAB_INDEX); //TAB_INDEX sb.Append(","); sb.Append(NamesFld.S_BACK_COLOR); //BACK_COLOR sb.Append(","); //ここまで基本テーブル。 sb.Append(NamesFld.S_ITEM_HEIGHT_PX); //ITEM_HEIGHT_PX sb.Append(","); sb.Append(NamesFld.S_ITEM_DISPLAY_FORMAT); //ITEM_DISPLAY_FORMAT sb.Append(","); sb.Append(NamesFld.S_LIST_VALUE_FIELD); //LIST_VALUE_FIELD sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT); //NO sb.Append(","); sb.Append(NamesTypedb.S_INT); //ID sb.Append(","); sb.Append(NamesTypedb.S_INT); //TREE sb.Append(","); sb.Append(NamesTypedb.S_STRING); //Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING); //FILE sb.Append(","); sb.Append(NamesTypedb.S_STRING); //NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING); //TYPE sb.Append(","); sb.Append(NamesTypedb.S_STRING); //TEXT sb.Append(","); sb.Append(NamesTypedb.S_STRING); //FONT_SIZE_PT sb.Append(","); sb.Append(NamesTypedb.S_INT); //X_LT sb.Append(","); sb.Append(NamesTypedb.S_INT); //Y_LT sb.Append(","); sb.Append(NamesTypedb.S_INT); //WIDTH sb.Append(","); sb.Append(NamesTypedb.S_INT); //HEIGHT sb.Append(","); sb.Append(NamesTypedb.S_BOOL); //ENABLED sb.Append(","); sb.Append(NamesTypedb.S_BOOL); //VISIBLE sb.Append(","); sb.Append(NamesTypedb.S_BOOL); //READ_ONLY sb.Append(","); sb.Append(NamesTypedb.S_BOOL); //WORD_WRAP sb.Append(","); sb.Append(NamesTypedb.S_STRING); //NEW_LINE sb.Append(","); sb.Append(NamesTypedb.S_STRING); //SCROLL_BARS sb.Append(","); sb.Append(NamesTypedb.S_STRING); //CHK_VALUE_TYPE sb.Append(","); sb.Append(NamesTypedb.S_INT); //PIC_ZOOM sb.Append(","); sb.Append(NamesTypedb.S_INT); //TAB_INDEX sb.Append(","); sb.Append(NamesTypedb.S_STRING); //BACK_COLOR sb.Append(","); //ここまで基本テーブル。 sb.Append(NamesTypedb.S_INT); //ITEM_HEIGHT_PX sb.Append(","); sb.Append(NamesTypedb.S_STRING); //ITEM_DISPLAY_FORMAT sb.Append(","); sb.Append(NamesTypedb.S_STRING); //LIST_VALUE_FIELD sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //3行目 sb.Append("-1,"); //NO sb.Append("使わない,"); //ID sb.Append("ネスト関係,"); //TREE sb.Append("解説,"); //Expl sb.Append("コントロール設定ファイルパス,"); //FILE sb.Append("コントロール固有名,"); //NAME sb.Append("コントロールの型,"); //TYPE sb.Append("初期値,"); //TEXT sb.Append("フォントサイズ(pt),"); //FONT_SIZE_PT sb.Append("左上角の座標X,"); //X_LT sb.Append("左上角の座標Y,"); //Y_LT sb.Append("横幅ピクセル,"); //WIDTH sb.Append("縦幅ピクセル,"); //HEIGHT sb.Append("活性化,"); //ENABLED sb.Append("可視,"); //VISIBLE sb.Append("テキストボックス等を読み取り専用にするなら真。,"); //READ_ONLY sb.Append("テキストエリアで行を自動的に折り返すなら真。,"); //WORD_WRAP sb.Append("(テキストエリア)改行記号。,"); //NEW_LINE sb.Append("テキストエリア等で利用。None,Horizontal,Vertical,Bothの4つ。使わないなら空欄。,"); //SCROLL_BARS sb.Append("チェックボックスの値の型。(空欄:false,true。ZERO_ONE:0,1),"); //CHK_VALUE_TYPE sb.Append("(未実装)画像の倍角サイズ。2000で2倍。,"); //PIC_ZOOM sb.Append("タブ・インデックス,"); //TAB_INDEX sb.Append("背景色,"); //BACK_COLOR //ここまで基本テーブル。 sb.Append("リストボックスの項目の高さ(ピクセル),"); //ITEM_HEIGHT_PX sb.Append("リストボックスの各項目の表示書式,"); //ITEM_DISPLAY_FORMAT sb.Append("(開発中)リストボックスの値が入っている、レコードのフィールド名。,"); //LIST_VALUE_FIELD sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); int nAuto = 0; this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol uct_Child, ref bool bRemove, ref bool bBreak) { //uct_Child.ControlCommon.Configurationtree_Control.Dictionary_Attribute. sb.Append(nAuto);//NO sb.Append(","); //ID は使わない。 sb.Append(","); sb.Append(NamesFld.S_TREE); //TREE sb.Append(","); sb.Append(NamesFld.S_EXPL); //Expl sb.Append(","); sb.Append(NamesFld.S_FILE); //FILE sb.Append(","); sb.Append(uct_Child.ControlCommon.Configurationtree_Control.Name); //NAME sb.Append(","); sb.Append(NamesFld.S_TYPE); //TYPE sb.Append(","); sb.Append(uct_Child.UsercontrolText); //TEXT sb.Append(","); sb.Append(uct_Child.UsercontrolFontsizept); //FONT_SIZE_PT sb.Append(","); sb.Append(uct_Child.UsercontrolXlt); //X_LT sb.Append(","); sb.Append(uct_Child.UsercontrolYlt); //Y_LT sb.Append(","); sb.Append(uct_Child.UsercontrolWidth); //WIDTH sb.Append(","); sb.Append(uct_Child.UsercontrolHeight); //HEIGHT sb.Append(","); if (uct_Child.UsercontrolEnabled) { sb.Append(uct_Child.UsercontrolEnabled);//ENABLED } sb.Append(","); if (uct_Child.UsercontrolVisible) { sb.Append(uct_Child.UsercontrolVisible);//VISIBLE } sb.Append(","); if (uct_Child.UsercontrolReadonly) { sb.Append(uct_Child.UsercontrolReadonly);//READ_ONLY } sb.Append(","); if (uct_Child.UsercontrolWordwrap) { sb.Append(uct_Child.UsercontrolWordwrap);//WORD_WRAP } sb.Append(","); sb.Append(uct_Child.UsercontrolNewline);//NEW_LINE sb.Append(","); switch (uct_Child.UsercontrolScrollbars) { case ScrollBars.Both: sb.Append(ValuesAttr.S_BOTH); break; case ScrollBars.Horizontal: sb.Append(ValuesAttr.S_HORIZONTAL); break; case ScrollBars.Vertical: sb.Append(ValuesAttr.S_VERTICAL); break; default: //TODO:「無視」と、「無し」は、分けたい。 //sb.Append(ValuesAttr.S_NONE); break; } sb.Append(","); sb.Append(uct_Child.UsercontrolChkvaluetype); //CHK_VALUE_TYPE sb.Append(","); sb.Append(uct_Child.UsercontrolPiczoom); //PIC_ZOOM sb.Append(","); sb.Append(uct_Child.UsercontrolTabindex); //TAB_INDEX sb.Append(","); sb.Append(uct_Child.UsercontrolBackcolor); //BACK_COLOR sb.Append(","); //ここまで基本テーブル。 sb.Append(uct_Child.UsercontrolItemheightpx); //ITEM_HEIGHT_PX sb.Append(","); sb.Append(uct_Child.UsercontrolItemdisplayformat); //ITEM_DISPLAY_FORMAT sb.Append(","); sb.Append(uct_Child.UsercontrolListvaluefield /*"NO"*/); //TODO:LIST_VALUE_FIELD sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); nAuto++; }); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(sb.ToString()); } //ログ出力 { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOG_FORM; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } //変数CSVを吐き出したい。(登録されている順序を保って) { // 変数ファイルの読取り Table_Humaninput o_Table_Variables; this.Owner_MemoryApplication.MemoryVariables.TryGetTable_Variables( out o_Table_Variables, Application.StartupPath, log_Reports ); if (null != o_Table_Variables) { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); //NO sb.Append(","); sb.Append(NamesFld.S_ID); //ID sb.Append(","); sb.Append(NamesFld.S_TREE); //TREE sb.Append(","); sb.Append(NamesFld.S_EXPL); //Expl sb.Append(","); sb.Append(NamesFld.S_NAME); sb.Append(","); sb.Append(NamesFld.S_FOLDER); sb.Append(","); sb.Append(NamesFld.S_VALUE); sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT); //NO sb.Append(","); sb.Append(NamesTypedb.S_INT); //ID sb.Append(","); sb.Append(NamesTypedb.S_STRING); //Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING); //NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING); //FOLDER sb.Append(","); sb.Append(NamesTypedb.S_STRING); //VALUE sb.Append(","); sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); //3行目 sb.Append("-1,"); //NO sb.Append("使わない,"); //ID sb.Append("解説,"); //Expl sb.Append("変数名,"); //NAME sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,"); //FOLDER sb.Append("初期値,"); //VALUE sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); int nAuto = 0; foreach (DataRow row in o_Table_Variables.DataTable.Rows) { if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NO)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_NO], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } // IDは空欄が正しいが、int型なので空欄にできないので 0 を入れる。 if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_ID)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_ID], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_EXPL)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_EXPL], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); } string sName_Var = ""; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NAME)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_NAME], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); sName_Var = sValue; } // 現在の変数の内容 string sValue_Var = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); //現在の変数の内容を検索 if (NamesVar.Test_Filepath(sName_Var)) { Expression_Node_Filepath ec_Fpath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); // 絶対パスとは限らない。フォルダーを指していることもある。 string sFpath = ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //フォルダー列値を取得。 string sNamevar_Folder_Src; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_FOLDER)) { String_HumaninputImpl.TryParse(row[NamesFld.S_FOLDER], out sNamevar_Folder_Src, "", "", log_Method, log_Reports); //フォルダーパス Expression_Node_Filepath ec_Folder = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sNamevar_Folder_Src, null, cur_Cf), false, log_Reports); if (null != ec_Folder) { // FOLDER列に入力があれば。 string sFpath_Folder = ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (sValue_Var.StartsWith(sFpath_Folder)) { // FOLDER列値をそのままキープ。 sb.Append(sNamevar_Folder_Src); // 値のフォルダー部分を削る。 sValue_Var = sValue_Var.Substring(sFpath_Folder.Length); // 先頭が ディレクトリー区切り文字なら削る。 if (sValue_Var.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { sValue_Var = sValue_Var.Substring(System.IO.Path.DirectorySeparatorChar.ToString().Length); } } else { // FOLDER列値はそのまま使えない。 } } sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { //string sValue; //String_HumaninputImpl.TryParse(row[NamesFld.S_VALUE], out sValue, "", "", log_Method, log_Reports); //sb.Append(sValue); //sb.Append(","); // 現在の変数の値(の削った残り)を入れる。 sb.Append(sValue_Var); sb.Append(","); } } else// if (NamesVar.Test_String(sName_Var)) { // FOLDER列値は無し。 sb.Append(","); if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { // 現在の変数の値を入れる。 sb.Append(sValue_Var); sb.Append(","); } } sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); nAuto++; } //ファイル書出し { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_SAVE_FORM; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } } // // メッセージボックスの表示。 { StringBuilder sb = new StringBuilder(); sb.Append(this.GetType().Name); sb.Append("#Execute6_Sub:"); sb.Append(Environment.NewLine); string sArgMessage; this.TrySelectAttribute(out sArgMessage, Expression_Node_Function46Impl.PM_MESSAGE, EnumHitcount.One_Or_Zero, log_Reports); sb.Append(sArgMessage); MessageBox.Show(sb.ToString(), "変数をCSVファイルに書き出したい。"); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── protected void Execute6_Sub( object sender, Log_Reports log_Reports ) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); // // // // // // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("関数30「新規ウィンドウを開く」を実行します。"); } string sName_Fnc; this.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sName_Fnc + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // // //()タスク・デスクリプション // // // { if (sender is Customcontrol) { Customcontrol cct = (Customcontrol)sender; string sName_Control; if (null == cct.ControlCommon.Expression_Name_Control) { sName_Control = "<エラー:名無し>"; } else { sName_Control = cct.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports ); } log_Reports.Comment_EventCreationMe = "/追記:[" + sName_Control + "]コントロールが、[" + sName_Fnc + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe = "/追記:[" + sName_Fnc + "]アクションを実行。"; } } // ┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━ // ┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━ // 開始 // ┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━ // ┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━ Configurationtree_NodeImpl cf_ThisMethod = new Configurationtree_NodeImpl("!ハードコーディング_NAction30#Execute6_Sub", null); if (log_Reports.Successful) { // 正常時 Expression_Node_String ec_ArgFormgroup; this.TrySelectAttribute(out ec_ArgFormgroup, Expression_Node_Function30Impl.PM_NAME_FORM, EnumHitcount.One_Or_Zero, log_Reports); if (null == ec_ArgFormgroup) { // // エラー goto gt_Error_NoForm; } } // // // //(3)レイアウト_テーブル読取 // // // List <Table_Humaninput> oList_Table_Form;//(フォームのセットアップに使う) // // 「フォーム名(レイアウト_ターゲット名)」を指定。 if (log_Reports.Successful) { // 正常時 // テーブル名から、レイアウト・ファイルパスの取得。 Expression_Node_String ec_ArgFormgroup; this.TrySelectAttribute(out ec_ArgFormgroup, Expression_Node_Function30Impl.PM_NAME_FORM, EnumHitcount.One_Or_Zero, log_Reports); oList_Table_Form = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByFormgroup(ec_ArgFormgroup, true, log_Reports); } else { oList_Table_Form = new List <Table_Humaninput>(); } // // // //(4)formsフォルダーパス取得 // // // Expression_Node_Filepath ec_Fopath_Forms; if (log_Reports.Successful) { // 正常時 XenonName o_Name_Variable = new XenonNameImpl(NamesVar.S_SP_FORMS, this.Cur_Configuration); // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(this, o_Name_Variable.Cur_Configuration); ec_Atom.SetString(o_Name_Variable.SValue, log_Reports); // ファイルパス。 log_Reports.Log_Callstack.Push(log_Method, "⑤"); ec_Fopath_Forms = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(ec_Atom, true, log_Reports); log_Reports.Log_Callstack.Pop(log_Method, "⑤"); } else { ec_Fopath_Forms = null; } // // // //(5)フォームをセットアップ。 // // // if (log_Reports.Successful) { // 正常時 this.Owner_MemoryApplication.MemoryForms.SetupFormAndLoadUsercontrolconfigs( oList_Table_Form, ec_Fopath_Forms, this.Owner_MemoryApplication.MemoryForms.Mainwnd_FormWrapping.Form, log_Reports ); } // // // //(6)『トゥゲザー設定ファイル』読取。 // // // if (log_Reports.Successful) { // タイプデータ値「ScriptTogethers」。 Expression_Leaf_StringImpl ec_NameVariable = new Expression_Leaf_StringImpl(this, cf_ThisMethod); ec_NameVariable.SetString(ValuesTypeData.S_CODE_TOGETHERS, log_Reports); List <MemoryCodefileinfo> listInfo = null; if (log_Reports.Successful) { listInfo = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_NameVariable, true, log_Reports); } if (log_Reports.Successful) { foreach (MemoryCodefileinfo scriptfile in listInfo) { if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryTogethers.LoadFile(scriptfile.Expression_Filepath, log_Reports); } else { break; } } } } // // // //(7)「プロジェクトが選択(切替)されたとき」 // // // if (null != this.In_Subroutine_Function30_2) { this.In_Subroutine_Function30_2.Perform( oList_Table_Form, ec_Fopath_Forms, this.Cur_Configuration, this.Owner_MemoryApplication.MemoryForms.Mainwnd_FormWrapping.Form, sender, log_Reports ); } // // // //(8)独自実装のコントロールのプロパティー編集。主に、フォームの活性化をしているだけ。 // // // if (null != this.In_Subroutine_Function30_1) { this.In_Subroutine_Function30_1.Perform(this.Owner_MemoryApplication, log_Reports); } // (X5)コントロールに、妥当性判定を設定します。 if (log_Reports.Successful) { // タイプデータ値。 Expression_Leaf_StringImpl ec_Name_Variable = new Expression_Leaf_StringImpl(this, cf_ThisMethod); ec_Name_Variable.SetString(ValuesTypeData.S_CODE_VALIDATORS, log_Reports); List <MemoryCodefileinfo> list_Info = null; if (log_Reports.Successful) { list_Info = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_Name_Variable, true, log_Reports); } if (log_Reports.Successful) { foreach (MemoryCodefileinfo moScriptfile in list_Info) { if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryValidators.LoadFile( moScriptfile.Expression_Filepath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); } else { break; } } } } // // // //(9)「レイアウトテーブル」に書かれているコントロール名だけの一覧を作成。 // // // List <string> sList_Name_Control = new List <string>(); foreach (Table_Humaninput tableH_Form in oList_Table_Form) { if (tableH_Form.DataTable.Columns.Contains(NamesFld.S_NAME)) { // 「NAME」フィールドのあるテーブルが本表。無いのは参照表。 foreach (DataRow row in tableH_Form.DataTable.Rows) { string name_Control = ((Value_Humaninput)row[NamesFld.S_NAME]).Text; sList_Name_Control.Add(name_Control.Trim()); } } } // // // //(10)指定レイアウト内の全てのコントロールの、"Se:読取時;" イベントを実行します。 // // // if (log_Reports.Successful) { Executer1_UsercontrolAndEvent exe1 = new Executer1_UsercontrolAndEventImpl(); exe1.Execute1_AllUsercontrols( sList_Name_Control, sender, new XenonNameImpl(NamesSe.S_LOAD, cf_ThisMethod), this.Owner_MemoryApplication, log_Reports ); } // // // // ロード完了 // // // goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NoForm: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cf_ThisMethod), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110015;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// 項目の文字列。 /// </summary> /// <param name="e"></param> /// <param name="cctLst"></param> /// <param name="log_Reports"></param> /// <returns></returns> public override string P1_GetItemString( int nCurIx,//DrawItemEventArgs e,//e.Index CustomcontrolListbox cctLst, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "P1_GetItemLabel", log_Reports); // // string sDisplayText; // ↓2012-01-20 追加 if (nCurIx < cctLst.List_SText_Display.Count) { sDisplayText = cctLst.List_SText_Display[nCurIx]; if (null != sDisplayText) { goto gt_EndMethod; } } // // 項目の数だけ呼び出される。 // 処理はできるだけ軽く。 if (null == this.Expression_ItemLabel) { sDisplayText = "(" + Info_MiddleImpl.Name_Library + "#P1_GetItemString:リストボックスに<a-item-label>が指定されていません)"; goto gt_EndMethod; } // // dataRowViewが入っている。 DataRowView dataRowView = (DataRowView)cctLst.Items[nCurIx]; // // // ID値を取得し、キー値とする。 int nKey; Int_HumaninputImpl.TryParse(// ※仮。 dataRowView.Row["ID"], out nKey, EnumOperationIfErrorvalue.Error, -1, log_Reports ); if (!log_Reports.Successful) { // エラー sDisplayText = "(エラー発生中)"; goto gt_EndMethod; } if (log_Reports.Successful) { string sKey = nKey.ToString(); // ※仮。 // // value-variable-name="" 属性 if (null == this.Expression_ValueVariableName) { // // エラー。 sDisplayText = "(変数名取得失敗)"; goto gt_Error_NullValueVariableName; } else { // // 変数名取得。 StringBuilder sbHint = new StringBuilder(); sbHint.Append(Info_MiddleImpl.Name_Library); sbHint.Append(":"); sbHint.Append(this.GetType().Name); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl(sbHint.ToString(), null); string sVariableName = this.Expression_ValueVariableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); XenonNameImpl o_Name_Variable = new XenonNameImpl(sVariableName, parent_Configurationtree_Node); //ystem.Console.WriteLine(this.GetType().Name + "#P1_GetItemLabel: sVariableName=[" + sVariableName + "] sValue=[" + sValue + "]"); // // ループカウンター変数に、キー値を上書き。 this.Owner_MemoryApplication.MemoryVariables.SetStringValue( o_Name_Variable, sKey, true, log_Reports ); } // // 表示文字列。 sDisplayText = this.Expression_ItemLabel.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } else { sDisplayText = "(エラー発生中)"; goto gt_EndMethod; } if (!log_Reports.Successful) { sDisplayText = "(エラー発生中)"; goto gt_EndMethod; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullValueVariableName: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー926!", log_Method); StringBuilder t = new StringBuilder(); t.Append("<view>の<f-listbox-for-items>に、"); t.Append(Environment.NewLine); t.Append("value-variable-name=””属性がありませんでした。"); t.Append(Environment.NewLine); t.Append("コントロール名=["); t.Append(cctLst.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]"); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: // ↓2012-01-20 追加 while (cctLst.List_SText_Display.Count <= nCurIx) { cctLst.List_SText_Display.Add(null); } cctLst.List_SText_Display[nCurIx] = sDisplayText; log_Method.EndMethod(log_Reports); return(sDisplayText); }
//──────────────────────────────────────── public void XTo( out KeyconfigImpl out_Keycnf, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); Log_Reports log_Reports_Load = new Log_ReportsImpl(pg_Method); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "XToO", log_Reports_Load); // // out_Keycnf = new KeyconfigImpl(); CsvTo_Table_HumaninputImpl csvTo = new CsvTo_Table_HumaninputImpl(); Request_ReadsTable oRequest_TableReads = new Request_ReadsTableImpl(); { Configurationtree_NodeImpl cf_ConfigStack = new Configurationtree_NodeImpl(Info_Operating.Name_Library + ":" + this.GetType().Name + "#<init>:", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_1", cf_ConfigStack); cf_Fpath.InitPath( "Editor-config/GAME_PAD/Key-config.csv", log_Reports ); Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); oRequest_TableReads.Expression_Filepath = ec_Fpath; if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } Format_Table_Humaninput o_TableFormat = new Format_Table_HumaninputImpl(); out_Keycnf.O_Table_Keycnf = csvTo.Read( oRequest_TableReads, o_TableFormat, true, log_Reports ); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } // // テーブルを上から1行ずつ読んでいきます。 // foreach (DataRow dataRow in out_Keycnf.O_Table_Keycnf.DataTable.Rows) { //NO ID Expl PLAYER BEFORE AFTER // プレイヤー番号 int nPlayer; { Int_HumaninputImpl o_Player = (Int_HumaninputImpl)dataRow["PLAYER"]; if (Int_HumaninputImpl.TryParse( o_Player, out nPlayer, EnumOperationIfErrorvalue.Error, 0, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } // BEFORE EnumGamepadkeyIx enumGmkeyArray; { string sBefore; string sDebug1 = ""; string sDebug2 = ""; String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["BEFORE"]; if (String_HumaninputImpl.TryParse( o_Before, out sBefore, sDebug1, sDebug2, pg_Method, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } switch (sBefore) { case "Up": enumGmkeyArray = EnumGamepadkeyIx.Up; break; case "Right": enumGmkeyArray = EnumGamepadkeyIx.Right; break; case "Down": enumGmkeyArray = EnumGamepadkeyIx.Down; break; case "Left": enumGmkeyArray = EnumGamepadkeyIx.Left; break; case "0": enumGmkeyArray = EnumGamepadkeyIx.B0; break; case "1": enumGmkeyArray = EnumGamepadkeyIx.B1; break; case "2": enumGmkeyArray = EnumGamepadkeyIx.B2; break; case "3": enumGmkeyArray = EnumGamepadkeyIx.B3; break; case "4": enumGmkeyArray = EnumGamepadkeyIx.B4; break; case "5": enumGmkeyArray = EnumGamepadkeyIx.B5; break; case "6": enumGmkeyArray = EnumGamepadkeyIx.B6; break; case "7": enumGmkeyArray = EnumGamepadkeyIx.B7; break; default: // エラー enumGmkeyArray = EnumGamepadkeyIx.B0; break; } } // AFTER EnumGamepadkeyBit gmkeyPushEnum; { string sAfter; string sDebug1 = ""; string sDebug2 = ""; String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["AFTER"]; if (String_HumaninputImpl.TryParse( o_Before, out sAfter, sDebug1, sDebug2, pg_Method, log_Reports )) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } switch (sAfter) { case "Up": gmkeyPushEnum = EnumGamepadkeyBit.Up; break; case "Right": gmkeyPushEnum = EnumGamepadkeyBit.Right; break; case "Down": gmkeyPushEnum = EnumGamepadkeyBit.Down; break; case "Left": gmkeyPushEnum = EnumGamepadkeyBit.Left; break; case "A": gmkeyPushEnum = EnumGamepadkeyBit.A; break; case "B": gmkeyPushEnum = EnumGamepadkeyBit.B; break; case "X": gmkeyPushEnum = EnumGamepadkeyBit.X; break; case "Y": gmkeyPushEnum = EnumGamepadkeyBit.Y; break; case "L": gmkeyPushEnum = EnumGamepadkeyBit.L; break; case "R": gmkeyPushEnum = EnumGamepadkeyBit.R; break; case "Select": gmkeyPushEnum = EnumGamepadkeyBit.Select; break; case "Start": gmkeyPushEnum = EnumGamepadkeyBit.Start; break; default: // エラー gmkeyPushEnum = EnumGamepadkeyBit.A; break; } } // // 記憶 // KeyconfigPadImpl keycnfPad; if (out_Keycnf.Dic_KeyCnf.ContainsKey(nPlayer)) { keycnfPad = out_Keycnf.Dic_KeyCnf[nPlayer]; } else { keycnfPad = new KeyconfigPadImpl(); } keycnfPad.KeyconfigArray[(int)enumGmkeyArray] = gmkeyPushEnum; out_Keycnf.Dic_KeyCnf[nPlayer] = keycnfPad; } goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(log_Reports_Load); log_Reports_Load.EndLogging(pg_Method); return; }
//──────────────────────────────────────── /// <summary> /// トゥゲザー名で指定しなかった場合の、 /// (1)「コントロール設定ファイル(Fcnf)」の<refresher>を読みにいく。 /// /// なければヌル。 /// </summary> /// <param name="log_Reports"></param> private void Execute3b_ByNoName_1Fcnf( out Configurationtree_Node cf_TgTogether, Configurationtree_Node cf_Fc, Configurationtree_Node cf_Event, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute3b_ByNoName_1Fcnf", log_Reports); // // // 11:トゥゲザー名の作成 // 所要時間目安[0]ミリ秒ほど // // string sEventNameTrim; string sIn; { string sFcName3; cf_Fc.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sFcName3, true, log_Reports); if (!log_Reports.Successful) { cf_TgTogether = null; goto gt_EndMethod; } // これはトゥゲザーが書いてあるコントロールの名前なので、 // 末尾に「*」は無い。 string sEventName; cf_Event.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, true, log_Reports); if (!log_Reports.Successful) { cf_TgTogether = null; goto gt_EndMethod; } sEventNameTrim = sEventName.Trim(); StringBuilder sbIn_ = new StringBuilder(); sbIn_.Append(sFcName3); sbIn_.Append("/"); sbIn_.Append(sEventNameTrim); sIn = sbIn_.ToString(); } cf_TgTogether = null; List <Configurationtree_Node> listCf_Together = cf_Fc.GetChildrenByNodename(NamesNode.S_TOGETHER, false, log_Reports); foreach (Configurationtree_Node cf_Together in listCf_Together) { string sOn2; cf_Together.Dictionary_Attribute.TryGetValue(PmNames.S_ON, out sOn2, false, log_Reports); if (sEventNameTrim == sOn2) { cf_TgTogether = new Configurationtree_NodeImpl( NamesNode.S_TOGETHER, this.Owner_MemoryApplication.MemoryTogethers.Configurationtree_Togetherconfig ); cf_TgTogether.Dictionary_Attribute.Set(PmNames.S_IN.Name_Pm, sIn, log_Reports); // // <refresher>→子<target> // // <refresher>が、target属性を持っていれば、それを子要素とする。 List <Configurationtree_Node> cfList = this.ConvertTarget2(cf_Together, log_Reports); foreach (Configurationtree_Node cf_Node in cfList) { cf_TgTogether.List_Child.Add(cf_Node, log_Reports); } // 1件のみ処理。 //break; } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); }