//──────────────────────────────────────── /// <summary> /// アクション実行。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports); string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // if (this.EnumEventhandler == EnumEventhandler.O_Ea) { if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender; string fcNameStr = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe += "/追記:[" + fcNameStr + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName0 + "]アクションを実行。"; } // テーブル Table_Humaninput o_Table_Src; { Expression_Node_String ec_ArgTableName; this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function05Impl.PM_NAME_TABLE_SOURCE, EnumHitcount.One_Or_Zero, log_Reports); o_Table_Src = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( ec_ArgTableName, true, log_Reports ); } // // 書き出すテキスト // string sCsvText; { ToCsv_Table_Humaninput_Impl toCsv = new ToCsv_Table_Humaninput_Impl(); // // 出力しないフィールド名(英字は、大文字にして入れること) // toCsv.ExceptedFields.List_SExceptedFields_Starts_Upper.Add("Expl".ToUpper()); // // 一時的にプロパティー変更 // bool bOldRowColRev = o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse; o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse = false;//行と列を、ひっくり返さずに書きだす。 sCsvText = toCsv.ToCsvText(o_Table_Src, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } // // 元に戻す。 // o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse = bOldRowColRev; } // // 書き出し先のテーブル // Table_Humaninput o_Table_Dst; if (log_Reports.Successful) { Expression_Node_String ec_ArgTableName; this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function05Impl.PM_NAME_TABLE_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports); o_Table_Dst = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( ec_ArgTableName, true, log_Reports ); } else { o_Table_Dst = null; } // // 書き出し先ファイルへのパス // string sFpatha_Dst;//絶対ファイルパス if (log_Reports.Successful) { sFpatha_Dst = o_Table_Dst.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } else { sFpatha_Dst = null; } // // ファイルの書き出し // if (log_Reports.Successful) { // 正常時 CsvWriterImpl writer = new CsvWriterImpl(); writer.Write(sCsvText, sFpatha_Dst, true); } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return ""; }
//──────────────────────────────────────── protected void Execute6_Sub( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); string sName_Fnc; this.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sName_Fnc + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // 変数は、登録されている名前の変数は存在し、登録されていない名前の変数は(自動作成されたもの以外は)存在しない。 // // 元となるテーブルを見ながら、変数オブジェクトの内容を調べていく。 // // Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname, null); // 変数ログを吐く。 { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); sb.Append(","); sb.Append(NamesFld.S_ID); sb.Append(","); sb.Append(NamesFld.S_EXPL); sb.Append(","); sb.Append(NamesFld.S_NAME); sb.Append(","); sb.Append(NamesFld.S_FOLDER); sb.Append(","); sb.Append(NamesFld.S_VALUE); sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT);//NO sb.Append(","); sb.Append(NamesTypedb.S_INT);//ID sb.Append(","); sb.Append(NamesTypedb.S_STRING);//Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING);//NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING);//FOLDER sb.Append(","); sb.Append(NamesTypedb.S_STRING);//VALUE sb.Append(","); sb.Append(NamesFld.S_END);//END sb.Append(Environment.NewLine); //3行目 sb.Append("-1,");//NO sb.Append("使わない,");//ID sb.Append("解説,");//Expl sb.Append("変数名,");//NAME sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,");//FOLDER sb.Append("初期値,");//VALUE sb.Append(NamesFld.S_END);//END sb.Append(Environment.NewLine); int nAuto = 0; this.Owner_MemoryApplication.MemoryVariables.EachVariable(delegate(string sKey, Expression_Node_String ec_String, ref bool bBreak) { if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("[" + sKey + "]=[" + ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]"); } sb.Append(nAuto);//NO sb.Append(","); //ID 使わない sb.Append(","); //Expl 消えてしまう sb.Append(","); sb.Append(sKey);//NAME sb.Append(","); //FOLDER TODO:逆算が必要 sb.Append(","); sb.Append(ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));//VALUE sb.Append(","); sb.Append(NamesFld.S_END);//END sb.Append(Environment.NewLine); nAuto++; }); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(sb.ToString()); } //ログ出力 { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOG_VARIABLES; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } //変数CSVを吐き出したい。(登録されている順序を保って) { // 変数ファイルの読取り Table_Humaninput o_Table_Variables; this.Owner_MemoryApplication.MemoryVariables.TryGetTable_Variables( out o_Table_Variables, Application.StartupPath, log_Reports ); if (null != o_Table_Variables) { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); sb.Append(","); sb.Append(NamesFld.S_ID); sb.Append(","); sb.Append(NamesFld.S_EXPL); sb.Append(","); sb.Append(NamesFld.S_NAME); sb.Append(","); sb.Append(NamesFld.S_FOLDER); sb.Append(","); sb.Append(NamesFld.S_VALUE); sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT);//NO sb.Append(","); sb.Append(NamesTypedb.S_INT);//ID sb.Append(","); sb.Append(NamesTypedb.S_STRING);//Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING);//NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING);//FOLDER sb.Append(","); sb.Append(NamesTypedb.S_STRING);//VALUE sb.Append(","); sb.Append(NamesFld.S_END);//END sb.Append(Environment.NewLine); //3行目 sb.Append("-1,");//NO sb.Append("使わない,");//ID sb.Append("解説,");//Expl sb.Append("変数名,");//NAME sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,");//FOLDER sb.Append("初期値,");//VALUE sb.Append(NamesFld.S_END);//END sb.Append(Environment.NewLine); int nAuto = 0; foreach (DataRow row in o_Table_Variables.DataTable.Rows) { if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NO)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_NO], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } // IDは空欄が正しいが、int型なので空欄にできないので 0 を入れる。 if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_ID)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_ID], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_EXPL)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_EXPL], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); } string sName_Var = ""; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NAME)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_NAME], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); sName_Var = sValue; } // 現在の変数の内容 string sValue_Var = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); //現在の変数の内容を検索 if (NamesVar.Test_Filepath(sName_Var)) { Expression_Node_Filepath ec_Fpath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); // 絶対パスとは限らない。フォルダーを指していることもある。 string sFpath = ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //フォルダー列値を取得。 string sNamevar_Folder_Src; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_FOLDER)) { String_HumaninputImpl.TryParse(row[NamesFld.S_FOLDER], out sNamevar_Folder_Src, "", "", log_Method, log_Reports); //フォルダーパス Expression_Node_Filepath ec_Folder = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sNamevar_Folder_Src,null,cur_Cf), false, log_Reports); if (null != ec_Folder) { // FOLDER列に入力があれば。 string sFpath_Folder = ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (sValue_Var.StartsWith(sFpath_Folder)) { // FOLDER列値をそのままキープ。 sb.Append(sNamevar_Folder_Src); // 値のフォルダー部分を削る。 sValue_Var = sValue_Var.Substring(sFpath_Folder.Length); // 先頭が ディレクトリー区切り文字なら削る。 if (sValue_Var.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { sValue_Var = sValue_Var.Substring(System.IO.Path.DirectorySeparatorChar.ToString().Length); } } else { // FOLDER列値はそのまま使えない。 } } sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { //string sValue; //String_HumaninputImpl.TryParse(row[NamesFld.S_VALUE], out sValue, "", "", log_Method, log_Reports); //sb.Append(sValue); //sb.Append(","); // 現在の変数の値(の削った残り)を入れる。 sb.Append(sValue_Var); sb.Append(","); } } else// if (NamesVar.Test_String(sName_Var)) { // FOLDER列値は無し。 sb.Append(","); if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { // 現在の変数の値を入れる。 sb.Append(sValue_Var); sb.Append(","); } } sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); nAuto++; } //ファイル書出し { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_SAVE_VARIABLES; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } } // // メッセージボックスの表示。 { StringBuilder sb = new StringBuilder(); sb.Append(this.GetType().Name); sb.Append("#Execute6_Sub:"); sb.Append(Environment.NewLine); string sArgMessage; this.TrySelectAttribute(out sArgMessage, Expression_Node_Function45Impl.PM_MESSAGE, EnumHitcount.One_Or_Zero, log_Reports); sb.Append(sArgMessage); MessageBox.Show(sb.ToString(), "変数をCSVファイルに書き出したい。"); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── 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); }
//──────────────────────────────────────── private void Execute6_Sub(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); string sFlowSkip; this.TrySelectAttribute(out sFlowSkip, Expression_Node_Function04Impl.PM_FLOWSKIP, EnumHitcount.One_Or_Zero, log_Reports); if ("" != sFlowSkip.Trim()) { // 処理をスキップします。 goto gt_EndMethod; } // // // // テーブル名 // // // List<string> sList_TableName = new List<string>(); { string sTableNames; this.TrySelectAttribute(out sTableNames, Expression_Node_Function04Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); CsvTo_DataTableImpl reader = new CsvTo_DataTableImpl(); DataTable tblNamesTable = reader.Read( sTableNames ); foreach (DataRow row in tblNamesTable.Rows) { foreach (string column in row.ItemArray) { sList_TableName.Add(column); } } } foreach (string sTableName in sList_TableName) { Table_Humaninput o_Table; if (log_Reports.Successful) { Expression_Node_String ec_ArgTableName; this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function04Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); Expression_Node_StringImpl ec_TableName = new Expression_Node_StringImpl(this, ec_ArgTableName.Cur_Configuration); ec_TableName.AppendTextNode( sTableName, this.Cur_Configuration, log_Reports ); // テーブル o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( ec_TableName, true, log_Reports ); } else { o_Table = null; } string sCsvText; if (log_Reports.Successful) { ToCsv_Table_Humaninput_Impl textizer = new ToCsv_Table_Humaninput_Impl(); sCsvText = textizer.ToCsvText(o_Table, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } else { sCsvText = null; } string sFpatha;//絶対ファイルパス if (log_Reports.Successful) { // 正常時 //essageBox.Show("テーブルのtext=[" + csvText + "]", "デバッグ"); // TODO ファイルパスの妥当性判定も欲しい sFpatha = o_Table.Expression_Filepath_ConfigStack.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } else { sFpatha = ""; } if (log_Reports.Successful) { bool bPopup; string sPopup; this.TrySelectAttribute(out sPopup, Expression_Node_Function04Impl.PM_POPUP, EnumHitcount.One_Or_Zero, log_Reports); if ("block" == sPopup.Trim()) { log_Method.WriteInfo_ToConsole("sPopup=[" + sPopup + "] ポップアップしません。"); bPopup = false; } else { bPopup = true; } CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sCsvText, sFpatha, bPopup); } } gt_EndMethod: log_Method.EndMethod(log_Reports); }