/// <summary> /// (17)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。 /// </summary> /// <param name="sender"></param> /// <param name="eventMonitor_Dammy"></param> /// <param name="log_Reports"></param> protected virtual void On_P17c_PreviousOpenWindow( object sender, MemoryAaeditorxml_Editor moAaeditorxml_Editor, Expression_Node_Filepath ec_Fpath_AaEditorXml, Expression_Node_Filepath ec_Fopath_Editor, MemoryAatoolxml_Editor moAatoolxml_SelectedEditor, Log_Reports log_Reports) { }
//──────────────────────────────────────── /// <summary> /// E_Elm属性。 /// </summary> /// <param name="out_E_Result">検索結果。</param> /// <param name="sName"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelectAttribute_ExpressionFilepath( out Expression_Node_Filepath ec_Result_Out, string sName, EnumHitcount hits, Log_Reports log_Reports ) { return(this.Dictionary_Expression_Attribute.TrySelect_ExpressionFilepath( out ec_Result_Out, sName, hits, log_Reports)); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public Request_ReadsTableImpl() { this.name_PutToTable = ""; this.use = ""; { Configurationtree_Node s_ParentNode = new Configurationtree_NodeImpl("!ハードコーディング_Request_TableReadsImpl#<init>", null); Configurationtree_NodeFilepath s_fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L02_1", s_ParentNode); this.expression_Filepath = new Expression_Node_FilepathImpl(s_fpath); } }
//──────────────────────────────────────── protected void TestExists_EmptyFilePath( string sArgName, Expression_Node_Filepath ec_Fpath, string sFpath_SelectedProject, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "TestExists_EmptyFilePath", log_Reports); // // if (null == ec_Fpath) { goto gt_Error_NullFpath; } else if ("" == ec_Fpath.Humaninput) { goto gt_Error_NoData; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullFpath: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFpath_SelectedProject, log_Reports); //選択したエディター・フォルダーのファイルパス tmpl.SetParameter(2, sArgName, log_Reports); //引数名 this.Owner_MemoryApplication.CreateErrorReport("Er:110005;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoData: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sArgName, log_Reports); //引数名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Fpath.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110006;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 属性。 /// </summary> /// <param name="out_E_Result">検索結果。</param> /// <param name="sName"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelectAttribute_ExpressionFilepath( out Expression_Node_Filepath ec_Result_Out, string sName, EnumHitcount hits, Log_Reports log_Reports ) { // 使いません。 Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl(sName, this.Cur_Configuration); filepath_Conf.InitPath("", log_Reports); ec_Result_Out = new Expression_Node_FilepathImpl(filepath_Conf); return(false); }
//"ノード名未指定" //──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="e_Fpath_ConfigStack"></param> public Table_HumaninputImpl( string name_Table, Expression_Node_Filepath filepath_Nodeconfigtree_Expr, Configuration_Node cur_Conf ) : base(name_Table, cur_Conf) { this.expression_Filepath_ConfigStack = filepath_Nodeconfigtree_Expr; this.dataTable = new DataTable(); this.name_Table = name_Table; this.format_Table_Humaninput = new Format_Table_HumaninputImpl(); this.recordFielddefinition_ = new RecordFielddefinitionImpl();//暫定 }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// Rfr 設定ファイル読取。 /// </summary> /// <param name="n_FilePath_Rfr"></param> /// <param name="log_Reports"></param> public void LoadFile( Expression_Node_Filepath ec_Fpath_Rfr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile", log_Reports); // // // (R9)絶対ファイルパスの取得 string sFpatha_rfr; if (log_Reports.Successful) { // 正常時 sFpatha_rfr = ec_Fpath_Rfr.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } else { sFpatha_rfr = ""; } // (R10)ファイルから内容を読み込んでモデルに挿入 if (log_Reports.Successful) { // 正常時 XmlToConfigurationtree_Together to = new XmlToConfigurationtree_Together_ConfigImpl(); this.Configurationtree_Togetherconfig = to.XmlToConfigurationtree(sFpatha_rfr, owner_MemoryApplication, log_Reports); } // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// Rfr 設定ファイル読取。 /// </summary> /// <param name="n_FilePath_Rfr"></param> /// <param name="log_Reports"></param> public void LoadFile( Expression_Node_Filepath ec_Fpath_Rfr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile",log_Reports); // // // (R9)絶対ファイルパスの取得 string sFpatha_rfr; if (log_Reports.Successful) { // 正常時 sFpatha_rfr = ec_Fpath_Rfr.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } else { sFpatha_rfr = ""; } // (R10)ファイルから内容を読み込んでモデルに挿入 if (log_Reports.Successful) { // 正常時 XmlToConfigurationtree_Together to = new XmlToConfigurationtree_Together_ConfigImpl(); this.Configurationtree_Togetherconfig = to.XmlToConfigurationtree(sFpatha_rfr, owner_MemoryApplication, log_Reports); } // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// ファイル・パス型変数の値をセットします。 /// </summary> /// <param select="oVariableName"></param> /// <param select="nValue"></param> /// <param select="bRequired"></param> public void SetFilepathValue(string sVariableName, Expression_Node_Filepath ec_Fpath, bool bRequired, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetFilepathValue", log_Reports); if (bRequired && !this.dictionaryExpression_Item.ContainsKey(sVariableName)) { goto gt_Error_NotFoundVariable; } else { this.dictionaryExpression_Item[sVariableName] = ec_Fpath; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー924!", log_Method); r.Message = "変数[" + sVariableName + "]は存在しませんでした。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 属性。 /// </summary> /// <param name="out_E_Result">検索結果。</param> /// <param name="sName"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelectAttribute_ExpressionFilepath( out Expression_Node_Filepath ec_Result_Out, string sName, EnumHitcount hits, Log_Reports log_Reports ) { // 使いません。 Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl(sName, this.Cur_Configuration); filepath_Conf.InitPath("", log_Reports); ec_Result_Out = new Expression_Node_FilepathImpl(filepath_Conf); return false; }
//──────────────────────────────────────── 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> /// ファイル読み込み。 /// </summary> /// <param name="ec_Fpath_Aatoolxml"></param> public void LoadFile( Expression_Node_Filepath ec_Fpath_Aatoolxml, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile", log_Reports); // Exception err_Excp; string sFpatha_Aatoolxml = ""; if (log_Reports.Successful) { // // 『ツール設定』をクリアー。 // this.Clear(this.Owner_MemoryApplication); sFpatha_Aatoolxml = ec_Fpath_Aatoolxml.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports );//絶対ファイルパス } if (log_Reports.Successful) { XmlDocument xDoc = new XmlDocument(); try { // 正常時 xDoc.Load(sFpatha_Aatoolxml); // ルート要素を取得 XmlElement xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(バリデーター登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(sFpatha_Aatoolxml, null), NamesNode.S_CODEFILE_TOOL ); if (log_Reports.Successful) { // デフォルト・エディター名 this.Name_DefaultEditor = xRoot.GetAttribute(PmNames.S_DEFAULT_EDITOR.Name_Attribute); // エディター要素を列挙 System.Xml.XmlNodeList xNl_Editor = xRoot.GetElementsByTagName(NamesNode.S_EDITOR); foreach (XmlNode x_EditorNode in xNl_Editor) { if (XmlNodeType.Element == x_EditorNode.NodeType) { // // エディター要素 // MemoryAatoolxml_Editor aatool_Editor = new MemoryAatoolxml_EditorImpl(this.cur_Configuration); // // エディター要素 // XmlElement xEditor = (XmlElement)x_EditorNode; // ツール設定ファイルに記載されている、エディター名 try { aatool_Editor.Name = xEditor.GetAttribute(PmNames.S_NAME.Name_Attribute); this.Dictionary_Editor.Dictionary_Item.Add(aatool_Editor.Name, aatool_Editor); } catch (ArgumentException ex) { err_Excp = ex; goto gt_Error_DuplicatedEditorName; } // <f-set-var>要素を列挙 System.Xml.XmlNodeList xNl_Fsetvar = xEditor.GetElementsByTagName(NamesNode.S_F_SET_VAR); for (int nIndex_Fsetvar = 0; nIndex_Fsetvar < xNl_Fsetvar.Count; nIndex_Fsetvar++) { XmlNode xNode_Fsetvar = xNl_Fsetvar.Item(nIndex_Fsetvar); if (XmlNodeType.Element == xNode_Fsetvar.NodeType) { //<f-set-var>要素 Configurationtree_Node cf_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, ec_Fpath_Aatoolxml.Cur_Configuration); //<f-set-var>要素 XmlElement xFsetvar = (XmlElement)xNode_Fsetvar; string sNamevar = xFsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute); string sFolder = xFsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute); string sValue = xFsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute); string sDescription = xFsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports); aatool_Editor.Dictionary_Fsetvar_Configurationtree.List_Child.Add(cf_Fsetvar, log_Reports); } } } } } } catch (System.IO.FileNotFoundException ex) { err_Excp = ex; goto gt_Error_NothingFile; } catch (System.Exception ex) { err_Excp = ex; goto gt_Error_Exception; } } if (log_Reports.Successful) { this.cur_Configuration = ec_Fpath_Aatoolxml.Cur_Configuration; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_DuplicatedEditorName: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー204!", log_Method); StringBuilder s = new StringBuilder(); s.Append("『ツール設定ファイル』(tool config)読み取り中に、何らかのエラーが発生しました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: <" + NamesNode.S_EDITOR + ">要素の" + PmNames.S_NAME.Name_Attribute + "属性が重複している?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // 例外メッセージ s.Append(r.Message_SException(err_Excp)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NothingFile: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, ValuesAttr.S_FPATHR_AATOOLXML, log_Reports); tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); this.Owner_MemoryApplication.CreateErrorReport("Er:1;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー203!", log_Method); StringBuilder s = new StringBuilder(); s.Append("『ツール設定ファイル』(tool config)読み取り中に、何らかのエラーが発生しました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: XMLのencoding指定が間違っている?この読取プログラムの期待するエンコードでないかも?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // // 例外メッセージ s.Append(r.Message_SException(err_Excp)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
/// <summary> /// /// </summary> /// <param name="e_Result">検索結果。</param> /// <param name="name_Attribute"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelect_ExpressionFilepath( out Expression_Node_Filepath out_Fliepath_Expr, string name_Attribute, EnumHitcount hits, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TrySelect_ExpressionFilepath", log_Reports); string value; bool isResult = this.TrySelect(out value, name_Attribute, hits, log_Reports); Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null); filepath_Conf.InitPath(value, log_Reports); out_Fliepath_Expr = new Expression_Node_FilepathImpl(filepath_Conf); //switch (hits) //{ // case EnumHitcount.One: // { // if (!isResult) // { // //エラー // goto gt_Error_NotFoundOne; // } // } // break; // //todo:他の制約も。 //} goto gt_EndMethod; // // #region 異常系 ////──────────────────────────────────────── //gt_Error_NotFoundOne: // if (log_Reports.CanCreateReport) // { // Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); // r.SetTitle("▲エラー281!", log_Method); // StringBuilder s = new StringBuilder(); // s.Append("必ず、1件を取得する指定でしたが、1件も存在しませんでした。キー=["); // s.Append(name_Attribute); // s.Append("]"); // // ヒント // r.Message = s.ToString(); // log_Reports.EndCreateReport(); // } // goto gt_EndMethod; ////──────────────────────────────────────── // #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return isResult; }
//──────────────────────────────────────── /// <summary> /// コントロール名と、設定ファイルパスが指定されるので、 /// 検索して、設定。 /// </summary> /// <param name="sFcName"></param> /// <param name="sFpathH_F">絶対ファイルパス(F)手入力</param> /// <param name="sFpatha_F">絶対ファイルパス(F)</param> /// <param name="s_FcConfig"></param> /// <param name="oFormsFolderPath"></param> /// <param name="owner_MemoryApplication"></param> /// <param name="log_Reports"></param> public void XmlToConfigurationtree( string sName_Control, string sFpathH_F, string sFpatha_F, Configurationtree_Node cf_ControlConfig, Expression_Node_Filepath ec_Fopath_Forms, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XToCf", log_Reports); // // System.Xml.XmlDocument xDoc = null; Exception err_Excp = null; if (log_Reports.Successful) { // 正常時 xDoc = new System.Xml.XmlDocument(); if (System.IO.File.Exists(sFpatha_F)) { try { xDoc.Load(sFpatha_F); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_IoException; } catch (System.Xml.XmlException ex) { // // エラー。 err_Excp = ex; goto gt_Error_XmlException; } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Exception01; } } else { // エラー。 goto gt_Error_NotFoundFile; } } // // コントロール自体は、Aa_Forms.csvを読み取って // 既に追加済みです。 XmlElement err_XElm = null; if (log_Reports.Successful) { // 正常時 XmlToConfigurationtree_C12_ControlImpl_ to = new XmlToConfigurationtree_C12_ControlImpl_(); try { // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // <scriptfile-controls scriptfile-version=”1.0”> を期待。 if (NamesNode.S_CODEFILE_CONTROLS != xRoot.Name) { //エラー err_XElm = xRoot; goto gt_Error_Root; } // スクリプトファイルのバージョンチェック。(コントロール設定ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, cf_ControlConfig, NamesNode.S_CODEFILE_CONTROLS ); // ルート要素の下の子<control>要素 XmlNodeList xNl_Top = xRoot.ChildNodes; foreach (XmlNode xTopNode in xNl_Top) { if (XmlNodeType.Element == xTopNode.NodeType) { XmlElement xTop = (XmlElement)xTopNode; if (NamesNode.S_CONTROL1 == xTop.Name) { to.XmlToConfigurationtree( sName_Control, cf_ControlConfig, xTop, owner_MemoryApplication, log_Reports ); } else { // // エラー。 err_XElm = xTop; goto gt_Error_UndefinedChildElement; } } } } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Exception02; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Root: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CODEFILE_CONTROLS, log_Reports); //期待したルート要素名 tmpl.SetParameter(2, err_XElm.Name, log_Reports); //実際のルート要素名 tmpl.SetParameter(3, sFpatha_F, log_Reports); //コントロール設定絶対ファイルパス tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8010;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotFoundFile: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports); //コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //Formsフォルダーパス tmpl.SetParameter(3, sFpathH_F, log_Reports); //コントロール設定ファイル(入力ママ) tmpl.SetParameter(4, sFpatha_F, log_Reports); //コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8011;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_IoException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports); //コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //Formsフォルダーパス tmpl.SetParameter(3, sFpathH_F, log_Reports); //コントロール設定ファイル(入力ママ) tmpl.SetParameter(4, sFpatha_F, log_Reports); //コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8012;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_XmlException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFpatha_F, log_Reports); //コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8013;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception01: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8014;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception02: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8015;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChildElement: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CONTROL1, log_Reports); //期待するノード名 tmpl.SetParameter(2, err_XElm.Name, log_Reports); //実際のノード名 owner_MemoryApplication.CreateErrorReport("Er:8016;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// ファイルパス型変数を登録します。 /// /// todo:文字列、ファイルパスの区別なく登録したい。 /// </summary> /// <param name="sVariableName"></param> /// <param name="e_InitialValue"></param> /// <param name="bDuplicatedIsError">既に追加されているものを、更に追加しようとしたときにエラーにするなら真。</param> /// <param name="log_Reports"></param> public void PutFilepath( string sName_Variable, Expression_Node_Filepath ec_InitialValue, bool bDuplicatedIsError, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "PutFilepath",log_Reports); // // if (this.dictionaryExpression_Item.ContainsKey(sName_Variable)) { if (bDuplicatedIsError) { goto gt_Error_Duplicated; } else { // 上書き string sOldValue = ""; if (log_Method.CanInfo()) { sOldValue = this.dictionaryExpression_Item[sName_Variable].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } this.dictionaryExpression_Item[sName_Variable] = ec_InitialValue; if (log_Method.CanInfo()) { log_Method.WriteInfo_ToConsole("変数[" + sName_Variable + "]は既に[" + sOldValue + "]と定義されていましたが、[" + ec_InitialValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]で上書きしました。"); } } } else { this.dictionaryExpression_Item.Add(sName_Variable, ec_InitialValue); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Duplicated: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー922!", log_Method); r.Message = "変数[" + sName_Variable + "]は既に定義されていますが、さらに定義されました。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 『Aa_Tool.xml/<editor>要素』または、『Aa_Editor.xml/<ルート>要素』を読み取ります。 /// <f-set-var>を読み取った場合、逐次、変数モデルに追加していきます。 /// </summary> public void LoadFile_Aaxml( Expression_Node_Filepath ec_Fpath_Aaxml, MemoryVariables moVariables, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile_Aaxml",log_Reports); string sFpatha; { sFpatha = ec_Fpath_Aaxml.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports//out sErrorMsg );//絶対ファイルパス if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); Exception err_Excp; try { xDoc.Load(sFpatha); // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // <f-set-var>要素を列挙 XmlNodeList xNl_Fsetvar = xRoot.GetElementsByTagName(NamesNode.S_F_SET_VAR); foreach (XmlNode xNode_Fsetvar in xNl_Fsetvar) { if (XmlNodeType.Element == xNode_Fsetvar.NodeType) { //<f-set-var>要素 XmlElement xFsetvar = (XmlElement)xNode_Fsetvar; //name-var属性 string sNamevar = xFsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute); //folder属性 string sFolder = xFsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute); //value属性 string sValue = xFsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute); //description属性 string sDescription = xFsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute); Configurationtree_Node cf_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, null//todo:親ノード ); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports); this.Dictionary_Fsetvar_Configurationtree.List_Child.Add(cf_Fsetvar, log_Reports); //変数への追加 { if ( NamesVar.Test_Filepath(sNamevar) ) { // ファイルパスの場合 Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("name-var=[" + sNamevar + "]", ec_Fpath_Aaxml.Cur_Configuration); cf_Fpath.InitPath( sValue, log_Reports ); if ("" != sFolder) { Expression_Node_Filepath ec_Folder = moVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sFolder, ec_Fpath_Aaxml, cf_Fsetvar), true, log_Reports); if (log_Reports.Successful) { cf_Fpath.SetDirectory_Base( ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) //sFolder ); } } if (log_Reports.Successful) { Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); moVariables.PutFilepath( sNamevar, ec_Fpath, true, log_Reports ); } } else { // ファイルパスでない場合 moVariables.PutString( sNamevar, sValue, log_Reports ); } } } if (!log_Reports.Successful) { //既エラー break; } } if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } catch (System.IO.IOException ex) { // 既エラー。 err_Excp = ex; goto gt_Error_IOException; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_IOException: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー283!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エディター設定ファイルが見つかりません。:" + err_Excp.Message); //ヒント s.Append(r.Message_Configuration(ec_Fpath_Aaxml.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// 『Aa_Tool.xml/<editor>要素』または、『Aa_Editor.xml/<ルート>要素』を読み取ります。 /// <f-set-var>を読み取った場合、逐次、変数モデルに追加していきます。 /// </summary> public void LoadFile_Aaxml( Expression_Node_Filepath ec_Fpath_Aaxml, MemoryVariables moVariables, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile_Aaxml", log_Reports); string sFpatha; { sFpatha = ec_Fpath_Aaxml.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports //out sErrorMsg ); //絶対ファイルパス if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); Exception err_Excp; try { xDoc.Load(sFpatha); // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // <f-set-var>要素を列挙 XmlNodeList xNl_Fsetvar = xRoot.GetElementsByTagName(NamesNode.S_F_SET_VAR); foreach (XmlNode xNode_Fsetvar in xNl_Fsetvar) { if (XmlNodeType.Element == xNode_Fsetvar.NodeType) { //<f-set-var>要素 XmlElement xFsetvar = (XmlElement)xNode_Fsetvar; //name-var属性 string sNamevar = xFsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute); //folder属性 string sFolder = xFsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute); //value属性 string sValue = xFsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute); //description属性 string sDescription = xFsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute); Configurationtree_Node cf_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, null//todo:親ノード ); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports); this.Dictionary_Fsetvar_Configurationtree.List_Child.Add(cf_Fsetvar, log_Reports); //変数への追加 { if ( NamesVar.Test_Filepath(sNamevar) ) { // ファイルパスの場合 Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("name-var=[" + sNamevar + "]", ec_Fpath_Aaxml.Cur_Configuration); cf_Fpath.InitPath( sValue, log_Reports ); if ("" != sFolder) { Expression_Node_Filepath ec_Folder = moVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sFolder, ec_Fpath_Aaxml, cf_Fsetvar), true, log_Reports); if (log_Reports.Successful) { cf_Fpath.SetDirectory_Base( ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) //sFolder ); } } if (log_Reports.Successful) { Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); moVariables.PutFilepath( sNamevar, ec_Fpath, true, log_Reports ); } } else { // ファイルパスでない場合 moVariables.PutString( sNamevar, sValue, log_Reports ); } } } if (!log_Reports.Successful) { //既エラー break; } } if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } catch (System.IO.IOException ex) { // 既エラー。 err_Excp = ex; goto gt_Error_IOException; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_IOException: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー283!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エディター設定ファイルが見つかりません。:" + err_Excp.Message); //ヒント s.Append(r.Message_Configuration(ec_Fpath_Aaxml.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── /// <summary> /// <f-set-var>要素の名前を指定して、値を取り出します。(ファイル・パスとします) /// 該当がなければヌルを返します。 /// </summary> /// <param name="projectName"></param> /// <param name="bRequired">該当がない場合にエラー扱いにするなら真</param> /// <returns></returns> public Expression_Node_Filepath GetFilepathByFsetvarname( string sNamevar_Expected, MemoryVariables moVariables, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetFilepathByFsetvarname", log_Reports); // // Expression_Node_Filepath ec_Fpath = null; //各<f-set-var> this.Dictionary_Fsetvar_Configurationtree.List_Child.ForEach(delegate(Configurationtree_Node s_Fsetvar, ref bool bBreak) { //name-var属性 string sNamevar_Cur; s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_NAME_VAR, out sNamevar_Cur, true, log_Reports); if (sNamevar_Cur == sNamevar_Expected) { string sFolder; s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_FOLDER, out sFolder, false, log_Reports); string sValue; s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); { Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("『エディター設定ファイル』の[" + sNamevar_Expected + "]要素_L09Mid_2[" + sValue + "]", this.Parent); cf_Fpath.InitPath( sValue, log_Reports ); if ("" != sFolder) { //フォルダーパス変数名の指定有り Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sFolder, null, cf_Fpath); log_Reports.Log_Callstack.Push(log_Method, "②"); Expression_Node_Filepath ec_Fpath_Folder = moVariables.GetExpressionfilepathByVariablename(ec_Namevar_Folder, true, log_Reports); log_Reports.Log_Callstack.Pop(log_Method, "②"); if (log_Reports.Successful) { string sDirectory = ec_Fpath_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("folder=[" + sFolder + "] directory=[" + sDirectory + "]"); } cf_Fpath.SetDirectory_Base( sDirectory ); } } if (!log_Reports.Successful) { // 既エラー。 bBreak = true; goto gt_EndMethod2; } ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); } } goto gt_EndMethod2; // // gt_EndMethod2: ; }); if (null == ec_Fpath) { if (bRequired) { // エラーとして扱います。 goto gt_Error_NotFoundFsetvar; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundFsetvar: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("Er:003;", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("次の要素は必要でしたが、記述されていませんでした。<" + NamesNode.S_EDITOR + ">要素の中に。"); s.Newline(); s.Newline(); s.Append("<" + NamesNode.S_F_SET_VAR + " name=\"" + sNamevar_Expected + "\" >"); s.Newline(); s.Newline(); s.Append("もしかして?"); s.Newline(); s.Append(" ・『設定ファイル』に、必要な内容が書けていない?"); s.Newline(); s.Append(" ・設定ファイル情報:"); s.Append(r.Message_Configuration(this.Parent)); s.Newline(); s.Newline(); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(ec_Fpath); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// システム変数を、自動類推して、自動登録します。 /// </summary> /// <param name="ec_Fopath_Editor"></param> /// <param name="log_Reports"></param> public void Load_AutoSystemVariable( Expression_Node_Filepath ec_Fopath_Editor, 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_AutoSystemVariable", log_Reports); // // // 「エディター・フォルダー」パス string sFopath_Editor = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); // // Engine フォルダー // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_ENGINE; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_ENGINE; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); } // // Forms フォルダー // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_FORMS; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_FORMS; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); } // // Logs フォルダー // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_LOGS; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOGS; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); } // // Aa_Files.csv ファイル // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_FILES; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_ENGINE + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_FILES_CSV; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「エディター設定ファイル」の Dic に S_SP_FILES を登録します。 sValue=[" + sValue + "]"); } } goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); }
/// <summary> /// <f-set-var>読み込み。 /// </summary> /// <param name="oProjectConfigFilePath"></param> public void LoadFile( Expression_Node_Filepath ec_Fopath_Editor, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile1", log_Reports); // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「エディター設定ファイル」を読み込みます。システム変数の自動類推も行います。"); } // 「エディター・フォルダー」パス string sFopath_Editor = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Configurationtree_Node cf_Auto = null; if (log_Reports.Successful) { // // 「エディター・フォルダー」から、「Engine」「Forms」「Logs」のフォルダーパスを類推します。 // これは「エディター設定ファイル」で上書き可能です。日本語フォルダー名に置き換えることもできます。 // cf_Auto = new Configurationtree_NodeImpl("!ハードコーディング自動補完", null);//todo:親ノード } string sFpatha_AaEditorXml = ""; if (log_Reports.Successful) { // // @Editor.xml へのファイルパス。 // // 「エディター・フォルダー」パス → 「@Editor.xml ファイルパス」へ変換。 sFpatha_AaEditorXml = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML; } // // 変数の読取りを開始します。 // Exception err_Exception; if (log_Reports.Successful) { XmlDocument xDoc = new XmlDocument(); try { // 正常時 xDoc.Load(sFpatha_AaEditorXml); // ルート要素を取得 XmlElement xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(エディター設定ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(sFpatha_AaEditorXml, null), NamesNode.S_CODEFILE_EDITOR ); //<f-set-var>要素を列挙 System.Xml.XmlNodeList xNl_Fsetvar = xRoot.GetElementsByTagName(NamesNode.S_F_SET_VAR); for (int nIndex_Fsetvar = 0; nIndex_Fsetvar < xNl_Fsetvar.Count; nIndex_Fsetvar++) { XmlNode xNode_Fsetvar = xNl_Fsetvar.Item(nIndex_Fsetvar); if (XmlNodeType.Element == xNode_Fsetvar.NodeType) { // <f-set-var>要素 XmlElement x_Fsetvar = (XmlElement)xNode_Fsetvar; Configurationtree_NodeImpl s_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, null);//todo:親ノード string sNamevar = x_Fsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute); string sFolder = x_Fsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute); string sValue = x_Fsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute); string sDescription = x_Fsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports); this.MemoryAaeditorxml_Editor.Dictionary_Fsetvar_Configurationtree.List_Child.Add(s_Fsetvar, log_Reports); } } } catch (System.IO.DirectoryNotFoundException ex) { // エラー err_Exception = ex; goto gt_Error_DirectoryNotFound; } catch (System.Exception ex) { // エラー err_Exception = ex; goto gt_Error_Exception; } // // 変数の読取りは終わった。 // } // // @Editor.xml へのファイルパス。 // if (log_Reports.Successful) { // 「エディター・フォルダー」パス → 「@Editor.xml ファイルパス」へ変換。 string sFpath_EditorXml = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML; this.cur_Configurationtree = new Configurationtree_NodeImpl("(L09Mid読取)", ec_Fopath_Editor.Cur_Configuration); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_DirectoryNotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー111!", log_Method); StringBuilder s = new StringBuilder(); s.Append("指定されたファイルパスを読み取れませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("『エディター設定ファイル』読み取り中。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: ファイルパスを確認してください。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // // ヒント s.Append(err_Exception.Message); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー112!", log_Method); StringBuilder s = new StringBuilder(); s.Append("『エディター設定ファイル』読み取り中に、何らかのエラーが発生しました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: XMLのencoding指定が間違っている?この読取プログラムの期待するエンコードでないかも?"); s.Append(Environment.NewLine); s.Append("もしかして?: それ以外の理由?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // // ヒント s.Append(err_Exception.Message); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// フォルダー絶対パスを指定すると、そのフォルダーパスを切り落とした文字列を返します。 /// /// 違うフォルダーだった場合、失敗します。 /// /// 先頭がディレクトリー区切り文字にならないようにして結果を返します。 /// </summary> /// <param name="folerpath"></param> public void TryCutFolderpath( out string out_Filepath_New, Expression_Node_Filepath folderpath, bool isRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TryCutFolderpath", log_Reports); //まず、自分の絶対パス string my = this.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //if(log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("my=[" + my + "]"); //} //指定されたフォルダーの絶対パス string you = folderpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("you=[" + you + "]"); //} //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("my.StartsWith(you)=[" + my.StartsWith(you) + "]"); //} if (my.StartsWith(you)) { out_Filepath_New = my.Substring(you.Length); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("you.Length=[" + you.Length + "]"); // log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1 + "]"); // log_Method.WriteDebug_ToConsole("filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())=[" + filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) + "]"); // if (filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) // { // log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1.Substring(1) + "]"); // } //} // 先頭がディレクトリー区切り文字だった場合、それを切り捨てます。 if (out_Filepath_New.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { out_Filepath_New = out_Filepath_New.Substring(1); } //Configurationtree_NodeFilepath filepath_Conf_New = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null); //filepath_Conf_New.InitPath(filepath_New1, log_Reports); //out_Filepath_ExprNew = new Expression_Node_FilepathImpl(filepath_Conf_New); } else { //失敗 out_Filepath_New = ""; if (isRequired) { // エラー。 goto gt_Error_Failure; } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_Failure: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー922!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ファイルパスの加工に失敗しました。\n"); s.Append("[" + my + "]の頭から、フォルダー[" + you + "]を切りぬこうとしましたが、フォルダーが違いました。"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// Aa_Files.xmlの「FOLDER」「FILE」列を読取ります。 /// </summary> /// <param name="ec_Fpath"></param> /// <param name="sTableNameToPuts"></param> /// <param name="sFpatha_Aafiles"></param> /// <param name="dataRow"></param> /// <param name="o_IndexTable"></param> /// <param name="log_Reports"></param> private void Read_Folder_File( out Expression_Node_Filepath ec_Fpath, string sTableNameToPuts, string sFpatha_Aafiles, DataRow dataRow, Table_Humaninput o_IndexTable, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Read_Folder_File",log_Reports); string sFpath;//バックアップ用に使い回す文字列。 ec_Fpath = null;//セットパス用に使い回す。 { // // フォルダー変数の指定の有無 // string sNamevarFolder; { string sFieldName2 = NamesFld.S_FOLDER; if (String_HumaninputImpl.TryParse( dataRow[sFieldName2], out sNamevarFolder, o_IndexTable.Name, sFieldName2, log_Method, log_Reports)) { // 正常、スルー。 } else { sNamevarFolder = ""; } } // テーブルのファイルのパスを取得 string sName_Field = NamesFld.S_FILE; if (String_HumaninputImpl.TryParse( dataRow[sName_Field], out sFpath, o_IndexTable.Name, sName_Field, log_Method, log_Reports)) { if ("" != sNamevarFolder.Trim()) { // FOLDER列に、変数名が指定されているとき。 Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sNamevarFolder.Trim(), null, new Configurationtree_NodeImpl(o_IndexTable.Name, null));//todo: log_Reports.Log_Callstack.Push(log_Method, "③"); Expression_Node_Filepath ec_Fopath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Namevar_Folder, true, log_Reports); log_Reports.Log_Callstack.Pop(log_Method, "③"); if (null == ec_Fopath) { goto gt_Error_NullFolder; } //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole(".csvのFOLDER列に[" + sNamevarFolder + "]と指定されていました。"); //} log_Reports.Log_Callstack.Push(log_Method, "⑧"); //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返す?? string sFopath2 = ec_Fopath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if ("" == sFopath2) { //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返すようなので、入力値をそのまま返すことにした。 sFopath2 = ec_Fopath.Humaninput.Trim(); } log_Reports.Log_Callstack.Pop(log_Method, "⑧"); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("[" + sNamevarFolder + "]変数の内容は["+sFopath2+"]"); // //this.Owner_MemoryApplication.MemoryVariables.WriteDebug_ToConsole(); //} // 「フォルダー」 + 「¥」 + 「相対パス」 sFpath = sFopath2 + System.IO.Path.DirectorySeparatorChar + sFpath; } } // // ファイルパス // Configurationtree_NodeFilepath cf_Fpath1; { StringBuilder s = new StringBuilder(); s.Append("L11_1["); s.Append(NamesFile.S_AA_FILES_CSV); s.Append("ファイルの"); s.Append(sTableNameToPuts); s.Append("指定="); s.Append(sFpath); s.Append("]"); cf_Fpath1 = new Configurationtree_NodeFilepathImpl(s.ToString(), null); //cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L11_1", new Configurationtree_NodeImpl(s.ToString(), null)); } cf_Fpath1.InitPath(sFpath, log_Reports); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath1); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullFolder: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110009;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
/// <summary> /// (17)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。 /// </summary> /// <param name="sender"></param> /// <param name="eventMonitor_Dammy"></param> /// <param name="log_Reports"></param> protected virtual void On_P17a_PreviousBackup( object sender, MemoryAaeditorxml_Editor 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(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "On_P17a_PreviousOpenWindow_Backup",log_Reports); // // // //(6)バックアップ・フォルダーのオーナー名。例えば aaa なら、2009年12月3日のフォルダー名は 20091203_aaa になります。 // // // if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryBackup.Configurationtree_Name_SubFolder = moAaeditorxml_Editor.Dictionary_Fsetvar_Configurationtree.GetFsetvar( NamesVar.S_SS_BACKUP_NAME_MY_FOLDER, false, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } // // // //(7)取り置きするバックアップ・フォルダーの数。1日1回バックアップを取っているのなら、10 に設定すれば、10日分のバックアップが取り置きされることになります。 // // // if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryBackup.Configurationtree_BackupKeptbackups = moAaeditorxml_Editor.Dictionary_Fsetvar_Configurationtree.GetFsetvar( NamesVar.S_SI_BACKUP_KEPT_BACKUPS, false, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } // // // // バックアップ・フォルダー ファイルパス有無チェック。 // // // if (log_Reports.Successful) { XenonNameImpl o_Name_Variable = new XenonNameImpl(NamesVar.S_SP_BACKUP_FOLDER, new Configurationtree_NodeImpl("!ハードコーディング_ExAction00022#", null)); // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(null, o_Name_Variable.Cur_Configuration); ec_Atom.SetString( o_Name_Variable.SValue, log_Reports ); // ファイルパス。 log_Reports.Log_Callstack.Push(log_Method, "①"); Expression_Node_Filepath ec_Fpath_Exports = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Atom, true, log_Reports ); log_Reports.Log_Callstack.Pop(log_Method, "①"); this.TestExists_EmptyFilePath( "BackupBaseDirectory", ec_Fpath_Exports, ec_Fpath_AaEditorXml.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports ); } // // // // バックアップ数 文字列有無チェック。 // // // if (log_Reports.Successful) { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_BackupKeptbackups; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); this.TestExists_String( "DateBackupKeptbackups", sValue, ec_Fpath_AaEditorXml.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports ); } // // // // バックアップ・フォルダー名 文字列有無チェック。 // // // if (log_Reports.Successful) { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_Name_SubFolder; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); this.TestExists_String( "DateBackupFolderOwnerName", sValue, ec_Fpath_AaEditorXml.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports ); } // 保管するバックアップ数(日毎) if (log_Reports.Successful) { int nBackups; { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_BackupKeptbackups; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); if (!int.TryParse(sValue, out nBackups)) { // エラー。 this.Owner_MemoryApplication.MemoryBackup.BackupKeptbackups = 0; } else { this.Owner_MemoryApplication.MemoryBackup.BackupKeptbackups = nBackups; } } // バックアップ・フォルダーのサブ名。例えば aaa なら、2009年12月3日のフォルダー名は 20091203_aaa になります。 { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_Name_SubFolder; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); this.Owner_MemoryApplication.MemoryBackup.Name_SubFolder = sValue; } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── protected void TestExists_EmptyFilePath( string sArgName, Expression_Node_Filepath ec_Fpath, string sFpath_SelectedProject, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "TestExists_EmptyFilePath",log_Reports); // // if (null == ec_Fpath) { goto gt_Error_NullFpath; } else if ("" == ec_Fpath.Humaninput) { goto gt_Error_NoData; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullFpath: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFpath_SelectedProject, log_Reports);//選択したエディター・フォルダーのファイルパス tmpl.SetParameter(2, sArgName, log_Reports);//引数名 this.Owner_MemoryApplication.CreateErrorReport("Er:110005;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoData: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sArgName, log_Reports);//引数名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Fpath.Cur_Configuration), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110006;", tmpl, log_Reports); } 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> /// 指定のフィールド名だけに絞り込んだサブテーブルを作って返します。 /// </summary> /// <param name="sFieldNameList"></param> /// <returns></returns> public static Table_Humaninput CreateSubTableBySelect( string name_NewTable, List <string> list_Src_SNewFieldName, Expression_Node_Filepath expr_Fpath_NewTable, EnumLogic enumWhereLogic, List <Recordcondition> list_Reccond, Table_Humaninput src_XenonTable, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "CreateSubTableBySelect", log_Reports); // // // // Table_Humaninput tableH_New = new Table_HumaninputImpl( name_NewTable, expr_Fpath_NewTable, expr_Fpath_NewTable.Cur_Configuration); RecordFielddefinition recordFielddefinigion_New; List <List <string> > sFieldListList; Utility_Table.SelectFieldListList( out sFieldListList, out recordFielddefinigion_New, enumWhereLogic, list_Src_SNewFieldName, list_Reccond, src_XenonTable, log_Reports ); // // 新しいテーブルを作成します。(列定義の追加) // tableH_New.CreateTable(recordFielddefinigion_New, log_Reports); if (tableH_New.DataTable.Columns.Count < 1) { // エラー。 goto gt_Error_ZeroField; } else if (tableH_New.RecordFielddefinition.Count < 1) { // エラー。 goto gt_Error_ZeroFieldDef; } // 不要なレコードを除去して絞り込んだ後で、 // レコード追加。 { tableH_New.AddRecordList(sFieldListList, recordFielddefinigion_New, log_Reports); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_ZeroField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー471!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append(" フィールドが0件のテーブルを作ることはできません。newFldDefList=["); t.Append(recordFielddefinigion_New.Count); t.Append("]"); t.Newline(); t.Newline(); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_ZeroFieldDef: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー472!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append(" フィールド定義が0件のテーブルを作ることはできません。o_NewTable.FieldDefinitions.Count=["); t.Append(tableH_New.RecordFielddefinition.Count); t.Append("]"); t.Newline(); t.Newline(); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(tableH_New); }
//──────────────────────────────────────── /// <summary> /// 『ユーザー定義関数設定ファイル(Fnc)』を読み取ります。 /// </summary> public void LoadFile( Expression_Node_Filepath filepath_Userfunctionconfig_Expr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile", log_Reports); // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数設定ファイルの読み取り。"); } Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_FUNCTIONS, filepath_Userfunctionconfig_Expr.Cur_Configuration);//Info_OpyopyoImpl.LibraryName + ":" + this.GetType().Name + ".LoadFile_Fnc" Expression_Node_String userfunctionconfig_Expr = new Expression_Node_StringImpl(null, parent_Conf); string filepathabsolute = filepath_Userfunctionconfig_Expr.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { goto gt_Error_Fpath; } if (!System.IO.File.Exists(filepathabsolute)) { goto gt_Error_File; } XmlDocument xDoc = new XmlDocument(); Exception err_Excp = null; try { xDoc.Load(filepathabsolute); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (ArgumentException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } XmlElement xRoot = null; if (log_Reports.Successful) { // ルート要素を取得 xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(関数登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(filepathabsolute, null), NamesNode.S_CODEFILE_FUNCTIONS ); } string sErrorElementName = ""; if (log_Reports.Successful) { XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { if (NamesNode.S_COMMON_FUNCTION == xTopNode.Name) { XmlElement x_Cur = (XmlElement)xTopNode; string sNameValue = x_Cur.GetAttribute(PmNames.S_NAME.Name_Attribute); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数の追加を開始:" + sNameValue); } // XToCf XmlToConfigurationtree_C15_Elm xToCf = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_COMMON_FUNCTION, log_Reports); xToCf.XmlToConfigurationtree( x_Cur, parent_Conf, this.Owner_MemoryApplication, log_Reports ); Configurationtree_Node s_Cur = null; parent_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak) { s_Cur = s_Child; bBreak = true; }); // SToE Expression_Node_FunctionImpl ec_CommonFunction = new Expression_Node_FunctionImpl(userfunctionconfig_Expr, s_Cur, new List<string>()); Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; ConfigurationtreeToExpression_AbstractImpl.ParseChild_InAnotherLibrary( s_Cur, ec_CommonFunction, this.Owner_MemoryApplication, pg_ParsingLog, log_Reports ); if (log_Method.CanInfo() && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" d_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString()); } this.Owner_MemoryApplication.MemoryFunctions.AddFunction(sNameValue, ec_CommonFunction, log_Reports); } else { // // エラー。 sErrorElementName = xTopNode.Name; goto gt_Error_UndefinedChild; } } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Fpath: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー101!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルへのパスにエラーがありました。"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_File: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー102!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルがありません。"); s.Newline(); s.Append("file=["); s.Append(filepathabsolute); s.Append("]"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Doc: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー103!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エラー:" + err_Excp.Message); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Log_RecordReportsImpl.ToText_Configuration(filepath_Userfunctionconfig_Expr.Cur_Configuration)); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChild: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー104!", log_Method); StringBuilder s = new StringBuilder(); s.Append("未定義の要素:" + sErrorElementName); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public MemoryCodefileinfoImpl() { this.name = ""; this.typedata = ""; this.expression_Filepath = new Expression_Node_FilepathImpl(new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_7", null));//todo: }
//──────────────────────────────────────── /// <summary> /// フォルダー絶対パスを指定すると、そのフォルダーパスを切り落とした文字列を返します。 /// /// 違うフォルダーだった場合、失敗します。 /// /// 先頭がディレクトリー区切り文字にならないようにして結果を返します。 /// </summary> /// <param name="folerpath"></param> public void TryCutFolderpath( out string out_Filepath_New, Expression_Node_Filepath folderpath, bool isRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TryCutFolderpath", log_Reports); //まず、自分の絶対パス string my = this.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //if(log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("my=[" + my + "]"); //} //指定されたフォルダーの絶対パス string you = folderpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("you=[" + you + "]"); //} //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("my.StartsWith(you)=[" + my.StartsWith(you) + "]"); //} if (my.StartsWith(you)) { out_Filepath_New = my.Substring(you.Length); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("you.Length=[" + you.Length + "]"); // log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1 + "]"); // log_Method.WriteDebug_ToConsole("filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())=[" + filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) + "]"); // if (filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) // { // log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1.Substring(1) + "]"); // } //} // 先頭がディレクトリー区切り文字だった場合、それを切り捨てます。 if (out_Filepath_New.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { out_Filepath_New = out_Filepath_New.Substring(1); } //Configurationtree_NodeFilepath filepath_Conf_New = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null); //filepath_Conf_New.InitPath(filepath_New1, log_Reports); //out_Filepath_ExprNew = new Expression_Node_FilepathImpl(filepath_Conf_New); } else { //失敗 out_Filepath_New = ""; if (isRequired) { // エラー。 goto gt_Error_Failure; } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_Failure: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー922!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ファイルパスの加工に失敗しました。\n"); s.Append("[" + my + "]の頭から、フォルダー[" + you + "]を切りぬこうとしましたが、フォルダーが違いました。"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// ファイル読み込み。 /// </summary> /// <param name="ec_Fpath_Aatoolxml"></param> public void LoadFile( Expression_Node_Filepath ec_Fpath_Aatoolxml, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile",log_Reports); // Exception err_Excp; string sFpatha_Aatoolxml = ""; if (log_Reports.Successful) { // // 『ツール設定』をクリアー。 // this.Clear(this.Owner_MemoryApplication); sFpatha_Aatoolxml = ec_Fpath_Aatoolxml.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports );//絶対ファイルパス } if (log_Reports.Successful) { XmlDocument xDoc = new XmlDocument(); try { // 正常時 xDoc.Load(sFpatha_Aatoolxml); // ルート要素を取得 XmlElement xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(バリデーター登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(sFpatha_Aatoolxml, null), NamesNode.S_CODEFILE_TOOL ); if (log_Reports.Successful) { // デフォルト・エディター名 this.Name_DefaultEditor = xRoot.GetAttribute(PmNames.S_DEFAULT_EDITOR.Name_Attribute); // エディター要素を列挙 System.Xml.XmlNodeList xNl_Editor = xRoot.GetElementsByTagName(NamesNode.S_EDITOR); foreach (XmlNode x_EditorNode in xNl_Editor) { if (XmlNodeType.Element == x_EditorNode.NodeType) { // // エディター要素 // MemoryAatoolxml_Editor aatool_Editor = new MemoryAatoolxml_EditorImpl(this.cur_Configuration); // // エディター要素 // XmlElement xEditor = (XmlElement)x_EditorNode; // ツール設定ファイルに記載されている、エディター名 try { aatool_Editor.Name = xEditor.GetAttribute(PmNames.S_NAME.Name_Attribute); this.Dictionary_Editor.Dictionary_Item.Add(aatool_Editor.Name, aatool_Editor); } catch (ArgumentException ex) { err_Excp = ex; goto gt_Error_DuplicatedEditorName; } // <f-set-var>要素を列挙 System.Xml.XmlNodeList xNl_Fsetvar = xEditor.GetElementsByTagName(NamesNode.S_F_SET_VAR); for (int nIndex_Fsetvar = 0; nIndex_Fsetvar < xNl_Fsetvar.Count; nIndex_Fsetvar++) { XmlNode xNode_Fsetvar = xNl_Fsetvar.Item(nIndex_Fsetvar); if (XmlNodeType.Element == xNode_Fsetvar.NodeType) { //<f-set-var>要素 Configurationtree_Node cf_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, ec_Fpath_Aatoolxml.Cur_Configuration); //<f-set-var>要素 XmlElement xFsetvar = (XmlElement)xNode_Fsetvar; string sNamevar = xFsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute); string sFolder = xFsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute); string sValue = xFsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute); string sDescription = xFsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports); cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports); aatool_Editor.Dictionary_Fsetvar_Configurationtree.List_Child.Add(cf_Fsetvar, log_Reports); } } } } } } catch (System.IO.FileNotFoundException ex) { err_Excp = ex; goto gt_Error_NothingFile; } catch (System.Exception ex) { err_Excp = ex; goto gt_Error_Exception; } } if (log_Reports.Successful) { this.cur_Configuration = ec_Fpath_Aatoolxml.Cur_Configuration; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_DuplicatedEditorName: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー204!", log_Method); StringBuilder s = new StringBuilder(); s.Append("『ツール設定ファイル』(tool config)読み取り中に、何らかのエラーが発生しました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: <" + NamesNode.S_EDITOR + ">要素の" + PmNames.S_NAME.Name_Attribute + "属性が重複している?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // 例外メッセージ s.Append(r.Message_SException(err_Excp)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NothingFile: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, ValuesAttr.S_FPATHR_AATOOLXML,log_Reports); tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp),log_Reports); this.Owner_MemoryApplication.CreateErrorReport( "Er:1;", tmpl, log_Reports ); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー203!", log_Method); StringBuilder s = new StringBuilder(); s.Append("『ツール設定ファイル』(tool config)読み取り中に、何らかのエラーが発生しました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: XMLのencoding指定が間違っている?この読取プログラムの期待するエンコードでないかも?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // // 例外メッセージ s.Append(r.Message_SException(err_Excp)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── /// <summary> /// Aa_Files.xmlの「FOLDER」「FILE」列を読取ります。 /// </summary> /// <param name="ec_Fpath"></param> /// <param name="sTableNameToPuts"></param> /// <param name="sFpatha_Aafiles"></param> /// <param name="dataRow"></param> /// <param name="o_IndexTable"></param> /// <param name="log_Reports"></param> private void Read_Folder_File( out Expression_Node_Filepath ec_Fpath, string sTableNameToPuts, string sFpatha_Aafiles, DataRow dataRow, Table_Humaninput o_IndexTable, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Read_Folder_File", log_Reports); string sFpath; //バックアップ用に使い回す文字列。 ec_Fpath = null; //セットパス用に使い回す。 { // // フォルダー変数の指定の有無 // string sNamevarFolder; { string sFieldName2 = NamesFld.S_FOLDER; if (String_HumaninputImpl.TryParse( dataRow[sFieldName2], out sNamevarFolder, o_IndexTable.Name, sFieldName2, log_Method, log_Reports)) { // 正常、スルー。 } else { sNamevarFolder = ""; } } // テーブルのファイルのパスを取得 string sName_Field = NamesFld.S_FILE; if (String_HumaninputImpl.TryParse( dataRow[sName_Field], out sFpath, o_IndexTable.Name, sName_Field, log_Method, log_Reports)) { if ("" != sNamevarFolder.Trim()) { // FOLDER列に、変数名が指定されているとき。 Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sNamevarFolder.Trim(), null, new Configurationtree_NodeImpl(o_IndexTable.Name, null));//todo: log_Reports.Log_Callstack.Push(log_Method, "③"); Expression_Node_Filepath ec_Fopath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Namevar_Folder, true, log_Reports); log_Reports.Log_Callstack.Pop(log_Method, "③"); if (null == ec_Fopath) { goto gt_Error_NullFolder; } //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole(".csvのFOLDER列に[" + sNamevarFolder + "]と指定されていました。"); //} log_Reports.Log_Callstack.Push(log_Method, "⑧"); //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返す?? string sFopath2 = ec_Fopath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if ("" == sFopath2) { //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返すようなので、入力値をそのまま返すことにした。 sFopath2 = ec_Fopath.Humaninput.Trim(); } log_Reports.Log_Callstack.Pop(log_Method, "⑧"); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("[" + sNamevarFolder + "]変数の内容は["+sFopath2+"]"); // //this.Owner_MemoryApplication.MemoryVariables.WriteDebug_ToConsole(); //} // 「フォルダー」 + 「¥」 + 「相対パス」 sFpath = sFopath2 + System.IO.Path.DirectorySeparatorChar + sFpath; } } // // ファイルパス // Configurationtree_NodeFilepath cf_Fpath1; { StringBuilder s = new StringBuilder(); s.Append("L11_1["); s.Append(NamesFile.S_AA_FILES_CSV); s.Append("ファイルの"); s.Append(sTableNameToPuts); s.Append("指定="); s.Append(sFpath); s.Append("]"); cf_Fpath1 = new Configurationtree_NodeFilepathImpl(s.ToString(), null); //cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L11_1", new Configurationtree_NodeImpl(s.ToString(), null)); } cf_Fpath1.InitPath(sFpath, log_Reports); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath1); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullFolder: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110009;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public string GetSFilepath_UsercontrolconfigAbsolute( Expression_Node_Filepath ec_Fpath_Fcnf, Expression_Node_Filepath ec_Fopath_Forms, Log_Reports log_Reports ) { string sFpatha_Fcnf; // // forms フォルダー // string sFopatha_Forms = ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } // // Fcnf 絶対ファイルパス // if (log_Reports.Successful) { // 正常時 Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("formsフォルダーパス+コンポーネント設定ファイルパス", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L08_1", parent_Cf); cf_Fpath.InitPath( sFopatha_Forms, ec_Fpath_Fcnf.Humaninput, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } Expression_Node_Filepath ec_Fpatha_Fcnf = new Expression_Node_FilepathImpl(cf_Fpath); sFpatha_Fcnf = ec_Fpatha_Fcnf.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } } else { // エラー sFpatha_Fcnf = ""; } goto gt_EndMethod; // // gt_EndMethod: return(sFpatha_Fcnf); }
//──────────────────────────────────────── /// <summary> /// 指定のフィールド名だけに絞り込んだサブテーブルを作って返します。 /// </summary> /// <param name="sFieldNameList"></param> /// <returns></returns> public static Table_Humaninput CreateSubTableBySelect( string name_NewTable, List<string> list_Src_SNewFieldName, Expression_Node_Filepath expr_Fpath_NewTable, EnumLogic enumWhereLogic, List<Recordcondition> list_Reccond, Table_Humaninput src_XenonTable, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "CreateSubTableBySelect",log_Reports); // // // // Table_Humaninput tableH_New = new Table_HumaninputImpl( name_NewTable, expr_Fpath_NewTable, expr_Fpath_NewTable.Cur_Configuration); RecordFielddefinition recordFielddefinigion_New; List<List<string>> sFieldListList; Utility_Table.SelectFieldListList( out sFieldListList, out recordFielddefinigion_New, enumWhereLogic, list_Src_SNewFieldName, list_Reccond, src_XenonTable, log_Reports ); // // 新しいテーブルを作成します。(列定義の追加) // tableH_New.CreateTable(recordFielddefinigion_New, log_Reports); if (tableH_New.DataTable.Columns.Count < 1) { // エラー。 goto gt_Error_ZeroField; } else if (tableH_New.RecordFielddefinition.Count < 1) { // エラー。 goto gt_Error_ZeroFieldDef; } // 不要なレコードを除去して絞り込んだ後で、 // レコード追加。 { tableH_New.AddRecordList(sFieldListList, recordFielddefinigion_New, log_Reports); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_ZeroField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー471!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append(" フィールドが0件のテーブルを作ることはできません。newFldDefList=["); t.Append(recordFielddefinigion_New.Count); t.Append("]"); t.Newline(); t.Newline(); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_ZeroFieldDef: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー472!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append(" フィールド定義が0件のテーブルを作ることはできません。o_NewTable.FieldDefinitions.Count=["); t.Append(tableH_New.RecordFielddefinition.Count); t.Append("]"); t.Newline(); t.Newline(); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return tableH_New; }
/// <summary> /// (17)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。 /// </summary> /// <param name="sender"></param> /// <param name="eventMonitor_Dammy"></param> /// <param name="log_Reports"></param> protected virtual void On_P17a_PreviousBackup( object sender, MemoryAaeditorxml_Editor 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(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "On_P17a_PreviousOpenWindow_Backup", log_Reports); // // // //(6)バックアップ・フォルダーのオーナー名。例えば aaa なら、2009年12月3日のフォルダー名は 20091203_aaa になります。 // // // if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryBackup.Configurationtree_Name_SubFolder = moAaeditorxml_Editor.Dictionary_Fsetvar_Configurationtree.GetFsetvar( NamesVar.S_SS_BACKUP_NAME_MY_FOLDER, false, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } // // // //(7)取り置きするバックアップ・フォルダーの数。1日1回バックアップを取っているのなら、10 に設定すれば、10日分のバックアップが取り置きされることになります。 // // // if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryBackup.Configurationtree_BackupKeptbackups = moAaeditorxml_Editor.Dictionary_Fsetvar_Configurationtree.GetFsetvar( NamesVar.S_SI_BACKUP_KEPT_BACKUPS, false, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } // // // // バックアップ・フォルダー ファイルパス有無チェック。 // // // if (log_Reports.Successful) { XenonNameImpl o_Name_Variable = new XenonNameImpl(NamesVar.S_SP_BACKUP_FOLDER, new Configurationtree_NodeImpl("!ハードコーディング_ExAction00022#", null)); // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(null, o_Name_Variable.Cur_Configuration); ec_Atom.SetString( o_Name_Variable.SValue, log_Reports ); // ファイルパス。 log_Reports.Log_Callstack.Push(log_Method, "①"); Expression_Node_Filepath ec_Fpath_Exports = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Atom, true, log_Reports ); log_Reports.Log_Callstack.Pop(log_Method, "①"); this.TestExists_EmptyFilePath( "BackupBaseDirectory", ec_Fpath_Exports, ec_Fpath_AaEditorXml.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports ); } // // // // バックアップ数 文字列有無チェック。 // // // if (log_Reports.Successful) { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_BackupKeptbackups; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); this.TestExists_String( "DateBackupKeptbackups", sValue, ec_Fpath_AaEditorXml.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports ); } // // // // バックアップ・フォルダー名 文字列有無チェック。 // // // if (log_Reports.Successful) { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_Name_SubFolder; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); this.TestExists_String( "DateBackupFolderOwnerName", sValue, ec_Fpath_AaEditorXml.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports ); } // 保管するバックアップ数(日毎) if (log_Reports.Successful) { int nBackups; { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_BackupKeptbackups; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); if (!int.TryParse(sValue, out nBackups)) { // エラー。 this.Owner_MemoryApplication.MemoryBackup.BackupKeptbackups = 0; } else { this.Owner_MemoryApplication.MemoryBackup.BackupKeptbackups = nBackups; } } // バックアップ・フォルダーのサブ名。例えば aaa なら、2009年12月3日のフォルダー名は 20091203_aaa になります。 { Configurationtree_Node cf_Fsetvar = this.Owner_MemoryApplication.MemoryBackup.Configurationtree_Name_SubFolder; string sValue; cf_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); this.Owner_MemoryApplication.MemoryBackup.Name_SubFolder = sValue; } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public string GetSFilepath_UsercontrolconfigAbsolute( Expression_Node_Filepath ec_Fpath_Fcnf, Expression_Node_Filepath ec_Fopath_Forms, Log_Reports log_Reports ) { string sFpatha_Fcnf; // // forms フォルダー // string sFopatha_Forms = ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } // // Fcnf 絶対ファイルパス // if (log_Reports.Successful) { // 正常時 Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("formsフォルダーパス+コンポーネント設定ファイルパス", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L08_1", parent_Cf); cf_Fpath.InitPath( sFopatha_Forms, ec_Fpath_Fcnf.Humaninput, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } Expression_Node_Filepath ec_Fpatha_Fcnf = new Expression_Node_FilepathImpl(cf_Fpath); sFpatha_Fcnf = ec_Fpatha_Fcnf.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 sFpatha_Fcnf = ""; goto gt_EndMethod; } } else { // エラー sFpatha_Fcnf = ""; } goto gt_EndMethod; // // gt_EndMethod: return sFpatha_Fcnf; }
//──────────────────────────────────────── /// <summary> /// 一覧系のテーブルの行を読み取り、テーブルを読み取る要求を作成します。 /// </summary> /// <param name="dataRow"></param> /// <param name="o_IndexTable"></param> /// <param name="log_Reports"></param> /// <returns></returns> private Request_ReadsTable CreateReadRequest( DataRow dataRow, Table_Humaninput o_Table_Aafiles, Log_Reports log_Reports ) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(1); log_Method.BeginMethod(Info_Functions.Name_Library, this, "CreateReadRequest", log_Reports); // // Request_ReadsTable forTable_request = new Request_ReadsTableImpl(); // // 「インデックス_テーブル」の絶対ファイルパス Expression_Node_Filepath ec_Fpath_Aafilescsv = o_Table_Aafiles.Expression_Filepath_ConfigStack; string sFpatha_Aafilescsv = ec_Fpath_Aafilescsv.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("「Aa_Files.csv」のファイルパス=[" + sFpatha_Aafilescsv + "]"); //} if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } // // テーブル名 { string sName_Field = NamesFld.S_NAME; string sTableName; if (String_HumaninputImpl.TryParse( dataRow[sName_Field], out sTableName, o_Table_Aafiles.Name, sName_Field, log_Method, log_Reports)) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } forTable_request.Name_PutToTable = sTableName; } // // フォーム名 { string sName_Field = NamesFld.S_NAME_FORM; string sTableUnit; if (dataRow.Table.Columns.Contains(sName_Field)) { bool bBool = String_HumaninputImpl.TryParse( dataRow[sName_Field], out sTableUnit, o_Table_Aafiles.Name, sName_Field, log_Method, log_Reports); if (bBool) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } else { sTableUnit = ""; } forTable_request.Tableunit = sTableUnit; } // // データ・タイプです。 { string sName_Field = NamesFld.S_TYPE_DATA; string sValue; if (dataRow.Table.Columns.Contains(sName_Field)) { if (String_HumaninputImpl.TryParse( dataRow[sName_Field], out sValue, o_Table_Aafiles.Name, sName_Field, log_Method, log_Reports)) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } else { sValue = ""; } forTable_request.Typedata = sValue; } // // テーブルのファイルパス // Expression_Node_Filepath ec_Fpath; { this.Read_Folder_File( out ec_Fpath, forTable_request.Name_PutToTable, sFpatha_Aafilescsv, dataRow, o_Table_Aafiles, log_Reports ); if (log_Reports.Successful) { forTable_request.Expression_Filepath = ec_Fpath; } } // // ファイルパスを変数にセット // { string sName_Field = NamesFld.S_SET_VAR_PATH; string sNamevar; if (dataRow.Table.Columns.Contains(sName_Field)) { if (String_HumaninputImpl.TryParse( dataRow[sName_Field], out sNamevar, o_Table_Aafiles.Name, sName_Field, log_Method, log_Reports)) { } if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } else { sNamevar = ""; } if ("" != sNamevar && null != ec_Fpath) { // 指定があれば、ファイルパスを変数にセット。 this.Owner_MemoryApplication.MemoryVariables.SetFilepathValue( sNamevar, ec_Fpath, false, log_Reports); } } // // 「日別バックアップ」するなら真。 // { string sName_Field = NamesFld.S_DATE_BACKUP; bool bDateBackup; if (dataRow.Table.Columns.Contains(sName_Field)) { bool bParsedSuccessful = Bool_HumaninputImpl.TryParse( dataRow[sName_Field], out bDateBackup, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, false, log_Reports ); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } if (bParsedSuccessful) { } } else { bDateBackup = false; } forTable_request.IsDatebackupActivated = bDateBackup; } // // 用途。/「」指定なし。/「WriteOnly」データの読取を行わない。ログ出力先を登録しているだけなど。 // { string sName_Field = NamesFld.S_USE; string sField; if (dataRow.Table.Columns.Contains(sName_Field)) { bool bParsedSuccessful = String_HumaninputImpl.TryParse( dataRow[sName_Field], out sField, o_Table_Aafiles.Name, sName_Field, log_Method, log_Reports ); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } if (bParsedSuccessful) { } } else { sField = "";//指定なし。 } forTable_request.Use = sField; } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(forTable_request); }
//──────────────────────────────────────── /// <summary> /// 「.xml」(Fcnf)ファイルの、<control>要素の、oNodeName(コントロール名)のリスト。記述順。 /// </summary> /// <returns></returns> public List<string> GetList_NameControl( string sName_Control, string sHiFpath_ControlFile, string sFpatha_Fcnf, Configurationtree_Node cf_FcConfig, Expression_Node_Filepath ec_Fopath_Forms, MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "GetList_NameControl", log_Reports); // // XmlDocument xDoc = null; List<string> sList = new List<string>(); Exception err_Excp = null; if (log_Reports.Successful) { // 正常時 xDoc = new System.Xml.XmlDocument(); try { xDoc.Load(sFpatha_Fcnf); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_IoException; } catch (System.Xml.XmlException ex) { // // エラー。 err_Excp = ex; goto gt_Error_XmlException01; } } XmlElement xError = null; if (log_Reports.Successful) { // 正常時 try { // // コントロール自体は、Aa_Forms.csvを読み取って // 既に追加済みです。 // // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // // <control>要素を読取 // if (NamesNode.S_CONTROL1 == xRoot.Name) { // ルート要素が<control> // コントロール名をリストに追加。 sList.Add(sName_Control); } else { // // <control>要素を列挙 // XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { XmlElement xTop = (XmlElement)xTopNode; if (NamesNode.S_CONTROL1 == xTop.Name) { // コントロール名をリストに追加。 sList.Add(sName_Control); } else { // // エラー。 xError = xTop; goto gt_Error_UndefinedChildElement; } } } } } catch (System.Xml.XmlException ex) { // // エラー。 err_Excp = ex; goto gt_Error_XmlException02; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_IoException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports);//コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//Formsフォルダーパス tmpl.SetParameter(3, sHiFpath_ControlFile, log_Reports);//コントロール設定ファイルパス(入力ママ) tmpl.SetParameter(4, sFpatha_Fcnf, log_Reports);//コントロール設定ファイルパス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:8004;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_XmlException01: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:8005;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChildElement: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CONTROL1, log_Reports);//期待するノード名 tmpl.SetParameter(2, xError.Name, log_Reports);//含まれていたノード名 memoryApplication.CreateErrorReport("Er:8006;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_XmlException02: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:8007;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return sList; }
/// <summary> /// <f-set-var>読み込み。 /// </summary> /// <param name="oProjectConfigFilePath"></param> public void LoadFile( Expression_Node_Filepath ec_Fopath_Editor, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile1",log_Reports); // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「エディター設定ファイル」を読み込みます。システム変数の自動類推も行います。"); } // 「エディター・フォルダー」パス string sFopath_Editor = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Configurationtree_Node cf_Auto = null; if (log_Reports.Successful) { // // 「エディター・フォルダー」から、「Engine」「Forms」「Logs」のフォルダーパスを類推します。 // これは「エディター設定ファイル」で上書き可能です。日本語フォルダー名に置き換えることもできます。 // cf_Auto = new Configurationtree_NodeImpl("!ハードコーディング自動補完", null);//todo:親ノード } string sFpatha_AaEditorXml = ""; if (log_Reports.Successful) { // // @Editor.xml へのファイルパス。 // // 「エディター・フォルダー」パス → 「@Editor.xml ファイルパス」へ変換。 sFpatha_AaEditorXml = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML; } // // 変数の読取りを開始します。 // Exception err_Exception; if (log_Reports.Successful) { XmlDocument xDoc = new XmlDocument(); try { // 正常時 xDoc.Load(sFpatha_AaEditorXml); // ルート要素を取得 XmlElement xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(エディター設定ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(sFpatha_AaEditorXml, null), NamesNode.S_CODEFILE_EDITOR ); //<f-set-var>要素を列挙 System.Xml.XmlNodeList xNl_Fsetvar = xRoot.GetElementsByTagName(NamesNode.S_F_SET_VAR); for (int nIndex_Fsetvar = 0; nIndex_Fsetvar < xNl_Fsetvar.Count; nIndex_Fsetvar++) { XmlNode xNode_Fsetvar = xNl_Fsetvar.Item(nIndex_Fsetvar); if (XmlNodeType.Element == xNode_Fsetvar.NodeType) { // <f-set-var>要素 XmlElement x_Fsetvar = (XmlElement)xNode_Fsetvar; Configurationtree_NodeImpl s_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, null);//todo:親ノード string sNamevar = x_Fsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute); string sFolder = x_Fsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute); string sValue = x_Fsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute); string sDescription = x_Fsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports); s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports); this.MemoryAaeditorxml_Editor.Dictionary_Fsetvar_Configurationtree.List_Child.Add(s_Fsetvar, log_Reports); } } } catch (System.IO.DirectoryNotFoundException ex) { // エラー err_Exception = ex; goto gt_Error_DirectoryNotFound; } catch (System.Exception ex) { // エラー err_Exception = ex; goto gt_Error_Exception; } // // 変数の読取りは終わった。 // } // // @Editor.xml へのファイルパス。 // if (log_Reports.Successful) { // 「エディター・フォルダー」パス → 「@Editor.xml ファイルパス」へ変換。 string sFpath_EditorXml = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML; this.cur_Configurationtree = new Configurationtree_NodeImpl("(L09Mid読取)", ec_Fopath_Editor.Cur_Configuration); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_DirectoryNotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー111!", log_Method); StringBuilder s = new StringBuilder(); s.Append("指定されたファイルパスを読み取れませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("『エディター設定ファイル』読み取り中。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: ファイルパスを確認してください。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // // ヒント s.Append(err_Exception.Message); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー112!", log_Method); StringBuilder s = new StringBuilder(); s.Append("『エディター設定ファイル』読み取り中に、何らかのエラーが発生しました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?: XMLのencoding指定が間違っている?この読取プログラムの期待するエンコードでないかも?"); s.Append(Environment.NewLine); s.Append("もしかして?: それ以外の理由?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // // ヒント s.Append(err_Exception.Message); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── /// <summary> /// システム変数を、自動類推して、自動登録します。 /// </summary> /// <param name="ec_Fopath_Editor"></param> /// <param name="log_Reports"></param> public void Load_AutoSystemVariable( Expression_Node_Filepath ec_Fopath_Editor, 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_AutoSystemVariable",log_Reports); // // // 「エディター・フォルダー」パス string sFopath_Editor = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); // // Engine フォルダー // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_ENGINE; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_ENGINE; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); } // // Forms フォルダー // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_FORMS; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_FORMS; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); } // // Logs フォルダー // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_LOGS; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOGS; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); } // // Aa_Files.csv ファイル // if (log_Reports.Successful) { string sNamevar = NamesVar.S_SP_FILES; string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_ENGINE + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_FILES_CSV; Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration); cf_Fpath.InitPath(sValue, log_Reports); this.Owner_MemoryApplication.MemoryVariables.PutFilepath( sNamevar, new Expression_Node_FilepathImpl(cf_Fpath), false,//重複登録可。 log_Reports ); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「エディター設定ファイル」の Dic に S_SP_FILES を登録します。 sValue=[" + sValue + "]"); } } goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 「.xml」(Fcnf)ファイルの、<control>要素の、oNodeName(コントロール名)のリスト。記述順。 /// </summary> /// <returns></returns> public List <string> GetList_NameControl( string sName_Control, string sHiFpath_ControlFile, string sFpatha_Fcnf, Configurationtree_Node cf_FcConfig, Expression_Node_Filepath ec_Fopath_Forms, MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "GetList_NameControl", log_Reports); // // XmlDocument xDoc = null; List <string> sList = new List <string>(); Exception err_Excp = null; if (log_Reports.Successful) { // 正常時 xDoc = new System.Xml.XmlDocument(); try { xDoc.Load(sFpatha_Fcnf); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_IoException; } catch (System.Xml.XmlException ex) { // // エラー。 err_Excp = ex; goto gt_Error_XmlException01; } } XmlElement xError = null; if (log_Reports.Successful) { // 正常時 try { // // コントロール自体は、Aa_Forms.csvを読み取って // 既に追加済みです。 // // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // // <control>要素を読取 // if (NamesNode.S_CONTROL1 == xRoot.Name) { // ルート要素が<control> // コントロール名をリストに追加。 sList.Add(sName_Control); } else { // // <control>要素を列挙 // XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { XmlElement xTop = (XmlElement)xTopNode; if (NamesNode.S_CONTROL1 == xTop.Name) { // コントロール名をリストに追加。 sList.Add(sName_Control); } else { // // エラー。 xError = xTop; goto gt_Error_UndefinedChildElement; } } } } } catch (System.Xml.XmlException ex) { // // エラー。 err_Excp = ex; goto gt_Error_XmlException02; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_IoException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports); //コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //Formsフォルダーパス tmpl.SetParameter(3, sHiFpath_ControlFile, log_Reports); //コントロール設定ファイルパス(入力ママ) tmpl.SetParameter(4, sFpatha_Fcnf, log_Reports); //コントロール設定ファイルパス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ memoryApplication.CreateErrorReport("Er:8004;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_XmlException01: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:8005;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChildElement: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CONTROL1, log_Reports); //期待するノード名 tmpl.SetParameter(2, xError.Name, log_Reports); //含まれていたノード名 memoryApplication.CreateErrorReport("Er:8006;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_XmlException02: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:8007;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(sList); }
//──────────────────────────────────────── /// <summary> /// 『ユーザー定義関数設定ファイル(Fnc)』を読み取ります。 /// </summary> public void LoadFile( Expression_Node_Filepath filepath_Userfunctionconfig_Expr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile", log_Reports); // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数設定ファイルの読み取り。"); } Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_FUNCTIONS, filepath_Userfunctionconfig_Expr.Cur_Configuration);//Info_OpyopyoImpl.LibraryName + ":" + this.GetType().Name + ".LoadFile_Fnc" Expression_Node_String userfunctionconfig_Expr = new Expression_Node_StringImpl(null, parent_Conf); string filepathabsolute = filepath_Userfunctionconfig_Expr.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { goto gt_Error_Fpath; } if (!System.IO.File.Exists(filepathabsolute)) { goto gt_Error_File; } XmlDocument xDoc = new XmlDocument(); Exception err_Excp = null; try { xDoc.Load(filepathabsolute); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (ArgumentException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } XmlElement xRoot = null; if (log_Reports.Successful) { // ルート要素を取得 xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(関数登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(filepathabsolute, null), NamesNode.S_CODEFILE_FUNCTIONS ); } string sErrorElementName = ""; if (log_Reports.Successful) { XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { if (NamesNode.S_COMMON_FUNCTION == xTopNode.Name) { XmlElement x_Cur = (XmlElement)xTopNode; string sNameValue = x_Cur.GetAttribute(PmNames.S_NAME.Name_Attribute); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数の追加を開始:" + sNameValue); } // XToCf XmlToConfigurationtree_C15_Elm xToCf = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_COMMON_FUNCTION, log_Reports); xToCf.XmlToConfigurationtree( x_Cur, parent_Conf, this.Owner_MemoryApplication, log_Reports ); Configurationtree_Node s_Cur = null; parent_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak) { s_Cur = s_Child; bBreak = true; }); // SToE Expression_Node_FunctionImpl ec_CommonFunction = new Expression_Node_FunctionImpl(userfunctionconfig_Expr, s_Cur, new List <string>()); Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; ConfigurationtreeToExpression_AbstractImpl.ParseChild_InAnotherLibrary( s_Cur, ec_CommonFunction, this.Owner_MemoryApplication, pg_ParsingLog, log_Reports ); if (log_Method.CanInfo() && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" d_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString()); } this.Owner_MemoryApplication.MemoryFunctions.AddFunction(sNameValue, ec_CommonFunction, log_Reports); } else { // // エラー。 sErrorElementName = xTopNode.Name; goto gt_Error_UndefinedChild; } } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Fpath: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー101!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルへのパスにエラーがありました。"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_File: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー102!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルがありません。"); s.Newline(); s.Append("file=["); s.Append(filepathabsolute); s.Append("]"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Doc: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー103!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エラー:" + err_Excp.Message); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Log_RecordReportsImpl.ToText_Configuration(filepath_Userfunctionconfig_Expr.Cur_Configuration)); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChild: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー104!", log_Method); StringBuilder s = new StringBuilder(); s.Append("未定義の要素:" + sErrorElementName); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
/// <summary> /// /// </summary> /// <param name="e_Result">検索結果。</param> /// <param name="name_Attribute"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelect_ExpressionFilepath( out Expression_Node_Filepath out_Fliepath_Expr, string name_Attribute, EnumHitcount hits, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TrySelect_ExpressionFilepath", log_Reports); string value; bool isResult = this.TrySelect(out value, name_Attribute, hits, log_Reports); Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null); filepath_Conf.InitPath(value, log_Reports); out_Fliepath_Expr = new Expression_Node_FilepathImpl(filepath_Conf); //switch (hits) //{ // case EnumHitcount.One: // { // if (!isResult) // { // //エラー // goto gt_Error_NotFoundOne; // } // } // break; // //todo:他の制約も。 //} goto gt_EndMethod; // // #region 異常系 ////──────────────────────────────────────── //gt_Error_NotFoundOne: // if (log_Reports.CanCreateReport) // { // Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); // r.SetTitle("▲エラー281!", log_Method); // StringBuilder s = new StringBuilder(); // s.Append("必ず、1件を取得する指定でしたが、1件も存在しませんでした。キー=["); // s.Append(name_Attribute); // s.Append("]"); // // ヒント // r.Message = s.ToString(); // log_Reports.EndCreateReport(); // } // goto gt_EndMethod; ////──────────────────────────────────────── // #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return(isResult); }
/// <summary> /// レイアウトを設定します。 /// /// ファイルパスの入っている変数の名前を指定します。 /// </summary> /// <param name="listO_Table_Form">フォーム設定テーブル。</param> /// <param name="oFolderPath_forms">formsフォルダーの、ファイルパス。</param> /// <param name="startupPath"></param> /// <param name="form"></param> /// <param name="log_Reports"></param> /// <returns></returns> public void SetupFormAndLoadUsercontrolconfigs( List<Table_Humaninput> listO_Table_Form, Expression_Node_Filepath ec_Fopath_Forms, Form form, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetupFormAndLoadUsercontrolconfigs", log_Reports); // // // テーブル名別_設定マップ Dictionary<string, TableUserformconfig> dicFo_ByTable = new Dictionary<string, TableUserformconfig>(); // レイアウト_グループ別_設定マップ Dictionary<string, TableUserformconfig> dicFo_ByGroup = new Dictionary<string, TableUserformconfig>(); // // (F1)テーブル毎にレイアウト設定 foreach (Table_Humaninput o_Table_Form in listO_Table_Form) { string sTableName = o_Table_Form.Name; TableUserformconfig fo_Config_ByTable; if (dicFo_ByTable.ContainsKey(sTableName)) { fo_Config_ByTable = dicFo_ByTable[sTableName]; } else { fo_Config_ByTable = new TableUserformconfigImpl( o_Table_Form.Name, new Configurationtree_NodeImpl( NamesNode.S_FORM_CONFIG, o_Table_Form.Expression_Filepath_ConfigStack.Cur_Configuration//Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) )); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } dicFo_ByTable.Add(sTableName, fo_Config_ByTable); } // // コントロールのスタイルを設定します。 this.P1_XToMemory_Userformconfig( fo_Config_ByTable, o_Table_Form, log_Reports ); } // // (F2)テーブルユニット毎にレイアウト設定。 foreach (Table_Humaninput o_Table_Form in listO_Table_Form) { string sTableUnit = o_Table_Form.Tableunit; TableUserformconfig fo_Config_ByGroup; if (dicFo_ByGroup.ContainsKey(sTableUnit)) { fo_Config_ByGroup = dicFo_ByGroup[sTableUnit]; } else { fo_Config_ByGroup = new TableUserformconfigImpl( o_Table_Form.Name, new Configurationtree_NodeImpl(NamesNode.S_FORM_CONFIG, o_Table_Form.Expression_Filepath_ConfigStack.Cur_Configuration//Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) )); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } dicFo_ByGroup.Add(sTableUnit, fo_Config_ByGroup); } // // コントロールのスタイルを設定します。 this.P1_XToMemory_Userformconfig( fo_Config_ByGroup, o_Table_Form, log_Reports ); } // // (F3)グループ毎にレイアウト作成、スタイル適用。 foreach (TableUserformconfig fo_Config_ByGroup in dicFo_ByGroup.Values) { this.P2_CreateForm( fo_Config_ByGroup, form, log_Reports ); this.P3_ApplyStyleToUsercontrol( fo_Config_ByGroup, log_Reports ); // // (4)コントロール1つ1つに、データソース、データターゲットを設定していきます。 if (log_Reports.Successful) { // // コントロールに、データソース、データターゲットを設定していきます。 // // 『レイアウト設定ファイル』に記述されている、 // FILE列 で示されたコンポーネント設定ファイルをもとに。 // this.Owner_MemoryApplication.MemoryForms.SetupUsercontrolconfigs( fo_Config_ByGroup, ec_Fopath_Forms, log_Reports ); } } // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── protected void Execute6_Sub( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); string sName_Fnc; this.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sName_Fnc + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // 変数は、登録されている名前の変数は存在し、登録されていない名前の変数は(自動作成されたもの以外は)存在しない。 // // 元となるテーブルを見ながら、変数オブジェクトの内容を調べていく。 // // Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname, null); // 変数ログを吐く。 { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); 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> /// コントロールに、データソース、データターゲットを設定していきます。 /// /// 『レイアウト設定ファイル』に記述されている、 /// FILE列 で示された『コンポーネント設定ファイル』を読み取っていきます。 /// /// /// 備考:「モンスター・レギオン・エディター」で使用中。 /// </summary> public void SetupUsercontrolconfigs( TableUserformconfig fo_Config, Expression_Node_Filepath ec_Fopath_Forms, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetupFcnfs",log_Reports); // if (log_Reports.Successful) { // 正常時 // // コントロールのプロパティー設定ファイルに記述されている、 // FILE列 で示されたコンポーネント設定ファイルをもとに、 // コントロールにデータ・ソースと、データ・ターゲットを動的に追加します。 // foreach (RecordUserformconfig fo_Record in fo_Config.List_RecordUserformconfig) { Configurationtree_NodeFilepath cf_Fpath_Control; fo_Record.TryGetFilepath_Configurationtree(out cf_Fpath_Control, NamesFld.S_FILE, false, this.Owner_MemoryApplication, log_Reports); Expression_Node_Filepath e_Fpath_Usercontrol = new Expression_Node_FilepathImpl(cf_Fpath_Control); this.Owner_MemoryApplication.MemoryForms.LoadFile( fo_Record, ec_Fopath_Forms, log_Reports ); } } //.WriteLine(this.GetType().Name + "#LoadFcnfs: 【終了】"); // // // // 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> /// 『コントロール設定ファイル(Fcnf)』を読み取ります。 /// /// X→S、S→E、X→A。 /// </summary> public void XToEc_Usercontrolconfig( Configurationtree_Node cf_FcConfig, RecordUserformconfig fo_Record, Expression_Node_Filepath ec_Fopath_Forms, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "XToEc_Usercontrolcnf",log_Reports); // // // // 手入力の (Fcnf) ファイルパス Configurationtree_NodeFilepath cf_Fpath_Control; fo_Record.TryGetFilepath_Configurationtree(out cf_Fpath_Control, NamesFld.S_FILE, false, this.Owner_MemoryApplication, log_Reports); string sFpath_f = cf_Fpath_Control.GetHumaninput(); // // コントロール名。 string sName_Control; fo_Record.TryGetString(out sName_Control, NamesFld.S_NAME, true, "", this.Owner_MemoryApplication, log_Reports); // // (Fcnf) 絶対ファイルパス string sFpatha_f; { Utility_XmlToConfigurationtree_Usercontrolconfig to = new Utility_XmlToConfigurationtree_Usercontrolconfig(); Expression_Node_FilepathImpl e_Fpath = new Expression_Node_FilepathImpl(cf_Fpath_Control); sFpatha_f = to.GetSFilepath_UsercontrolconfigAbsolute( e_Fpath,//sl_record.Cf_File, ec_Fopath_Forms, log_Reports ); } // // X → S (データソース、データターゲットの変換) // S → E // if (log_Reports.Successful) { Utility_XmlToConfigurationtree_Usercontrolconfig to1 = new Utility_XmlToConfigurationtree_Usercontrolconfig(); List<string> sList_ControlName = to1.GetList_NameControl( sName_Control, sFpath_f, sFpatha_f, cf_FcConfig, ec_Fopath_Forms, this.Owner_MemoryApplication, log_Reports ); Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; ConfigurationtreeToExpression_F10_ControlList to2 = new ConfigurationtreeToExpression_F10_ControlListImpl(); to2.Translate( sList_ControlName, cf_FcConfig, this.Owner_MemoryApplication, pg_ParsingLog, log_Reports ); if (Log_ReportsImpl.BDebugmode_Static && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" parsingLog=" + pg_ParsingLog.ToString()); } } // // X → A (イベント_アクション_リストを構築します) // if (log_Reports.Successful) { // // (1)コントロールの名前を指定。 // List<Usercontrol> list_Usercontrol; { Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(null, fo_Record.Parent_TableUserformconfig.Cur_Configurationtree); ec_Str.AppendTextNode( sName_Control, fo_Record.Parent_TableUserformconfig.Cur_Configurationtree, log_Reports ); list_Usercontrol = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_Str, true, log_Reports ); } if (0 < list_Usercontrol.Count) { Usercontrol uct = list_Usercontrol[0]; if (null != uct.ControlCommon.Configurationtree_Control) { // // 「コントロール設定ファイル」のあったコントロールの // 場合に限る。 // List<Configurationtree_Node> cfList_Event = uct.ControlCommon.Configurationtree_Control.GetChildrenByNodename(NamesNode.S_EVENT, false, log_Reports); foreach (Configurationtree_Node cf_Event in cfList_Event) { ConfigurationtreeToExpression_Event sToE_Event = new ConfigurationtreeToExpression_EventImpl(); sToE_Event.Configurationtree_Event = cf_Event; Functionlist felist = uct.CreateFunctionlist( sToE_Event, this.Owner_MemoryApplication, log_Reports ); sToE_Event.Owner_Functionlist = felist; } // // TODO:「dt」「txa」コントロールの場合、 // 値が変わったイベントの時に、「値確定」アクションが必ず起動するように // 自動設定したい。 // } } } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 『コントロール設定ファイル(F)』を読み取ります。 /// /// X→S、S→E、S→A。 /// </summary> public void LoadFile( RecordUserformconfig record_Uf, Expression_Node_Filepath folderpath_Forms_Expr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile",log_Reports); // // // 手入力の Fcnf ファイルパス Configurationtree_NodeFilepath filepath_Control_Conf; record_Uf.TryGetFilepath_Configurationtree(out filepath_Control_Conf, NamesFld.S_FILE, false, this.Owner_MemoryApplication, log_Reports); string filepathHi_Uf = filepath_Control_Conf.GetHumaninput(); string name_Control; record_Uf.TryGetString(out name_Control, NamesFld.S_NAME, true, "", this.Owner_MemoryApplication, log_Reports); // FILE フィールド(ファイルパス)が未指定なら、処理せず。 if (log_Reports.Successful) { if ("" == filepathHi_Uf) { goto gt_EndMethod; } } // (F) 絶対ファイルパス string filepathabs_Uf; { Utility_XmlToConfigurationtree_Usercontrolconfig to = new Utility_XmlToConfigurationtree_Usercontrolconfig(); Expression_Node_FilepathImpl fpath_Expr = new Expression_Node_FilepathImpl(filepath_Control_Conf); filepathabs_Uf = to.GetSFilepath_UsercontrolconfigAbsolute( fpath_Expr,//sl_record.Cf_File, folderpath_Forms_Expr, log_Reports ); } // // Fcnf ファイルパス Expression_Node_Filepath filepath_Uf_Expr; { Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl(log_Method.Fullname + ".LoadFcnfFile record[" + filepath_Control_Conf.GetHumaninput() + "]", null); Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_3", parent_Conf); filepath_Conf.InitPath(filepathHi_Uf, filepathabs_Uf, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } filepath_Uf_Expr = new Expression_Node_FilepathImpl(filepath_Conf); } if ("" == filepathabs_Uf) { // コンポーネント設定ファイルへのパスが指定されていなければ、処理しません。 goto gt_Error_Fpath; } Configurationtree_Node Usercontrolconfig_Conf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_CONTROLS, filepath_Uf_Expr.Cur_Configuration); // // X → S if (log_Reports.Successful) { XmlToConfigurationtree_C11_Config to = new XmlToConfigurationtree_C11_ConfigImpl(); to.XmlToConfigurationtree( name_Control, filepathHi_Uf, filepathabs_Uf, Usercontrolconfig_Conf, folderpath_Forms_Expr, owner_MemoryApplication, log_Reports ); } // // (F) X → E this.XToEc_Usercontrolconfig( Usercontrolconfig_Conf, record_Uf, folderpath_Forms_Expr, log_Reports ); goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Fpath: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("△情報53!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("コンポーネント設定ファイルへのパスが指定されていないので、"); s.Newline(); s.Newline(); s.Append("処理しません。"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
public MemoryGloballist Perform( Expression_Node_Filepath expr_Fpath_GloballistText, Encoding encoding, Log_Reports log_Reports, string sRunningHintName ) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform", log_Reports); MemoryGloballist moGl = new MemoryGloballistImpl(); string sFpatha = expr_Fpath_GloballistText.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports);//絶対ファイルパス if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } if ("" == sFpatha) { // グローバルリスト ファイルへのパスが空文字列だった場合 if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー080011!", pg_Method); r.Message = "グローバルリスト ファイルへのパスを指定してください。"; log_Reports.EndCreateReport(); } } string sText1; if (log_Reports.Successful) { // 正常時 // テキスト読取り try { sText1 = System.IO.File.ReadAllText(sFpatha, encoding); } catch (Exception ex) { sText1 = null; if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800023!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("ファイルの読み取りに失敗しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイルパス=["); t.Append(sFpatha); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("エンコーディング=["); t.Append(encoding.ToString()); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } } else { // エラー時 sText1 = null; } if (log_Reports.Successful) { // 正常時 // テキストをストリーム化します。 System.IO.StringReader reader = new System.IO.StringReader(sText1); while (-1 < reader.Peek()) { string sLine = reader.ReadLine(); string parent_SNode = sFpatha; MemoryGloballistLine modelOfGlLine = this.Sub_ParseLine(sLine, log_Reports, parent_SNode); if (log_Reports.Successful) { // 正常時 moGl.AddLine(modelOfGlLine); } } // ストリームを閉じます。 reader.Close(); } // // // // gt_EndMethod: pg_Method.EndMethod(log_Reports); return(moGl); }
//──────────────────────────────────────── /// <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> /// ファイル・パス型変数の値をセットします。 /// </summary> /// <param select="oVariableName"></param> /// <param select="nValue"></param> /// <param select="bRequired"></param> public void SetFilepathValue(string sVariableName, Expression_Node_Filepath ec_Fpath, bool bRequired, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetFilepathValue",log_Reports); if (bRequired && !this.dictionaryExpression_Item.ContainsKey(sVariableName)) { goto gt_Error_NotFoundVariable; } else { this.dictionaryExpression_Item[sVariableName] = ec_Fpath; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー924!", log_Method); r.Message = "変数[" + sVariableName + "]は存在しませんでした。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// ファイルパス型変数を登録します。 /// /// todo:文字列、ファイルパスの区別なく登録したい。 /// </summary> /// <param name="sVariableName"></param> /// <param name="e_InitialValue"></param> /// <param name="bDuplicatedIsError">既に追加されているものを、更に追加しようとしたときにエラーにするなら真。</param> /// <param name="log_Reports"></param> public void PutFilepath( string sName_Variable, Expression_Node_Filepath ec_InitialValue, bool bDuplicatedIsError, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "PutFilepath", log_Reports); // // if (this.dictionaryExpression_Item.ContainsKey(sName_Variable)) { if (bDuplicatedIsError) { goto gt_Error_Duplicated; } else { // 上書き string sOldValue = ""; if (log_Method.CanInfo()) { sOldValue = this.dictionaryExpression_Item[sName_Variable].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } this.dictionaryExpression_Item[sName_Variable] = ec_InitialValue; if (log_Method.CanInfo()) { log_Method.WriteInfo_ToConsole("変数[" + sName_Variable + "]は既に[" + sOldValue + "]と定義されていましたが、[" + ec_InitialValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]で上書きしました。"); } } } else { this.dictionaryExpression_Item.Add(sName_Variable, ec_InitialValue); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Duplicated: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー922!", log_Method); r.Message = "変数[" + sName_Variable + "]は既に定義されていますが、さらに定義されました。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// E_Elm属性。 /// </summary> /// <param name="out_E_Result">検索結果。</param> /// <param name="sName"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelectAttribute_ExpressionFilepath( out Expression_Node_Filepath ec_Result_Out, string sName, EnumHitcount hits, Log_Reports log_Reports ) { return this.Dictionary_Expression_Attribute.TrySelect_ExpressionFilepath( out ec_Result_Out, sName, hits, log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public void TryGetTable_Variables( out Table_Humaninput out_xenonTable_Variables, String filepath_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, "TryGetTable_Variables", log_Reports); out_xenonTable_Variables = null; //『Sp:Variables;』で指定されているテーブル XenonName xenonName_Variable = new XenonNameImpl(NamesVar.S_SP_VARIABLES, new Configurationtree_NodeImpl("!ハードコーディング_MoNorenImpl#LoadVariables", null)); // // 「変数設定ファイル」のファイルパス。 // log_Reports.Log_Callstack.Push(log_Method, "①"); Expression_Node_Filepath ec_Fpath_Variables = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename( new Expression_Leaf_StringImpl(xenonName_Variable.SValue, null, xenonName_Variable.Cur_Configuration), false,//必須ではありません。未該当であればヌルを返します。 log_Reports ); log_Reports.Log_Callstack.Pop(log_Method, "①"); if (log_Reports.Successful) { if (null == ec_Fpath_Variables) { // // "Sp:Variables;" が未指定の場合、何もしません。 // goto gt_EndMethod; } } //指定されていた場合。 if (log_Reports.Successful) { // // CSVソースファイル読取 // CsvTo_Table_HumaninputImpl reader = new CsvTo_Table_HumaninputImpl(); Request_ReadsTable request_tblReads = new Request_ReadsTableImpl(); Format_Table_Humaninput tblFormat_puts = new Format_Table_HumaninputImpl(); request_tblReads.Name_PutToTable = NamesVar.S_ST_VARIABLES2; request_tblReads.Expression_Filepath = ec_Fpath_Variables; out_xenonTable_Variables = reader.Read( request_tblReads, tblFormat_puts, true, log_Reports ); } goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); }
public MemoryGloballist Perform( Expression_Node_Filepath expr_Fpath_GloballistText, Encoding encoding, Log_Reports log_Reports, string sRunningHintName ) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform",log_Reports); MemoryGloballist moGl = new MemoryGloballistImpl(); string sFpatha = expr_Fpath_GloballistText.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports);//絶対ファイルパス if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } if ("" == sFpatha) { // グローバルリスト ファイルへのパスが空文字列だった場合 if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー080011!", pg_Method); r.Message = "グローバルリスト ファイルへのパスを指定してください。"; log_Reports.EndCreateReport(); } } string sText1; if (log_Reports.Successful) { // 正常時 // テキスト読取り try { sText1 = System.IO.File.ReadAllText(sFpatha, encoding); } catch(Exception ex) { sText1 = null; if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800023!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("ファイルの読み取りに失敗しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイルパス=["); t.Append(sFpatha); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("エンコーディング=["); t.Append(encoding.ToString()); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } } else { // エラー時 sText1 = null; } if (log_Reports.Successful) { // 正常時 // テキストをストリーム化します。 System.IO.StringReader reader = new System.IO.StringReader(sText1); while (-1 < reader.Peek()) { string sLine = reader.ReadLine(); string parent_SNode = sFpatha; MemoryGloballistLine modelOfGlLine = this.Sub_ParseLine(sLine, log_Reports, parent_SNode); if (log_Reports.Successful) { // 正常時 moGl.AddLine(modelOfGlLine); } } // ストリームを閉じます。 reader.Close(); } // // // // gt_EndMethod: pg_Method.EndMethod(log_Reports); return moGl; }
//──────────────────────────────────────── /// <summary> /// コントロール名と、設定ファイルパスが指定されるので、 /// 検索して、設定。 /// </summary> /// <param name="sFcName"></param> /// <param name="sFpathH_F">絶対ファイルパス(F)手入力</param> /// <param name="sFpatha_F">絶対ファイルパス(F)</param> /// <param name="s_FcConfig"></param> /// <param name="oFormsFolderPath"></param> /// <param name="owner_MemoryApplication"></param> /// <param name="log_Reports"></param> public void XmlToConfigurationtree( string sName_Control, string sFpathH_F, string sFpatha_F, Configurationtree_Node cf_ControlConfig, Expression_Node_Filepath ec_Fopath_Forms, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XToCf",log_Reports); // // System.Xml.XmlDocument xDoc = null; Exception err_Excp = null; if (log_Reports.Successful) { // 正常時 xDoc = new System.Xml.XmlDocument(); if (System.IO.File.Exists(sFpatha_F)) { try { xDoc.Load(sFpatha_F); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_IoException; } catch (System.Xml.XmlException ex) { // // エラー。 err_Excp = ex; goto gt_Error_XmlException; } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Exception01; } } else { // エラー。 goto gt_Error_NotFoundFile; } } // // コントロール自体は、Aa_Forms.csvを読み取って // 既に追加済みです。 XmlElement err_XElm = null; if (log_Reports.Successful) { // 正常時 XmlToConfigurationtree_C12_ControlImpl_ to = new XmlToConfigurationtree_C12_ControlImpl_(); try { // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // <scriptfile-controls scriptfile-version=”1.0”> を期待。 if (NamesNode.S_CODEFILE_CONTROLS != xRoot.Name) { //エラー err_XElm = xRoot; goto gt_Error_Root; } // スクリプトファイルのバージョンチェック。(コントロール設定ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, cf_ControlConfig, NamesNode.S_CODEFILE_CONTROLS ); // ルート要素の下の子<control>要素 XmlNodeList xNl_Top = xRoot.ChildNodes; foreach (XmlNode xTopNode in xNl_Top) { if (XmlNodeType.Element == xTopNode.NodeType) { XmlElement xTop = (XmlElement)xTopNode; if (NamesNode.S_CONTROL1 == xTop.Name) { to.XmlToConfigurationtree( sName_Control, cf_ControlConfig, xTop, owner_MemoryApplication, log_Reports ); } else { // // エラー。 err_XElm = xTop; goto gt_Error_UndefinedChildElement; } } } } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Exception02; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Root: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CODEFILE_CONTROLS, log_Reports);//期待したルート要素名 tmpl.SetParameter(2, err_XElm.Name, log_Reports);//実際のルート要素名 tmpl.SetParameter(3, sFpatha_F, log_Reports);//コントロール設定絶対ファイルパス tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8010;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotFoundFile: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports);//コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//Formsフォルダーパス tmpl.SetParameter(3, sFpathH_F, log_Reports);//コントロール設定ファイル(入力ママ) tmpl.SetParameter(4, sFpatha_F, log_Reports);//コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8011;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_IoException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports);//コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//Formsフォルダーパス tmpl.SetParameter(3, sFpathH_F, log_Reports);//コントロール設定ファイル(入力ママ) tmpl.SetParameter(4, sFpatha_F, log_Reports);//コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8012;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_XmlException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFpatha_F, log_Reports);//コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8013;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception01: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8014;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception02: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8015;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChildElement: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CONTROL1, log_Reports);//期待するノード名 tmpl.SetParameter(2, err_XElm.Name, log_Reports);//実際のノード名 owner_MemoryApplication.CreateErrorReport("Er:8016;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }