//──────────────────────────────────────── /// <summary> /// 子要素を追加します。 /// </summary> /// <param name="sName"></param> /// <param name="nItem"></param> /// <param name="request"></param> /// <param name="log_Reports"></param> public void Set( string sName, Expression_Node_String ec_Item, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "Set", log_Reports); if (!this.dicExpression_Item.ContainsKey(sName)) { // 新規項目なら // そのまま追加。 this.dicExpression_Item.Add(sName, ec_Item); } else { // 既存項目なら // 上書きします。 this.dicExpression_Item.Remove(sName); this.dicExpression_Item.Add(sName, ec_Item); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" 既に追加されていた項目を削除して、上書きしました。[" + sName + "]"); } } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// ユーザー定義関数を登録します。 /// </summary> /// <param name="sName"></param> /// <param name="e_Func"></param> /// <param name="log_Reports"></param> public void AddFunction(string sName, Expression_Node_Function ec_CommonFunction, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "AddFunc", log_Reports); if (log_Method.CanDebug(1)) { } // // if (this.dictionary_Item.ContainsKey(sName)) { goto gt_Error_Exists; } this.dictionary_Item.Add(sName, ec_CommonFunction); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数の追加登録 [" + sName + "]"); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Exists: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲設定エラー101!", log_Method); r.Message = "ユーザー定義関数[" + sName + "]は既に定義されていますが、さらに定義されました。同じ名前のユーザー定義関数は1つしか定義してはいけません。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 【追加 2012-07-05】 /// </summary> /// <param name="s_Cur"></param> /// <param name="e_Cur"></param> /// <param name="bRequired_NameAttr"></param> /// <param name="bRequired_ValueAttrIsChild"></param> /// <param name="log_Reports"></param> public static void ParseAttr_InAnotherLibrary( Configurationtree_Node cur_Cf, Expression_Node_String cur_Ec, bool bRequired_NameAttr,//name属性が必須な場合、真。 bool bRequired_ValueAttrIsChild,//value属性を、子<f-str>にする場合、真。 Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, "SToE_F14n16_AbstractImpl_", "ParseAttr_InAnotherLibrary",log_Reports); if (log_Method.CanDebug(1)) { //d_ParsingLog.Increment("(5.FElem汎用)"+s_Cur.Name_Node); } ConfigurationtreeToExpression_F14_FncImpl_ dammy = new ConfigurationtreeToExpression_F14_FncImpl_();//メソッドが使いたいだけなので、何でもいい。 dammy.ParseAttr_InConfigurationtreeToExpression( cur_Cf, cur_Ec, bRequired_NameAttr, bRequired_ValueAttrIsChild, log_Reports ); goto gt_EndMethod; // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { //d_ParsingLog.Decrement(s_Cur.Name_Node); } 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); 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> public void Clear(MemoryApplication owner_MemoryApplication) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(log_Method); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "Clear",log_Reports_ThisMethod); // this.owner_MemoryApplication = owner_MemoryApplication; if (null == this.DictionaryExpression_Item) { this.dictionaryExpression_Item = new Dictionary<string, Expression_Node_String>(); } else { if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("次の変数を消します。"); log_Method.WriteDebug_ToConsole("────────────────────"); foreach (KeyValuePair<string, Expression_Node_String> kvp in this.DictionaryExpression_Item) { log_Method.WriteDebug_ToConsole(" " + kvp.Key + "=" + kvp.Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports_ThisMethod)); } log_Method.WriteDebug_ToConsole("────────────────────"); } this.DictionaryExpression_Item.Clear(); } this.parent_Variablesconfig_Configurationtree = null; goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports_ThisMethod); log_Reports_ThisMethod.EndLogging(log_Method); }
//──────────────────────────────────────── /// <summary> /// /// </summary> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports); string sFncName; this.TrySelectAttribute(out sFncName, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); // デバッグ if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName + "]実行"; log_Method.Log_Stopwatch.Begin(); } // タスク・デスクリプション if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender; string sName_Usercontrol = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports ); log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + sFncName + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName + "]アクションを実行。"; } if (this.EnumEventhandler == EnumEventhandler.O_Lr) { // // // // Expression_Node_String e_ArgFilePath; this.TrySelectAttribute(out e_ArgFilePath, Expression_Node_Function17Impl_OLD.PM_FILEPATH, EnumHitcount.One_Or_Zero, log_Reports); // ファイルパス if (null == e_ArgFilePath) { if (log_Reports.Successful) { // 正常時 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("①[" + Expression_Node_Function17Impl_OLD.PM_FILEPATH + "]はヌルだった。"); } throw new Exception("バリデーション設定ファイルのファイルパスを1つ1つ当たるプログラムが未実装です。"); //// 変数名。 //Expression_Node_String e_Atom; //this.TrySelectAttribute(out e_Atom, Ec_Sf17Impl_OLD.S_PM_NAME_VAR_FILEPATH, false, EnumHitcount.Unconstraint, log_Reports); //// ファイルパス。 //log_Reports.Log_Callstack.Push(log_Method, "④"); //Expression_Node_Filepath efp = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(e_Atom, true, log_Reports); //log_Reports.Log_Callstack.Pop(log_Method, "④"); //e_ArgFilePath = efp; //this.SetAttribute(Ec_Sf17Impl_OLD.S_PM_FILEPATH, efp, log_Reports); } else { } } else { if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "②"); } } //絶対ファイルパス string sFpatha_vcnf; if (log_Reports.Successful) { // 正常時 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "③"); } sFpatha_vcnf = e_ArgFilePath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } else { if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "④"); } sFpatha_vcnf = ""; } // 『バリデーション設定ファイル』を読み込みます。 if (log_Reports.Successful) { // 正常時 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "⑤sFpatha_vcnf=[" + sFpatha_vcnf + "]"); } this.Owner_MemoryApplication.MemoryValidators.LoadFile(sFpatha_vcnf, log_Reports);//ここでバグる。 } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return ""; }
//──────────────────────────────────────── public void Translate( Configurationtree_Node cur_Conf, Expressionv_4ADisplayImpl parent_Exprv, MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(37)" + cur_Conf.Name); } // // // // // // 自 // // // Expressionv_5FAllFieldsIsEmptyImpl cur_Exprv = new Expressionv_5FAllFieldsIsEmptyImpl(parent_Exprv, cur_Conf, memoryApplication); // // // // 子 // // // { this.ParseChild_InConfigurationtreeToExpression( cur_Conf, cur_Exprv, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // 親へ連結 // // // parent_Exprv.List_Expression_Child.Add( cur_Exprv, log_Reports ); // #デバッグ中 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ★★ <f-all-fields-is-empty> 子要素数=[" + cur_Exprv.List_Expression_Child.Count + "] 属性数=[" + cur_Exprv.Dictionary_Expression_Attribute.Count + "]"); } goto gt_EndMethod; // // // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Conf.Name); } 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> /// (8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M /// </summary> /// <param name="st_PrevProject_OrNull"></param> /// <param name="log_Reports"></param> private void On_P08_SpToVar_( out MemoryAaeditorxml_Editor out_moAaeditorxml_Editor, Expression_Node_Filepath ec_Fpath_AaEditorXml, Expression_Node_Filepath ec_Fopath_Editor, MemoryAatoolxml_Editor moAatoolxml_SelectedEditor, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "On_P08_SpToVar_",log_Reports); // // // //(13c)『Aa_Editor.xml』ロード // // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(13c)『Aa_Editor.xml』ロード"); } MemoryAaeditorxml moAaeditorxml = new MemoryAaeditorxmlImpl(this.Owner_MemoryApplication); //moAaeditorxml.Clear1(log_Reports); if (log_Reports.Successful) { moAaeditorxml.Load_AutoSystemVariable( ec_Fopath_Editor, log_Reports ); } // out_moAaeditorxml_Editor = new MemoryAaeditorxml_EditorImpl(ec_Fpath_AaEditorXml.Cur_Configuration); if (log_Reports.Successful) { out_moAaeditorxml_Editor.LoadFile_Aaxml( ec_Fpath_AaEditorXml, this.Owner_MemoryApplication.MemoryVariables, log_Reports ); } if (log_Reports.Successful) { moAaeditorxml.LoadFile( ec_Fopath_Editor, log_Reports ); } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// <arg1> /// </summary> /// <param name="oFStrNode"></param> /// <param name="nFAelem"></param> /// <param name="moOpyopyo"></param> /// <param name="log_Reports"></param> public override void Translate( Configurationtree_Node cur_Cf,//「S■arg1」 Expression_Node_String parent_Ec,//親「E■fnc」 MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); // // デバッグオープンの前に。 // // 「S■arg1 name=”★”」属性 // string sName_MyFnc; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_MyFnc, false, log_Reports); if (log_Method.CanDebug(1)) { Dictionary<string, string> s_Dic = new Dictionary<string, string>(); s_Dic.Add(PmNames.S_NAME.Name_Pm, sName_MyFnc); pg_ParsingLog.Increment("(6.arg1・3要素)" + cur_Cf.Name, s_Dic); } // // if (log_Method.CanDebug(2)) { log_Method.WriteDebug_ToConsole("「S■arg1・3」要素 解析開始┌────────────────┐ 自arg1・3は、e_Parent=[" + parent_Ec.Cur_Configuration.Name + "]の”" + sName_MyFnc + "”属性になる。"); } string parent_SName_Fnc; { // ヒット必須にするとエラーになる? parent_Ec.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } //if (0 < d_InMethod.NDebugLevel) //{ // if (NamesNode.S_FNC != e_Parent.Cur_Configurationtree.Name) // { // d_InMethod.WriteDebug_ToConsole(1, "fnc以外の親要素「E■[" + e_Parent.Cur_Configurationtree.Name + "]」"); // } //} } // // // // 自 // // // Expression_Node_String cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf); // // // // 属性 // // // if (log_Reports.Successful) { // 元からあった。 this.ParseAttr_InConfigurationtreeToExpression( cur_Cf, cur_Ec, true,//name属性は必須。 true,//value属性は、子<f-str>にする。 log_Reports ); } // // // // 子 // // // if (log_Reports.Successful) { this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // 親へ連結 ※属性連結。 // // // if (log_Reports.Successful) { parent_Ec.SetAttribute(sName_MyFnc, cur_Ec, log_Reports); } goto gt_EndMethod; // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } if (log_Method.CanDebug(2)) { log_Method.WriteDebug_ToConsole( "「S■arg1・3」要素 解析終了└────────────────┘"); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void Translate( Configurationtree_Node cur_Cf,//<a-empty-field> Expression_Node_String parent_Expr,//Expressionv_5FAllTrueImpl MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(39)" + cur_Cf.Name); } // // // // // // // // 自 // // // Expressionv_6AEmptyFieldImpl ecv_AEmptyFld = new Expressionv_6AEmptyFieldImpl(parent_Expr, cur_Cf, memoryApplication); // // // // 属性 // // // { { PmName pmName = PmNames.S_TYPE; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { Expression_Leaf_String ec_Leaf = new Expression_Leaf_StringImpl(sValue, parent_Expr, cur_Cf); ecv_AEmptyFld.SetAttribute(pmName.Name_Pm, ec_Leaf, log_Reports); //evAEmptyFld.Dictionary_SAttribute.Add(sAttrName, s_Cur.SAttrDic.Get(sAttrName, true, log_Reports)); } else { // クリアー上書きしない。 } } { PmName pmName = PmNames.S_DESCRIPTION; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { Expression_Leaf_String ec_Leaf = new Expression_Leaf_StringImpl(sValue, parent_Expr, cur_Cf); ecv_AEmptyFld.SetAttribute(pmName.Name_Pm, ec_Leaf, log_Reports); } else { // クリアー上書きしない。 } } } // // // // 親へ連結 // // // { // TODO:? parent_Expr.List_Expression_Child.Add(ecv_AEmptyFld, log_Reports); } // // // // 子 // // // { // <f-cell>要素のリスト this.ParseChild_InConfigurationtreeToExpression( cur_Cf, ecv_AEmptyFld, memoryApplication, pg_ParsingLog, log_Reports ); } goto gt_EndMethod; // // // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public override void Translate( Configurationtree_Node cur_Cf, Expression_Node_String parent_Ec, MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { // throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#SToE: このメソッドは廃止方針です。"); Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(18)" + cur_Cf.Name); } // // // // // // // // 自 // // // Expression_Node_String ec_Value; { ec_Value = new Expression_Node_StringImpl(parent_Ec, cur_Cf); ec_Value.AppendTextNode( cur_Cf.Name, cur_Cf, log_Reports ); } // // // // 自 // // // Expression_Node_StringImpl ec_Ap1p = new Expression_Node_StringImpl(parent_Ec, cur_Cf); ec_Ap1p.SetAttribute( PmNames.S_NAME.Name_Pm, ec_Value, log_Reports ); StringBuilder sb = new StringBuilder(); sb.Append("p"); sb.Append(this.NP1p); sb.Append("p"); // // // // 属性 // // // parent_Ec.SetAttribute( sb.ToString(), ((Expression_Node_String)ec_Ap1p), log_Reports ); // // 子要素 // this.ParseChild_InConfigurationtreeToExpression( cur_Cf, ec_Ap1p, memoryApplication, pg_ParsingLog, log_Reports ); goto gt_EndMethod; // // // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── protected override void Parse_SAttribute( XmlElement cur_X, Configurationtree_Node cur_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "Parse_SAttr",log_Reports); // // // // name属性は必須。 // string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute); if ("" == sName_Fnc) { goto gt_Error_UndefinedFncNameAttr; } XmlAttribute err_XAttr = null; if (NamesFnc.S_CELL == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ② // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } } else if (NamesFnc.S_SWITCH == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ③ // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } } else if (NamesFnc.S_CASE == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ④ // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } } else if (NamesFnc.S_VALUE_CONTROL == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ⑤ // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } // value属性の指定がなければ、このコントロールの名前を入れておく。 if (!cur_Cf.Dictionary_Attribute.ContainsKey(PmNames.S_VALUE.Name_Pm)) { Configurationtree_Node owner_Configurationtree_Control; if (!(cur_Cf.Parent is Configurationtree_Node)) { //todo:エラーか? owner_Configurationtree_Control = null; goto gt_Error_UndefinedClass; } else { Configurationtree_Node parent_Cf = (Configurationtree_Node)cur_Cf.Parent; if (NamesNode.S_CONTROL1 == parent_Cf.Name) { owner_Configurationtree_Control = parent_Cf; } else { Configuration_Node parent2 = parent_Cf.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); if (log_Reports.Successful) { owner_Configurationtree_Control = (Configurationtree_Node)parent2; } else { owner_Configurationtree_Control = null; } } } if (null != owner_Configurationtree_Control) { if (owner_Configurationtree_Control.Dictionary_Attribute.ContainsKey(PmNames.S_NAME.Name_Pm)) { string sFcName; owner_Configurationtree_Control.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sFcName, true, log_Reports); cur_Cf.Dictionary_Attribute.Add(PmNames.S_VALUE.Name_Pm, sFcName, cur_Cf, true, log_Reports); } } } } else if (NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { string xName_AttrTrim = xAttr.Name.Trim(); if ( PmNames.S_REQUIRED.Name_Attribute == xAttr.Name // 特にS→Eにパースは無い || PmNames.S_FROM.Name_Attribute == xAttr.Name // Xn_L07_SToE:SToE_F_5FElem/Xn_L07_SToE:SToE_F_A6FromImpl || PmNames.S_STORAGE.Name_Attribute == xAttr.Name // 特にS→Eにパースは無い || PmNames.S_FIELD.Name_Attribute == xAttr.Name // 特にS→Eにパースは無い ) { // // 属性=”” cur_Cf.Dictionary_Attribute.Add(xAttr.Name, xAttr.Value, cur_Cf, true, log_Reports); } else { // // エラー。 err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } }//foreach } else { foreach (XmlNode xAttr in cur_X.Attributes) { // とりあえず、どんな属性名でも受け入れる。 if(log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "<fnc name=”[" + sName_Fnc + "]”>の属性 " + xAttr.Name + "=”" + xAttr.Value + "”"); } // // value="" // // ⑥ PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { cur_Cf.Dictionary_Attribute.Add(xAttr.Name, xAttr.Value, cur_Cf, true, log_Reports); } // // 子<arg1>は、ここでは処理しない。 // } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedAttr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー336!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("["); s.Append(cur_X.Name); s.Append("]要素を探索中に、未対応の属性が記述されていました。"); s.Newline(); s.Append("xAttr.Name=["); s.Append(err_XAttr.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedFncNameAttr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー413!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<fnc>要素に、name属性が指定されていませんでした。"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedClass: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー341!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("何らかのエラー。"); s.Newline(); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── 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; }
//──────────────────────────────────────── /// <summary> /// 親要素に、この要素を追加。 /// </summary> protected override void LinkToParent( Configurationtree_Node cur_Cf, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "LinkToParent",log_Reports); // // name属性は必須。 // string sName_Fnc; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; //goto gt_Error_UndefinedFncNameAttr; } string parent_SName_Fnc; { // // ※注意 <data >も、<fnc >扱い。name属性を持っていない。 // bool bRequired = false; parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out parent_SName_Fnc, bRequired, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; //goto gt_Error_UndefinedFncNameAttr; } } if (NamesFnc.S_WHERE == sName_Fnc) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); // デバッグ出力 if (log_Method.CanDebug(1)) { Log_TextIndented s = new Log_TextIndentedImpl(); parent_Cf.ToText_Locationbreadcrumbs(s); //log_Method.WriteDebug_ToConsole( "<fnc name=”[" + sFncName + "]”>要素 親要素「S■[" + s_Parent.Name_Node + "]」の子リストに、自分を追加。 子要素の数は[" + s_Cur.CountChildNodes + "]でした。"); log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>要素 親要素「S■[" + parent_Cf.Name + "]」の『属性[" + cur_Cf.Name + "]』に、自分「S■[" + cur_Cf.Name + "]」を追加。 子要素の数は[" + cur_Cf.List_Child.Count + "]でした。 Place=[" + s.ToString() + "]"); } } else if (NamesFnc.S_CASE == sName_Fnc) { // // 親要素は Sf:switch; である必要があります。 // if (NamesFnc.S_SWITCH != parent_SName_Fnc) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー308!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("Sf:case;系要素の親は f-switch を期待します。"); s.Newline(); s.Newline(); s.Append("親ノード名=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } // 要素の(OAelemListではなく)OAcaseListに、この Sf:case; 要素を追加。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_ITEM_LABEL2 == sName_Fnc ) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_ITEM_VALUE == sName_Fnc ) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_ITEM_GRAY_OUT == sName_Fnc ) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc ) { // // 暫定で、親要素は<f-all-true>である必要があります。 // if (NamesFnc.S_ALL_TRUE != parent_SName_Fnc) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー404!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<a-empty-field>系要素の親は <f-all-true> であることを期待します。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } if (!(NamesFnc.S_ALL_TRUE == parent_SName_Fnc)) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー403!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("内部プログラムのミス。"); s.Newline(); s.Append("<a-empty-field>系要素の親が、OFAllTrueImplクラスでありませんでした。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); s.Append("oFnode.GetType().Name=["); s.Append(parent_Cf.GetType().Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } // 親要素の(OAelemListではなく)OArecordSetSaveToListに、この<fnc name=”Sf:a-record-set-save-to;”>要素を追加。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_EMPTY_FIELD == sName_Fnc ) { // // 親要素は<f-all-true>である必要があります。 // if (NamesFnc.S_ALL_TRUE != parent_SName_Fnc) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー405!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<a-empty-field>系要素の親は <f-all-true> であることを期待します。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } if (!(NamesFnc.S_ALL_TRUE == parent_SName_Fnc)) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー406!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("内部プログラムのミス。"); s.Newline(); s.Append("<a-empty-field>系要素の親が、OFAllTrueImplクラスでありませんでした。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); s.Append("oFnode.GetType().Name=["); s.Append(parent_Cf.GetType().Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } // // <f-all-true> // // 親要素の(OAelemListではなく)OAemptyFldListに、この<a-empty-field>要素を追加。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else { // 親要素「S■??」に、この「S■fnc」要素を追加。 // 同名要素が複数個並ぶので、属性ではなく子要素として追加する。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>要素 親要素「S■[" + parent_Cf.Name + "]」の子リストに、自分を追加。 子要素の数は[" + cur_Cf.List_Child.Count + "]でした。"); } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void ParseChild_InConfigurationtreeToExpression( Configurationtree_Node cur_Conf,//S_NodeList s_curNodeList, Expression_Node_String parent_Expr,//nAcase,nFelemの両方の場合がある。 MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "ParseChild_InSToE",log_Reports); // // if (null == parent_Expr) { goto gt_Error_NullNFAelem; } // // 親ノード名、親ファンク名 // string parent_SName_Node = parent_Expr.Cur_Configuration.Name; string parent_SName_Fnc = ""; { EnumHitcount enumHitcount; if (NamesNode.S_FNC == parent_SName_Node) { //todo: enumHitcount = EnumHitcount.One; enumHitcount = EnumHitcount.One_Or_Zero; } else { enumHitcount = EnumHitcount.One_Or_Zero; } log_Reports.Log_Callstack.Push(log_Method, "①"); bool bHit = parent_Expr.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, enumHitcount, log_Reports); log_Reports.Log_Callstack.Pop(log_Method, "①"); } if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "開始┌──┐ s_Curノード名=[" + cur_Conf.Name + "] 子要素数=[" + cur_Conf.List_Child.Count + "]"); } // // // // 子 // // // Configurationtree_Node err_Configurationtree_Node2 = null; cur_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak) { if (!log_Reports.Successful) { // 強制終了。 bBreak = true; return; } string sName_MyNode = s_Child.Name; string sName_MyFnc = ""; { bool bRequired; if (NamesNode.S_ARG == sName_MyNode) { bRequired = true; } else { bRequired = false; } log_Reports.Log_Callstack.Push(log_Method, "②"); s_Child.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_MyFnc, bRequired, log_Reports); log_Reports.Log_Callstack.Pop(log_Method, "②"); } if (this.Dictionary_ConfigurationtreeToExpression.ContainsKey(sName_MyNode)) { if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "親「S■[" + parent_SName_Fnc + "] name=”[" + parent_SName_Fnc + "]”」 自「S■[" + sName_MyNode + "] name=”[" + sName_MyFnc + "]”」"); } this.Dictionary_ConfigurationtreeToExpression[sName_MyNode].Translate( s_Child, parent_Expr, memoryApplication, pg_ParsingLog, log_Reports ); } else { // // それ以外、エラー。 // err_Configurationtree_Node2 = s_Child; bBreak = true; } }); // if (null != err_Configurationtree_Node2) { goto gt_Error_UndefinedElement; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullNFAelem: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Expr.Cur_Configuration), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7010;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedElement: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_Configurationtree_Node2.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, err_Configurationtree_Node2.GetType().Name, log_Reports);//設定ノードのクラス名 tmpl.SetParameter(3, this.Dictionary_ConfigurationtreeToExpression.Count.ToString(), log_Reports);//キーの個数 StringBuilder s1 = new StringBuilder(); foreach (string sKey in this.Dictionary_ConfigurationtreeToExpression.Keys) { s1.Append(sKey); s1.Append(System.Environment.NewLine); } tmpl.SetParameter(4, s1.ToString(), log_Reports);//キーのリスト //設定親ノード名 if (null != parent_Expr) { tmpl.SetParameter(5, parent_Expr.Cur_Configuration.Name, log_Reports); } else { tmpl.SetParameter(5, "ヌル", log_Reports); } tmpl.SetParameter(6, Log_RecordReportsImpl.ToText_Configuration(err_Configurationtree_Node2), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7011;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { //d_ParsingLog.Decrement(s_Cur.Name_Node); } log_Method.EndMethod(log_Reports); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "終了└──┘"); } }
//──────────────────────────────────────── public override void XmlToConfigurationtree( XmlElement cur_X,//<arg1> Configurationtree_Node parent_Cf,//<fnc> MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports); // // // // // // 自 // // // Configurationtree_Node cur_Cf = this.CreateMyself(cur_X, parent_Cf, memoryApplication, log_Reports); // // // // 属性 // // // //string sFncName; //s_Parent.Dictionary_Attribute.TryGetValue(PmNames.NAME.Name_Attr, out sFncName, false, log_Reports); if (NamesNode.S_VALIDATOR == parent_Cf.Name) { // // <validator>の子<arg> // // // name=”” { XmlNode xNode = cur_X.Attributes.GetNamedItem(PmNames.S_NAME.Name_Attribute); if (null != xNode) { string sName = xNode.Value; cur_Cf.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sName, log_Reports); } } // // value=”” string sValue; { XmlNode xNode = cur_X.Attributes.GetNamedItem(PmNames.S_VALUE.Name_Attribute); if (null != xNode) { sValue = xNode.Value; cur_Cf.Dictionary_Attribute.Add(PmNames.S_VALUE.Name_Pm, sValue, cur_Cf, true, log_Reports); } else { sValue = ""; } } { string sName; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName, false, log_Reports); //O_Name o_Name = new O_NameImpl(sName, s_Cur); parent_Cf.Dictionary_Attribute.Add( sName, sValue, parent_Cf, false, log_Reports); } } else { this.Parse_SAttribute(cur_X, cur_Cf, memoryApplication, log_Reports); } // // // // 子 // // // this.Parse_ChildNodes(cur_X, cur_Cf, memoryApplication, log_Reports); // // // // 親へ連結 // // // string err_Parent_SName; string parent_SName_Fnc; string parent_SAmemory; if(!log_Reports.Successful) { // エラー goto gt_EndMethod; } else if ( // 親<data > NamesNode.S_DATA == parent_Cf.Name ) { bool bHit = parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out parent_SName_Fnc, false, log_Reports); bool bHit3 = parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_MEMORY, out parent_SAmemory, true, log_Reports); if ( ValuesAttr.S_RECORDS == parent_SAmemory || ValuesAttr.S_VARIABLE == parent_SAmemory ) { // // 親 <data memory=”records”> // 親 <data memory=”variable”> // // // 属性としては追加する。 // string sName_Fnc; bool bHit2 = cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, false, log_Reports); if (bHit2) { string sValue_Arg; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue_Arg, false, log_Reports); // 「S■data-source」の(<arg5 name属性>としてtarget値を追加。 // 属性とする。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( "<データ target=[" + parent_SAmemory + "]>に属性追加 [" + sName_Fnc + "]←[" + sValue_Arg + "]"); } parent_Cf.Dictionary_Attribute.Add(sName_Fnc, sValue_Arg, parent_Cf, true, log_Reports); } } else { // エラー err_Parent_SName = parent_Cf.Name; goto gt_Error_Target; } } else { // 親が<data>以外。 bool bHit = parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out parent_SName_Fnc, true, log_Reports);//name属性が無い親もある?? if (!log_Reports.Successful) { log_Method.WriteWarning_ToConsole("s_Parent.Name_Node=[" + parent_Cf.Name + "]"); } else { } if ( NamesNode.S_FNC != parent_Cf.Name && NamesNode.S_VALIDATOR != parent_Cf.Name && NamesNode.S_COMMON_FUNCTION != parent_Cf.Name && NamesFnc.S_SWITCH != parent_SName_Fnc //旧仕様に対応 ) { // 親要素が<fnc>でも<validator><common-function><f-switch>でもない。 // エラー err_Parent_SName = parent_Cf.Name; goto gt_Error_Parent; } else if ( // 親が<fnc name=”Sf:where;”> NamesNode.S_FNC == parent_Cf.Name && NamesFnc.S_WHERE == parent_SName_Fnc) { // この子arg1要素は、 // 親要素「S■f-cell」には追加しません。 // 【追加 2012-06-02】 // 現状では、「S■a-where」に子「S■arg1」要素が含まれていると、 // 「E■f-cell」にarg1要素を追加してしまうので都合が悪い。 // // 属性としては追加する。 // string sArgAname; bool bHit2 = cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sArgAname, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } string sValue; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, false, log_Reports); // 「S■fnc」のlogic属性として追加。 // 属性連結 parent_Cf.Dictionary_Attribute.Add(sArgAname, sValue, parent_Cf, true, log_Reports); } else { // 属性にせず、子まま連結。 // 子連結 parent_Cf.List_Child.Add(cur_Cf, log_Reports); } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Parent: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー361!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append("<"); t.Append(cur_X.Name); t.Append(">要素の親は、<fnc>でなければなりませんでしたが、別の要素<"); t.Append(err_Parent_SName); t.Append(">でした。"); t.Newline(); t.Newline(); // ヒント t.Append(r.Message_Configuration(parent_Cf)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Target: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー562!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<"); s.Append(cur_X.Name); s.Append(">要素のtarget属性が予想外でした。<["); s.Append(err_Parent_SName); s.Append("] target=”["); s.Append(parent_SAmemory); s.Append("]”>"); 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); }
//──────────────────────────────────────── public override void Translate( Configurationtree_Node cur_Cf,//<lookup-id> Expression_Node_String parent_Ec,//< Sf:text-template;> MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(9)" + cur_Cf.Name); } // // // // // // 自 // // // Expression_Node_String cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf); // // // // 親へ連結 (value属性) // // // { // // 自要素の value="" 属性を、親へ連結 // PmName pmName = PmNames.S_VALUE; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { cur_Ec.AppendTextNode( sValue, cur_Cf, log_Reports ); // // // // 子 // // // this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec,//自 memoryApplication, pg_ParsingLog, log_Reports ); // // // // 親へ連結 ※属性連結 // // // parent_Ec.SetAttribute(PmNames.S_LOOKUP_ID.Name_Pm, cur_Ec, log_Reports); goto gt_EndMethod; } else { } } // // // // 子 // // // { //<a-default>の子要素を確認し、親<f-switch>のdefault属性に追加します。 this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // 親へ連結 // // // parent_Ec.SetAttribute(PmNames.S_LOOKUP_ID.Name_Pm, cur_Ec, log_Reports); // // // // 親へ連結 debug // // // if (log_Method.CanDebug(1)) { string parent_SName_Fnc; parent_Ec.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); log_Method.WriteDebug_ToConsole(" ☆☆☆☆☆☆☆☆ 親<[" + parent_Ec.Cur_Configuration.Name + "] name=”[" + parent_SName_Fnc + "]” >"); string sName_MyFnc; cur_Ec.TrySelectAttribute(out sName_MyFnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); log_Method.WriteDebug_ToConsole(" ☆☆☆☆☆☆☆☆ 自<[" + cur_Ec.Cur_Configuration.Name + "] name=”[" + sName_MyFnc + "]” >"); } goto gt_EndMethod; // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 値を算出します。 /// </summary> /// <returns></returns> 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_Expr.Name_Library, this, "Execute5_Main", log_Reports); // // StringBuilder sb_Result = new StringBuilder(); // // // // 子 // // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ┌────┐ 子要素数=[" + this.List_Expression_Child.Count + "]"); } List<Expression_Node_String> ecList_Child = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports); foreach (Expression_Node_String ec_Child in ecList_Child) { // // 子ノード名、子ファンク名 // string sChildNodeName = ec_Child.Cur_Configuration.Name; string sChildFncName = ""; { EnumHitcount hits; if ( NamesNode.S_ARG == sChildNodeName || NamesNode.S_FNC == sChildNodeName ) { // <arg >の場合。 // <fnc >の場合。 hits = EnumHitcount.One; } else { hits = EnumHitcount.One_Or_Zero; } bool bHit = ec_Child.TrySelectAttribute(out sChildFncName, PmNames.S_NAME.Name_Pm, hits, log_Reports); } // // if ( // 子「S■arg name=”case”」 NamesNode.S_ARG == sChildNodeName && PmNames.S_VALUE_CASE.Name_Pm == sChildFncName) { // Sf:case;要素の子<arg>は無視します。 } else { string sValue = ec_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ・子[" + sChildNodeName + "] name=”[" + sChildFncName + "]” 属性数=[" + ec_Child.Dictionary_Expression_Attribute.Count + "] 値=”[" + sValue + "]”"); } sb_Result.Append(sValue); } } if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( " └────┘"); } // // // // log_Method.EndMethod(log_Reports); return sb_Result.ToString(); }
//──────────────────────────────────────── /// <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 ""; }
//──────────────────────────────────────── public override void Translate( Configurationtree_Node cur_Cf,//「S■fnc name=”Sf:f-list-box-labels;”」 Expression_Node_String parent_Expr,//「E■view」 MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE", log_Reports); if (log_Method.CanDebug(1)) { } // // // // 自 // // // Expression_Node_String cur_Expr = new Expression_Node_StringImpl(parent_Expr, cur_Cf); // // // // 属性 // // // this.ParseAttr_InConfigurationtreeToExpression( cur_Cf, cur_Expr, true, true, log_Reports ); // // // // 子 // // // cur_Cf.List_Child.ForEach(delegate( Configurationtree_Node child_Cf, ref bool bBreak2) { string sName_Fnc; child_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, false, log_Reports); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole( " 子解析。 <~ name=”[" + sName_Fnc + "]”>"); } // todo: Sf:item-value; if(NamesFnc.S_ITEM_VALUE == sName_Fnc) { // // 自 // Expression_Node_String child_Expr = new Expression_Node_StringImpl(cur_Expr, child_Cf); // // 属性 // this.ParseAttr_InConfigurationtreeToExpression( child_Cf, child_Expr, true, true, log_Reports ); // // 子 // this.ParseChild_InConfigurationtreeToExpression( child_Cf, child_Expr, memoryApplication, pg_ParsingLog, log_Reports ); // // 親 // cur_Expr.List_Expression_Child.Add(child_Expr, log_Reports); } else if (NamesFnc.S_ITEM_LABEL2 == sName_Fnc) { // // 自 // Expression_Node_String child_Expr = new Expression_Node_StringImpl(cur_Expr, child_Cf); // // 属性 // this.ParseAttr_InConfigurationtreeToExpression( child_Cf, child_Expr, true, true, log_Reports ); // // 子 // this.ParseChild_InConfigurationtreeToExpression( child_Cf, child_Expr, memoryApplication, pg_ParsingLog, log_Reports ); // // 親 // cur_Expr.List_Expression_Child.Add(child_Expr, log_Reports); } else if (NamesFnc.S_ITEM_GRAY_OUT == sName_Fnc) { // // 自 // Expression_Node_String child_Expr = new Expression_Node_StringImpl(cur_Expr, child_Cf); // // 属性 // this.ParseAttr_InConfigurationtreeToExpression( child_Cf, child_Expr, true, true, log_Reports ); // // 子 // this.ParseChild_InConfigurationtreeToExpression( child_Cf, child_Expr, memoryApplication, pg_ParsingLog, log_Reports ); // // 親 // cur_Expr.List_Expression_Child.Add(child_Expr, log_Reports); } else { { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, child_Cf.Name, log_Reports);//子設定ノード名 memoryApplication.CreateErrorReport("Er:7019;", tmpl, log_Reports); } bBreak2 = true; goto gt_gt_EndMethod2; } goto gt_gt_EndMethod2; // // // // gt_gt_EndMethod2: ; }); // // // // 親へ連結 // // // parent_Expr.List_Expression_Child.Add(cur_Expr, log_Reports); // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// S → E。 /// </summary> public void Translate( MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(41)バリデーションファイル"); } // // // // if (log_Reports.Successful) { // // コントロール順 memoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol uct, ref bool bRemove, ref bool bBreak) { if (uct is UsercontrolListbox) { // // リストボックスなら。 UsercontrolListbox uctLst = (UsercontrolListbox)uct; List<Configurationtree_Node> cfList_ValidatorConfig = uctLst.ControlCommon.Configurationtree_Control.GetChildrenByNodename(NamesNode.S_CODEFILE_VALIDATORS, false, log_Reports); if (1 < cfList_ValidatorConfig.Count) { throw new Exception("バリデーター設定要素が2つ以上ありました。"); } else if (0 < cfList_ValidatorConfig.Count) { Configurationtree_Node cf_ValidatorConfig = cfList_ValidatorConfig[0]; // (Sv)コントロールのSv { ConfigurationtreeToExpression_V52_FListboxValidationImpl_ to = new ConfigurationtreeToExpression_V52_FListboxValidationImpl_(); List<Configurationtree_Node> cfList_Validation = cf_ValidatorConfig.GetChildrenByNodename(NamesNode.S_F_LISTBOX_VALIDATION, false, log_Reports); foreach (Configurationtree_Node child_Cf in cfList_Validation) { // // <f-list-box-validation> to.Translate( child_Cf, uctLst, memoryApplication, pg_ParsingLog, log_Reports ); }//foreach } { ConfigurationtreeToUsercontrol_V52_ValidatorImpl_ to = new ConfigurationtreeToUsercontrol_V52_ValidatorImpl_(); List<Configurationtree_Node> cfList_Validator = cf_ValidatorConfig.GetChildrenByNodename(NamesNode.S_VALIDATOR, false, log_Reports); foreach (Configurationtree_Node cf in cfList_Validator) { to.ConfigurationtreeToUsercontrol( cf, uct, pg_ParsingLog, log_Reports ); } } }//Ov } else { } }); } goto gt_EndMethod; // // // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement("(41)バリデーションファイル"); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// <data>要素の読取。 /// </summary> /// <param select="xDataSource"></param> /// <param select="fcUc"></param> public void Translate( Configurationtree_Node cur_Cf,//<data>要素 Expression_Node_String parent_Ec,//「S■form-component」 MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "CfToEc",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(2)" + cur_Cf.Name); } // // // // // // // // 自 // // // Expression_NodeImpl cur_Ec = new Expression_NodeImpl(parent_Ec, cur_Cf, memoryApplication); // // // // 属性 // // // string err_SAttrName; cur_Cf.Dictionary_Attribute.ForEach(delegate(string sPmName, string sValue, ref bool bBreak) { if ( PmNames.S_MEMORY.Name_Pm == sPmName || PmNames.S_ACCESS.Name_Pm == sPmName || PmNames.S_NAME_TABLE.Name_Pm == sPmName || PmNames.S_NAME_VAR.Name_Pm == sPmName || //.Z_ITEM_VALUE_TO_VARIABLE PmNames.S_DESCRIPTION.Name_Pm == sPmName ) { //ystem.Console.WriteLine(Info_SToE.LibraryName + ":" + this.GetType().Name + "#SToE: <データT >に属性追加 [" + sKey + "]←[" + sValue + "]"); // なんでも属性として追加。 Expression_Node_String ec_Value = new Expression_Leaf_StringImpl(sValue, cur_Ec, cur_Cf); cur_Ec.SetAttribute(sPmName, ec_Value, log_Reports); } else { err_SAttrName = sPmName; bBreak = true; goto gt_Error_UndefinedAttr; } goto gt_gt_EndMethod2; // // // // gt_Error_UndefinedAttr: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, err_SAttrName, log_Reports);//属性名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7002;", tmpl, log_Reports); } goto gt_gt_EndMethod2; gt_gt_EndMethod2: ; }); // // // // 子 // // // { this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // 親へ連結 // // // parent_Ec.List_Expression_Child.Add(cur_Ec, log_Reports); goto gt_EndMethod; // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } 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); }
//──────────────────────────────────────── /// <summary> /// 2010年11月22日追加。 /// </summary> /// <returns></returns> public virtual Expression_Node_Function Translate( string sName_Action, Configurationtree_Node action_Conf, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, 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, "Translate",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment(action_Conf.Name); } // // // // // 自 // // // Expression_Node_Function expr_Func; { Expression_Node_String parent_Expression_Null = null; expr_Func = Collection_Function.NewFunction2( sName_Action, parent_Expression_Null, action_Conf, owner_MemoryApplication, log_Reports ); } this.Translate_Step1( this, action_Conf, expr_Func, owner_MemoryApplication, pg_ParsingLog, log_Reports ); this.Translate_Step2( this, action_Conf, expr_Func, owner_MemoryApplication, pg_ParsingLog, log_Reports ); // // // // if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(action_Conf.Name); } log_Method.EndMethod(log_Reports); return expr_Func; }
/// <summary> /// 変数設定ファイルを読込みます。 /// </summary> public void LoadVariables( String sFpath_Startup, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadVariables",log_Reports); // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「変数登録ファイル」を読込みます。"); } Table_Humaninput xenonTable_Variables; this.TryGetTable_Variables( out xenonTable_Variables, sFpath_Startup, log_Reports ); if (null==xenonTable_Variables) { //変数登録ファイルが無ければ無視。 goto gt_EndMethod; } if (log_Reports.Successful) { //this.Owner_MemoryApplication.MemoryVariables.Load( this.Load( xenonTable_Variables, log_Reports ); } goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void ConfigurationtreeToUsercontrol( Configurationtree_Node cur_Cf,//Sv_3Validator <validator> Usercontrol ucontrol, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToFc",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(41)" + cur_Cf.Name); } // // // // string err_SParameterValue = null; Exception err_Excp = null; string err_SValue = null; string err_SName_Validator = null; EnumValidation_Old enumResult = EnumValidation_Old.Thru; if (cur_Cf.Dictionary_Attribute.ContainsKey(PmNames.S_VALUE_RESULT.Name_Pm)) { string sValue_Parameter; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE_RESULT, out sValue_Parameter, true, log_Reports); switch (sValue_Parameter) { case "OK": enumResult = EnumValidation_Old.Ok; break; case "NG": enumResult = EnumValidation_Old.Ng; break; case "THRU": enumResult = EnumValidation_Old.Thru; break; default: // // エラー。 goto gt_Error_UndefinedValidator02; } } string sName; string sName_ValidatorTrim; { PmName pmName = PmNames.S_NAME; if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm)) { cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sName, true, log_Reports); sName_ValidatorTrim = sName.Trim(); } else { sName = ""; sName_ValidatorTrim = ""; } } // // バリデーターの選択 switch (sName_ValidatorTrim) { case NamesFnc.S_VLD_SPACES: { // SToE: Expressionv_SpacesTextValidator_Old nValidator = new Expressionv_SpacesTextValidator_Old(enumResult); ucontrol.AddValidator( nValidator, log_Reports ); } break; case NamesFnc.S_VLD_MATCH: { string sValue_Parameter; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_EXPECTED, out sValue_Parameter, false, log_Reports); err_SParameterValue = sValue_Parameter; // SToE: Expressionv_MatchTextValidator_Old ecv_Validator = new Expressionv_MatchTextValidator_Old(sValue_Parameter); ucontrol.AddValidator( ecv_Validator, log_Reports ); } break; case NamesFnc.S_VLD_INT_RANGE: { bool bSuccessful = true; int nBeginValue = 0; if (bSuccessful) { string sBegin; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_BEGIN, out sBegin, false, log_Reports); if (!int.TryParse(sBegin, out nBeginValue)) { // エラー。 err_Excp = null; err_SValue = sBegin; goto gt_Error_InvalidatedBegin02; } } int nEndValue = 0; if (bSuccessful) { string sEnd; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_END, out sEnd, false, log_Reports); if (!int.TryParse(sEnd, out nEndValue)) { // エラー。 err_Excp = null; err_SValue = sEnd; goto gt_Error_InvalidatedEnd02; } } if (bSuccessful) { // SToE: Expressionv_IntRangeTextValidator_Old nValidator = new Expressionv_IntRangeTextValidator_Old(nBeginValue, nEndValue); ucontrol.AddValidator( nValidator, log_Reports ); } } break; case NamesFnc.S_VLD_ALL: { // SToE: Expressionv_AllTextValidator_Old ecv_Validator = new Expressionv_AllTextValidator_Old(enumResult); ucontrol.AddValidator( ecv_Validator, log_Reports ); } break; default: // // エラー。 err_SName_Validator = sName; goto gt_Error_UndefinedValidator03; }//switch goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedValidator02: // TODO 未定義のバリデーターの場合。 { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, PmNames.S_VALUE_RESULT.Name_Pm, log_Reports);//引数名 tmpl.SetParameter(2, err_SParameterValue, log_Reports);//バリデーター名 ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7012;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_InvalidatedBegin02: // 設定エラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, PmNames.S_BEGIN.Name_Pm, log_Reports);//属性名 tmpl.SetParameter(2, err_SValue, log_Reports);//属性値 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7013;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_InvalidatedEnd02: // 設定エラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, PmNames.S_END.Name_Pm, log_Reports);//属性名 tmpl.SetParameter(2, err_SValue, log_Reports);//属性値 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7014;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedValidator03: // TODO 未定義のバリデーターの場合。 { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_SName_Validator, log_Reports);//バリデーター名 ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7015;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 「S■f-var」 /// </summary> /// <param name="oFStrNode"></param> /// <param name="nFAelem"></param> /// <param name="moOpyopyo"></param> /// <param name="log_Reports"></param> public override void Translate( Configurationtree_Node cur_Cf,//「S■f-var」 Expression_Node_String parent_Ec,//親<●●> MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(33)" + cur_Cf.Name); } // // // // // // // // 自 // // // Expression_FvarImpl cur_Ec = new Expression_FvarImpl(parent_Ec, cur_Cf, memoryApplication); // // // // 属性 // // // if (log_Reports.Successful) { this.ParseAttr_InConfigurationtreeToExpression( cur_Cf, cur_Ec, false,//name属性は無い。 false,//value属性は、子<f-str>にしない。 log_Reports ); } // // // // 子 // // // { // 非必須 value=”” value属性がなくても正常です。子要素を見に行きます。 if (cur_Cf.Dictionary_Attribute.ContainsKey(PmNames.S_VALUE.Name_Pm)) { string sValue; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); cur_Ec.AppendTextNode( sValue, cur_Cf, log_Reports ); } } // // // // 子 // // // { this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // 親へ連結 // // // { parent_Ec.List_Expression_Child.Add( cur_Ec, log_Reports ); } // // // // if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void Translate( Configurationtree_Node cur_Cf, Expressionv_3FListboxValidationImpl parent_Exprv, UsercontrolListbox uctLst, MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(35)" + cur_Cf.Name); } // // string err_Child_SName_Node = ""; string err_Parent_SName_Node = ""; Configurationtree_Node err_Child_CfNode = null; // // // // 自 // // // Expressionv_4ADisplayImpl cur_Exprv = new Expressionv_4ADisplayImpl(parent_Exprv, cur_Cf, memoryApplication); // // // // 属性 // // // { { PmName pmName = PmNames.S_TYPE; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { cur_Exprv.Dictionary_SAttribute.Add(pmName.Name_Pm, sValue); } } { PmName pmName = PmNames.S_DESCRIPTION; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { cur_Exprv.Dictionary_SAttribute.Add(pmName.Name_Pm, sValue); } } } parent_Exprv.List_Expressionv_ADisplay.Add(cur_Exprv); uctLst.AddValidator_FListboxForItems(parent_Exprv, log_Reports); // #デバッグ中 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" 子<f-●●>数=[" + cur_Cf.List_Child.Count + "]"); } // // // // 子 // // // cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node child_Cf, ref bool bBreak) { if (child_Cf is Configurationtree_Node) { Configurationtree_Node child_Configurationtree_Node = (Configurationtree_Node)child_Cf; string sName_Fnc; child_Configurationtree_Node.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, false, log_Reports); if (NamesFnc.S_VLD_ALL_FIELDS_IS_EMPTY == sName_Fnc) { // // <f-all-fields-is-empty>要素 ConfigurationtreeToExpression_V54_FAllFieldsIsEmptyImpl_ to = new ConfigurationtreeToExpression_V54_FAllFieldsIsEmptyImpl_(); to.Translate( child_Configurationtree_Node, cur_Exprv, memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesFnc.S_ALL_TRUE == sName_Fnc) { // // <f-all-true>要素 ConfigurationtreeToExpression_V54_FAllTrueImpl_ to = new ConfigurationtreeToExpression_V54_FAllTrueImpl_(); to.Translate( child_Configurationtree_Node, cur_Exprv, memoryApplication, pg_ParsingLog, log_Reports ); } else { // // エラー。 err_Child_SName_Node = child_Configurationtree_Node.Name; err_Parent_SName_Node = cur_Cf.Name; err_Child_CfNode = child_Configurationtree_Node; bBreak = true; } } }); if (null != err_Child_SName_Node) { goto undefined_element; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── undefined_element: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_Child_SName_Node, log_Reports);//子設定ノード名 tmpl.SetParameter(2, err_Parent_SName_Node, log_Reports);//親設定ノード名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(err_Child_CfNode), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7020;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 読取。 /// </summary> /// <param name="s_View"></param> /// <param name="ef_View"></param> /// <param name="moOpyopyo"></param> /// <param name="log_Reports"></param> public void Translate( Configurationtree_Node cur_Cf,//<view> Expression_Node_String parent_Ec,//「E■form-component」 MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(3)"+cur_Cf.Name); } // // // // // // // // 自 // // // Expression_Node_StringImpl cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf); // // // // 子 // // // { //<●●>要素を全検索。<f-list-box-labels>があることが期待されます。 cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node cf_Child, ref bool bBreak) { if (cf_Child is Configurationtree_Node) { Configurationtree_Node cf_Node = (Configurationtree_Node)cf_Child; string sName_Node = cf_Node.Name; string sName_Fnc = ""; { bool bRequired; if (NamesNode.S_FNC == sName_Node) { bRequired = true; } else { bRequired = false; } // todo; 子要素のnameも取りたい。 cf_Node.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, bRequired, log_Reports); } if (NamesNode.S_FNC == sName_Node && NamesFnc.S_LISTBOX_LABELS == sName_Fnc) { // 「S■fnc name=”Sf:f-listbox-labels;”」 ConfigurationtreeToExpression_F91_FListboxLabelsImpl_ to = new ConfigurationtreeToExpression_F91_FListboxLabelsImpl_(); to.Translate( cf_Child, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } else { // エラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Node, log_Reports);//設定ノード名 tmpl.SetParameter(2, sName_Fnc, log_Reports);//関数名 memoryApplication.CreateErrorReport("Er:7003;", tmpl, log_Reports); } bBreak = true; } } }); } // // // // 親へ連結 // // // { parent_Ec.List_Expression_Child.Add(cur_Ec, log_Reports); } goto gt_EndMethod; // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void Translate( Configurationtree_Node cur_Conf, Expression_Node_String parent_Expr, MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(40)" + cur_Conf.Name); } // // // // // // // // 自 // // // Expression_Node_String ec_Value = new Expression_Node_StringImpl(parent_Expr, cur_Conf); ec_Value.AppendTextNode( cur_Conf.Name, cur_Conf, log_Reports ); // // // // 自 // // // Expression_Node_StringImpl cur_Expr = new Expression_Node_StringImpl(parent_Expr, cur_Conf); // // // // 属性 // // // { cur_Expr.SetAttribute( PmNames.S_NAME.Name_Pm, ec_Value, log_Reports ); parent_Expr.SetAttribute( NamesNode.S_RECORD_SET_LOAD_FROM, ((Expression_Node_String)cur_Expr), log_Reports ); } // // // // 子要素 // // // { this.ParseChild_InConfigurationtreeToExpression( cur_Conf, cur_Expr, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Conf.Name); } log_Method.EndMethod(log_Reports); }