//──────────────────────────────────────── /// <summary> /// 新しいインスタンスを作ります。 /// </summary> /// <param name="log_Reports"></param> /// <returns></returns> public Expression_Leaf_String NewInstance( Configuration_Node parent_Expression, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "NewInstance", log_Reports); // // // // Expression_Leaf_StringImpl result = new Expression_Leaf_StringImpl(null, parent_Expression); result.SetString( this.sHumanInput, log_Reports ); // // log_Method.EndMethod(log_Reports); return(result); }
//──────────────────────────────────────── /// <summary> /// 実行。 /// /// 全てのコントロールの、指定のイベントを実行します。 /// /// アプリケーション起動時に、"OnLoad"を全て実行するなど。 /// /// 別の関数から呼び出されます。 /// </summary> /// <param name="oEventName"></param> /// <param name="oEventName"></param> /// <param name="log_Reports"></param> public void Execute1_AllUsercontrols( List<string> sFcNameList, object sender, XenonName o_Name_Event, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute1_AllUsercontrols", log_Reports); // // Configurationtree_Node cf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null); foreach (string sName_Usercontrol in sFcNameList) { if ("" == sName_Usercontrol) { // 空行。飛ばす。 goto end_row; } Expression_Leaf_StringImpl ec_FcName = new Expression_Leaf_StringImpl(null, cf_ThisMethod); ec_FcName.SetString( sName_Usercontrol, log_Reports); List<Usercontrol> list_UcFc = owner_MemoryApplication.MemoryForms.GetUsercontrolsByName(ec_FcName, true, log_Reports); if (list_UcFc.Count < 1) { // 正常。 // 特に設定をすることのないコントロールは、XMLファイルが用意されていない。 // 無視する。 } else { Usercontrol ucFc = list_UcFc[0]; this.Execute1_UsercontrolImpl( sender, ucFc, o_Name_Event, owner_MemoryApplication, log_Reports ); } end_row: ; } // // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 文字列を、子要素として追加。 /// </summary> /// <param name="sHumanInput"></param> /// <param name="s_ParentNode"></param> /// <param name="log_Reports"></param> public void AppendTextNode( string sHumanInput, Configuration_Node parent_Conf, Log_Reports log_Reports ) { Expression_Leaf_StringImpl ec_Child = new Expression_Leaf_StringImpl(null, parent_Conf); ec_Child.SetString(sHumanInput, log_Reports); this.List_Expression_Child.Add(ec_Child, log_Reports); }
//──────────────────────────────────────── public override string Execute5_Main( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Execute5_Main", log_Reports); // // string sResult; // // 変数の名前が入っています。 string sVarName = this.Get00VariableName(log_Reports).Trim(); { // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent); ec_Atom.SetString( sVarName, log_Reports ); // // 値を取り出し。 sResult = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename( ec_Atom, true, log_Reports ); } //ystem.Console.WriteLine(this.GetType().Name + "#GetString: <f-var>変数名=[" + sVarName + "] 結果=["+sResult+"]"); // // // // log_Method.EndMethod(log_Reports); return sResult; }
//──────────────────────────────────────── /// <summary> /// 新しいインスタンスを作ります。 /// </summary> /// <param name="log_Reports"></param> /// <returns></returns> public Expression_Leaf_String NewInstance( Configuration_Node parent_Expression, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "NewInstance",log_Reports); // // // // Expression_Leaf_StringImpl result = new Expression_Leaf_StringImpl(null, parent_Expression); result.SetString( this.sHumanInput, log_Reports ); // // log_Method.EndMethod(log_Reports); return result; }
//──────────────────────────────────────── /// <summary> /// <data>要素の読取。 /// </summary> /// <param select="xDataSource"></param> /// <param select="fcUc"></param> public void Translate( Configurationtree_Node cur_Cf,//<data>要素 Expression_Node_String parent_Ec,//「S■form-component」 MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "CfToEc",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(2)" + cur_Cf.Name); } // // // // // // // // 自 // // // Expression_NodeImpl cur_Ec = new Expression_NodeImpl(parent_Ec, cur_Cf, memoryApplication); // // // // 属性 // // // string err_SAttrName; cur_Cf.Dictionary_Attribute.ForEach(delegate(string sPmName, string sValue, ref bool bBreak) { if ( PmNames.S_MEMORY.Name_Pm == sPmName || PmNames.S_ACCESS.Name_Pm == sPmName || PmNames.S_NAME_TABLE.Name_Pm == sPmName || PmNames.S_NAME_VAR.Name_Pm == sPmName || //.Z_ITEM_VALUE_TO_VARIABLE PmNames.S_DESCRIPTION.Name_Pm == sPmName ) { //ystem.Console.WriteLine(Info_SToE.LibraryName + ":" + this.GetType().Name + "#SToE: <データT >に属性追加 [" + sKey + "]←[" + sValue + "]"); // なんでも属性として追加。 Expression_Node_String ec_Value = new Expression_Leaf_StringImpl(sValue, cur_Ec, cur_Cf); cur_Ec.SetAttribute(sPmName, ec_Value, log_Reports); } else { err_SAttrName = sPmName; bBreak = true; goto gt_Error_UndefinedAttr; } goto gt_gt_EndMethod2; // // // // gt_Error_UndefinedAttr: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, err_SAttrName, log_Reports);//属性名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7002;", tmpl, log_Reports); } goto gt_gt_EndMethod2; gt_gt_EndMethod2: ; }); // // // // 子 // // // { this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // 親へ連結 // // // parent_Ec.List_Expression_Child.Add(cur_Ec, log_Reports); goto gt_EndMethod; // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 実行。 /// </summary> /// <param name="sender"></param> /// <param name="eventMonitor"></param> /// <param name="log_Reports"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "「E■[" + sFncName0 + "]アクション」実行(A)"; log_Method.Log_Stopwatch.Begin(); } if (this.EnumEventhandler == EnumEventhandler.O_Lr) { string sName_Usercontrol; if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)this.Functionparameterset.Sender; sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { sName_Usercontrol = "(▲不明101!)"; log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName0 + "]アクションを実行。"; } // // // // List<Usercontrol> ucFcList; if (log_Reports.Successful) { // 正常時 // テーブルデータをコントロールにセットします。 // // 指定のコントロール(無指定の場合、自コントロール)を // まず取得。 // Expression_Node_String ec_ArgListboxName; this.TrySelectAttribute(out ec_ArgListboxName, Expression_Node_Function20Impl.PM_NAME_CONTROL_LISTBOX, EnumHitcount.One_Or_Zero, log_Reports); ucFcList = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_ArgListboxName, true, log_Reports); } else { ucFcList = new List<Usercontrol>(); } // リストボックスにテーブルのデータソースを関連付けます。 if (log_Reports.Successful) { // 正常時 // リストボックス コントロール。 Usercontrol fcUc = ucFcList[0]; Expression_Node_String ec_TableName = null; string sTableName; this.TrySelectAttribute(out sTableName, Expression_Node_Function20Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); if ("" != sTableName)//this.E_SysArgDic.ContainsKey(E_SysFnc20Impl.S_ARG_TABLE_NAME) { //テーブル名を指定(アクション用引数) this.TrySelectAttribute(out ec_TableName, Expression_Node_Function20Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <arg3 tableName=”[" + ec_TableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]”>属性でした。"); } } else { // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <arg3 tableName=”☆”>属性が未指定でした。"); } Configuration_Node owner_Configurationtree_Control; { owner_Configurationtree_Control = this.Cur_Configuration.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); } // // 次を期待。 // <data target=”list-box”> // <arg5 name=”tableName” value=”☆”> // List<Configurationtree_Node> cfList_Data = ((Configurationtree_Node)owner_Configurationtree_Control).GetChildrenByNodename( NamesNode.S_DATA, false, log_Reports); foreach (Configurationtree_Node cf_Data in cfList_Data) { string sAccess; cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_ACCESS, out sAccess, false, log_Reports); List<string> sList_Access = new CsvTo_ListImpl().Read(sAccess); if (sList_Access.Contains(ValuesAttr.S_FROM)) { // <data access=”from”> string sDataMemory; cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_MEMORY, out sDataMemory, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } if (ValuesAttr.S_RECORDS == sDataMemory) { cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_NAME_TABLE, out sTableName, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } ec_TableName = new Expression_Leaf_StringImpl(sTableName, this, cf_Data); // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <data tableName=”[" + sTableName + "]”>属性でした。"); } } else { //#連続エラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sDataMemory, log_Reports);//属性memoryの値 this.Owner_MemoryApplication.CreateErrorReport("Er:110007;", tmpl, log_Reports); } } } } if (null == ec_TableName) { // エラー処理? if (log_Method.CanError()) { log_Method.WriteError_ToConsole(" 直接指定されなかったので、既に<data>にtableName属性があると期待しましたが、ありませんでした。"); } sTableName = "";//string sTableName = ""; ec_TableName = new Expression_Leaf_StringImpl(sTableName, this, owner_Configurationtree_Control);// owner_Cf_Fc.S_DataSource } } //↓この中で時間かかってる。 Utility_Listbox.BindTableToDatasource( fcUc,// リストボックス・コントロール ec_TableName, this.Owner_MemoryApplication, log_Reports ); //↑この中で時間かかってる。 } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return ""; }
//──────────────────────────────────────── /// <summary> /// /// </summary> /// <param name="e_Result">検索結果。</param> /// <param name="name"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelect( out Expression_Node_String out_Result_Expr, string name, EnumHitcount hits, Log_Reports log_Reports//bug:ヌルのことがある? ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TrySelect", log_Reports); // bool isHit; if (this.dicExpression_Item.ContainsKey(name)) { // ヒット。 out_Result_Expr = this.dicExpression_Item[name]; isHit = true; } else { // 一致なし。 isHit = false; if (Utility_Hitcount.IsError_IfNoHit(hits, log_Reports)) { //エラーにする。 out_Result_Expr = null; goto gt_Error_NotFoundOne; } else { // 該当しないキーを指定され、値を取得できなかったが、エラー報告しない。 Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl("!ハードコーディング_NStringDictionaryImpl#Get", null); out_Result_Expr = new Expression_Leaf_StringImpl(null, parent_Conf); } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundOne: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー141!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("指定された名前["); s.Append(name); s.Append("]は、“EDic(連想配列)”の中にありませんでした。"); s.Newline(); s.Append("┌────────┐キー一覧(個数=["); s.Append(this.dicExpression_Item.Count); s.Append("])"); s.Newline(); foreach (string sKey in this.dicExpression_Item.Keys) { s.Append("["); s.Append(sKey); s.Append("]"); s.Newline(); } s.Append("└────────┘"); s.Newline(); // ヒント if (null != this.Owner_Conf) { s.Append("◆オーナー情報1"); s.Newline(); this.Owner_Conf.ToText_Content(s); } if (0 < this.dicExpression_Item.Count) { foreach (Expression_Node_String e_Item in this.dicExpression_Item.Values) { Expression_Node_String e_Parent = e_Item.Parent_Expression; if (null != e_Parent)//親要素が設定されていないことがある。 { // 最初の1個。 s.Append("◆最初の要素の親の情報。"); s.Newline(); e_Parent.ToText_Snapshot(s); } break; } } // // オーナーの情報。 if (null != this.owner_Conf)//オーナー要素が設定されていないことがある。 { s.Newline(); s.Newline(); s.Append("◆オーナー情報2。"); s.Newline(); this.owner_Conf.ToText_Locationbreadcrumbs(s); } r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return(isHit); }
//──────────────────────────────────────── /// <summary> /// 今日の分のバックアップを取ります。 /// </summary> public override string Execute5_Main(Log_Reports log_Reports) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports); if (this.EnumEventhandler == EnumEventhandler.O_Lr) { // 日付毎のバックアップ(バックアップ対象ファイルを、設定ファイルから読取り後) if (log_Reports.Successful) { // 正常時 // 1日につき1回まで、バックアップを取ります。 DatebackupImpl dateBackup = new DatebackupImpl(); dateBackup.Keptbackups = this.Owner_MemoryApplication.MemoryBackup.BackupKeptbackups; // アプリケーション個別に付ける「フォルダ・サブ名」 dateBackup.Name_Sub = this.Owner_MemoryApplication.MemoryBackup.Name_SubFolder; // // バックアップ・フォルダー // Expression_Node_Filepath ec_Fopath_BackupBase; { XenonNameImpl o_Name_Variable = new XenonNameImpl( NamesVar.S_SP_BACKUP_FOLDER, new Configurationtree_NodeImpl("!ハードコーディング_ExAction00031#", null) ); // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(o_Name_Variable.SValue, null, o_Name_Variable.Cur_Configuration); // フォルダーパス。 log_Reports.Log_Callstack.Push(log_Method, "⑥"); ec_Fopath_BackupBase = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Atom, true, log_Reports ); log_Reports.Log_Callstack.Pop(log_Method, "⑥"); } dateBackup.List_Expression_Filepath_Request = this.Expression_FilepathList_Backup;// バックアップ対象のファイルのパス一覧。 dateBackup.Expression_Filepath_Backuphome = ec_Fopath_BackupBase; dateBackup.Name_Sub = this.Owner_MemoryApplication.MemoryBackup.Name_SubFolder; dateBackup.Perform(log_Reports); } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return ""; }
//──────────────────────────────────────── public override void Translate( Configurationtree_Node cur_Cf,//「S■fnc」 Expression_Node_String parent_Ec,//「S■fnc」、や「S■event」か? MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(29)" + cur_Cf.Name); } // // // // if (!log_Reports.Successful) { goto gt_EndMethod; } if (null == parent_Ec) { goto gt_Error_NullParent; } // // // // 自 // // // Expression_Node_String cur_Ec = null; //「E■fnc」 // // 親ファンク名 // 自ファンク名 // string parent_SName_Fnc = ""; string sName_MyFnc = ""; { bool bHit9 = parent_Ec.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } else if (NamesNode.S_FNC == parent_Ec.Cur_Configuration.Name && "" == parent_SName_Fnc) { // // エラー。親要素が、name属性を持たない「E■fnc」だった。 // goto gt_Error_NoNameParent1; } } // 「E■fnc」には、name=”★”属性が必須。 bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_MyFnc, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } // // // // 自 // // // if (log_Reports.Successful) { // 「E■fnc」要素を作成。 if (NamesFnc.S_ALL_TRUE == sName_MyFnc) { cur_Ec = Expressionv_5FAllTrueImpl.Create(parent_Ec, cur_Cf, memoryApplication); } else if (NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc) { cur_Ec = Expression_SftextTemplate.Create(parent_Ec, cur_Cf, memoryApplication); } else if (NamesFnc.S_CELL == sName_MyFnc) { if (log_Method.CanDebug(10)) { log_Method.WriteDebug_ToConsole( "(2) 「S■fnc name=”[" + sName_MyFnc + "]”」要素 属性解析開始。"); } cur_Ec = Expression_SfcellImpl.Create(parent_Ec, cur_Cf, memoryApplication); } else if (NamesFnc.S_VALUE_CONTROL == sName_MyFnc) { // コントロール名を取得し、コントロールの値を返すように設定。 string sFcName; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sFcName, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_FcName = new Expression_Leaf_StringImpl(sFcName, parent_Ec, cur_Cf); cur_Ec = new Expression_ValuecontrolImpl(ec_FcName, memoryApplication, parent_Ec, cur_Cf); } else if (NamesFnc.S_SWITCH == sName_MyFnc) { if(log_Method.CanDebug(1)) { Log_TextIndented s = new Log_TextIndentedImpl(); parent_Ec.ToText_Snapshot(s); log_Method.WriteDebug_ToConsole( "E■switch生成。s=" + s.ToString()); } cur_Ec = Expression_SfswitchImpl.Create(parent_Ec, cur_Cf); } else { if(sName_MyFnc.StartsWith(NamesFnc.S_UF)) { // ユーザー定義関数 cur_Ec = new Expression_FfncImpl(parent_Ec, cur_Cf, memoryApplication); } else { // システム定義関数 cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf); } } } else { goto gt_EndMethod; } // // // // 属性 // // // if (log_Reports.Successful) { // 元からあった。 this.ParseAttr_InConfigurationtreeToExpression( cur_Cf, cur_Ec, true,//name属性は必須。 false,//value属性は、子<f-str>にしない。 log_Reports ); } // // // // 子 // // // if (log_Reports.Successful) { if(NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc) { this.ParseChild_SpecialTextTemplate_( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesFnc.S_SWITCH == sName_MyFnc) { this.ParseChild_SpecialSwitch_( cur_Cf,//「S■fnc」 cur_Ec,//「E■fnc」 memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesFnc.S_VLD_EMPTY_FIELD == sName_MyFnc) { // <a-empty-field>要素 ConfigurationtreeToExpression_V55_AEmptyFieldImpl_ to = new ConfigurationtreeToExpression_V55_AEmptyFieldImpl_(); to.Translate( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } else { // この「S□fnc」の子を解析。 // 「Sf:cell;」 // 「Sf:where;」 // 「Sf:rec-cond;」 // 【追加 2012-06-02】 this.ParseChild_SpecialFnc_( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } } else { goto gt_EndMethod; } // // // // 親へ連結 // // // if (log_Reports.Successful) { // // "hardcoding-control" に追加する子要素としては、f-cellなどがある。 // if ( sName_MyFnc.StartsWith(NamesFnc.S_UF)//ユーザー定義関数 || NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc//テンプレート || NamesFnc.S_SWITCH == sName_MyFnc//スイッチ文 || (NamesNode.S_FNC == cur_Cf.Name && NamesFnc.S_VALUE_CONTROL == sName_MyFnc)//todo: || (NamesNode.S_FNC == parent_Ec.Cur_Configuration.Name) || (NamesFnc.S_CELL == sName_MyFnc || NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc) || (sName_MyFnc == NamesFnc.S_REC_COND && NamesNode.S_FNC == parent_Ec.Cur_Configuration.Name && NamesFnc.S_WHERE == parent_SName_Fnc)//親が<rec-cond>で、自<fnc name=”Sf:Where;”>要素 ) { parent_Ec.List_Expression_Child.Add(cur_Ec, log_Reports); } else { // エラー goto gt_Error_CanNotAddParent; // todo: //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#SToE:(18)★★親要素へ連結不能 ・親「E■[" + e_Parent.Cur_Configurationtree.Name + "] name=”[" + sParentFncName + "]”」 ← 自「S■[" + s_AFnc.Name_Node + "] name=”[" + sFncName + "]”」中止。 /エラー。親要素に追加しようとしましたが、予想しない親要素でした。"); } } // // // 終わり際に、デバッグ // // if (log_Method.CanDebug(10) && log_Reports.Successful) { if (null != cur_Ec)//既にエラーが出ている場合。 { log_Method.WriteDebug_ToConsole("(19) 自要素の属性の数=[" + cur_Ec.Dictionary_Expression_Attribute.Count + "]"); log_Method.WriteDebug_ToConsole("(21) ┌────┐自要素。その子要素の数=[" + cur_Ec.List_Expression_Child.Count + "]"); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { log_Method.WriteDebug_ToConsole("「S■" + e_Child.Cur_Configuration.Name + "」"); }); log_Method.WriteDebug_ToConsole( "(22) └────┘"); log_Method.WriteDebug_ToConsole( "(23)└────────────────┘ 「S■[" + cur_Cf.Name + "] name=”[" + sName_MyFnc + "]”」(fnc)要素解析終了。"); // // name属性の指定は必須です。 // string sName8; bool bHit8 = cur_Ec.TrySelectAttribute(out sName8, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports); if (!bHit8) { // todo: throw new Exception(Info_ConfigurationtreeToExpression.Name_Library + ":" + this.GetType().Name + "#SToE:(24)fnc要素にname属性が指定されていないのはエラーです①。"); } else if ("" == sName8) { // todo: //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#SToE:(24)fnc要素に空文字列のname属性が指定されているのはエラーです。"); goto gt_Error_NoNameParent2; } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_CanNotAddParent: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, sName_MyFnc, log_Reports);//関数名 if (null != cur_Ec) { tmpl.SetParameter(3, cur_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数 //属性リスト StringBuilder s1 = new StringBuilder(); cur_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s1.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(4, s1.ToString(), log_Reports); tmpl.SetParameter(5, cur_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数 //子要素リスト StringBuilder s2 = new StringBuilder(); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s2.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(6, s2.ToString(), log_Reports); tmpl.SetParameter(7, NamesNode.S_ARG, log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, PmNames.S_WHERE.Name_Pm, log_Reports);//期待の親設定関数名 } else { tmpl.SetParameter(3, "ヌル", log_Reports);//設定属性の数 tmpl.SetParameter(4, "ヌル", log_Reports);//設定属性リスト tmpl.SetParameter(5, "ヌル", log_Reports);//設定子要素の数 tmpl.SetParameter(6, "ヌル", log_Reports);//設定子要素リスト tmpl.SetParameter(7, "ヌル", log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, "ヌル", log_Reports);//期待の親設定関数名 } if (null != parent_Ec) { tmpl.SetParameter(9, parent_Ec.Cur_Configuration.Name, log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, parent_SName_Fnc, log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, parent_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//Expression属性の数 StringBuilder s3 = new StringBuilder(); parent_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s3.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(12, s3.ToString(), log_Reports);//子Expression属性リスト tmpl.SetParameter(13, parent_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子Expression要素数 StringBuilder s4 = new StringBuilder(); parent_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s4.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(14, s4.ToString(), log_Reports);//子Expression要素リスト } else { tmpl.SetParameter(9, "ヌル", log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, "ヌル", log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, "ヌル", log_Reports);//Expression属性の数 tmpl.SetParameter(12, "ヌル", log_Reports);//子Expression属性リスト tmpl.SetParameter(13, "ヌル", log_Reports);//子Expression要素数 tmpl.SetParameter(14, "ヌル", log_Reports);//子Expression要素リスト } tmpl.SetParameter(15, Log_RecordReportsImpl.ToText_Configuration(parent_Ec.Cur_Configuration), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7021;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoNameParent2: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, sName_MyFnc, log_Reports);//関数名 if (null != cur_Ec) { tmpl.SetParameter(3, cur_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数 //属性リスト StringBuilder s1 = new StringBuilder(); cur_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s1.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(4, s1.ToString(), log_Reports); tmpl.SetParameter(5, cur_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数 //子要素リスト StringBuilder s2 = new StringBuilder(); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s2.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(6, s2.ToString(), log_Reports); tmpl.SetParameter(7, NamesNode.S_ARG, log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, PmNames.S_WHERE.Name_Pm, log_Reports);//期待の親設定関数名 } else { tmpl.SetParameter(3, "ヌル", log_Reports);//設定属性の数 tmpl.SetParameter(4, "ヌル", log_Reports);//設定属性リスト tmpl.SetParameter(5, "ヌル", log_Reports);//設定子要素の数 tmpl.SetParameter(6, "ヌル", log_Reports);//設定子要素リスト tmpl.SetParameter(7, "ヌル", log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, "ヌル", log_Reports);//期待の親設定関数名 } if (null != parent_Ec) { tmpl.SetParameter(9, parent_Ec.Cur_Configuration.Name, log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, parent_SName_Fnc, log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, parent_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//Expression属性の数 StringBuilder s3 = new StringBuilder(); parent_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s3.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(12, s3.ToString(), log_Reports);//子Expression属性リスト tmpl.SetParameter(13, parent_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子Expression要素数 StringBuilder s4 = new StringBuilder(); parent_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s4.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(14, s4.ToString(), log_Reports);//子Expression要素リスト } else { tmpl.SetParameter(9, "ヌル", log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, "ヌル", log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, "ヌル", log_Reports);//Expression属性の数 tmpl.SetParameter(12, "ヌル", log_Reports);//子Expression属性リスト tmpl.SetParameter(13, "ヌル", log_Reports);//子Expression要素数 tmpl.SetParameter(14, "ヌル", log_Reports);//子Expression要素リスト } tmpl.SetParameter(15, Log_RecordReportsImpl.ToText_Configuration(parent_Ec.Cur_Configuration), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7022;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoNameParent1: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, sName_MyFnc, log_Reports);//関数名 if (null != cur_Ec) { tmpl.SetParameter(3, cur_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数 //属性リスト StringBuilder s1 = new StringBuilder(); cur_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s1.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(4, s1.ToString(), log_Reports); tmpl.SetParameter(5, cur_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数 //子要素リスト StringBuilder s2 = new StringBuilder(); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s2.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(6, s2.ToString(), log_Reports); tmpl.SetParameter(7, NamesNode.S_ARG, log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, PmNames.S_WHERE.Name_Pm, log_Reports);//期待の親設定関数名 } else { tmpl.SetParameter(3, "ヌル", log_Reports);//設定属性の数 tmpl.SetParameter(4, "ヌル", log_Reports);//設定属性リスト tmpl.SetParameter(5, "ヌル", log_Reports);//設定子要素の数 tmpl.SetParameter(6, "ヌル", log_Reports);//設定子要素リスト tmpl.SetParameter(7, "ヌル", log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, "ヌル", log_Reports);//期待の親設定関数名 } if (null != parent_Ec) { tmpl.SetParameter(9, parent_Ec.Cur_Configuration.Name, log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, parent_SName_Fnc, log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, parent_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//Expression属性の数 StringBuilder s3 = new StringBuilder(); parent_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s3.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(12, s3.ToString(), log_Reports);//子Expression属性リスト tmpl.SetParameter(13, parent_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子Expression要素数 StringBuilder s4 = new StringBuilder(); parent_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s4.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(14, s4.ToString(), log_Reports);//子Expression要素リスト } else { tmpl.SetParameter(9, "ヌル", log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, "ヌル", log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, "ヌル", log_Reports);//Expression属性の数 tmpl.SetParameter(12, "ヌル", log_Reports);//子Expression属性リスト tmpl.SetParameter(13, "ヌル", log_Reports);//子Expression要素数 tmpl.SetParameter(14, "ヌル", log_Reports);//子Expression要素リスト } tmpl.SetParameter(15, Log_RecordReportsImpl.ToText_Configuration(parent_Ec.Cur_Configuration), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7023;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullParent: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7004;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
/// <summary> /// (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); }
//──────────────────────────────────────── /// <summary> /// 変数を登録します。 /// /// 既に使われている変数の名前で登録しようとした場合、エラーです。 /// /// 文字列、ファイルパスの区別はありません。 /// </summary> /// <param select="oVariableName"></param> /// <param select="initialString"></param> /// <param select="log_Reports"></param> public void PutString(string sName_Variable, string sInitial, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "PutString",log_Reports); if (NamesVar.Test_Filepath(sName_Variable)) { //エラー。この関数で、ファイルパスを登録してはいけません。 goto gt_Error_Filepath; } if (this.dictionaryExpression_Item.ContainsKey(sName_Variable)) { goto gt_Error_ContainsKey; } Expression_Leaf_StringImpl ec_Str = new Expression_Leaf_StringImpl(null, new Configurationtree_NodeImpl("<変数PutStringから>", null)); ec_Str.SetString(sInitial, log_Reports); try { this.dictionaryExpression_Item.Add(sName_Variable, ec_Str); } catch (ArgumentException e) { // キーの重複。 throw e; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Filepath: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー35!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("プログラムエラー! 文字列変数登録関数を使って、ファイルパス変数を追加しようとしました。"); s.Newline(); s.Append("変数[" + sName_Variable + "]。"); s.Newline(); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_ContainsKey: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("Er:401;", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("同じ名前の変数を2度登録しないでください。"); s.Newline(); s.Append("変数[" + sName_Variable + "]は既に登録されていますが、さらに登録されました。"); s.Newline(); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
private void ParseChild_SpecialFnc_( Configurationtree_Node cur_Cf, Expression_Node_String cur_Ec,//「S■fnc」、や「S■event」か? MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "ParseChild_Special_",log_Reports); // // if (!log_Reports.Successful) { goto gt_EndMethod; } // // // // 子 // // // cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak) { if (log_Reports.Successful) { if (NamesNode.S_ARG == s_Child.Name) { //━━━━━ // arg //━━━━━ string sName_MyFnc; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_MyFnc, false, log_Reports); string sName_ChildFnc; s_Child.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_ChildFnc, false, log_Reports); // bool bNormalize = false; if( // 親が「E■fnc」 NamesNode.S_FNC == cur_Ec.Cur_Configuration.Name && NamesFnc.S_CELL == sName_MyFnc ) { if ( // 子が「name=”select”」 PmNames.S_SELECT.Name_Pm == sName_ChildFnc ) { bNormalize = true; } } if (bNormalize) { ConfigurationtreeToExpression_F14n16 to = new ConfigurationtreeToExpression_F14_FArgImpl(); to.Translate( s_Child, cur_Ec,//「E■fnc」とか memoryApplication, pg_ParsingLog, log_Reports ); } else { string sValue = ""; // // value=”” 属性が指定されていれば、その値をそのまま取得。 // s_Child.Dictionary_Attribute.ForEach(delegate(string sPmName2, string sAttrValue2, ref bool bBreak2) { if (PmNames.S_VALUE.Name_Pm == sPmName2) { // value属性が指定されていた場合。 s_Child.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); // 「E■arg1」は作らずに、親要素の属性として追加。 Expression_Node_String e_Value = new Expression_Leaf_StringImpl(sValue, cur_Ec, cur_Ec.Cur_Configuration); cur_Ec.SetAttribute(sName_ChildFnc, e_Value, log_Reports); } }); // // 子要素の有無。 // if (0 < s_Child.List_Child.Count) { // 子要素が指定されている場合。 if ("" != sValue) { // value属性が指定されているのに、子要素も指定されているのは、エラーです。 if (log_Method.CanError()) { log_Method.WriteError_ToConsole( " value属性が指定されているのに、子要素も指定されているのは、エラーです。"); } } else { Expression_Node_StringImpl ec_Value = new Expression_Node_StringImpl(cur_Ec, s_Child); ConfigurationtreeToExpression_F14_FncImpl_ to2 = new ConfigurationtreeToExpression_F14_FncImpl_(); to2.ParseChild_SpecialFnc_( s_Child, ec_Value, memoryApplication, pg_ParsingLog, log_Reports ); // // 「E■arg1」は作らずに、親要素の属性として追加。 // cur_Ec.SetAttribute(sName_ChildFnc, ec_Value, log_Reports); } } else { if ("" == sValue) { // todo: throw new Exception(Info_ConfigurationtreeToExpression.Name_Library + ":" + this.GetType().Name + "#ParseChild:(3) 「S■[" + cur_Cf.Name + "]」の子要素「S■[" + s_Child.Name + "]」に、value属性がありませんでした。子要素もありませんでした。"); } } } } else if (NamesNode.S_F_VAR == s_Child.Name) { //━━━━━ // f-var //━━━━━ //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#ParseChild:(b)f-var 使っていなければ廃止したい。"); // 親要素「S■fnc」の子要素として追加します。 ConfigurationtreeToExpression_F14_FvariableImpl_ to = new ConfigurationtreeToExpression_F14_FvariableImpl_(); to.Translate( s_Child, cur_Ec,//「E■fnc」とか memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesNode.S_F_STR == s_Child.Name) { //━━━━━ // f-str //━━━━━ //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#ParseChild:(c)f-str 使っていなければ廃止したい。"); // 親要素「S■fnc」の子要素として追加します。 ConfigurationtreeToExpression_F14_FstrImpl_ to = new ConfigurationtreeToExpression_F14_FstrImpl_(); to.Translate( s_Child, cur_Ec,//「E■fnc」とか memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesNode.S_FNC == s_Child.Name) { //━━━━━ // fnc //━━━━━ //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#ParseChild:(e)fnc 使っていなければ廃止したい。"); // // S_FVarImpl (「S■f-var」)など。 // 【追加 2012-05-31】 // // 親要素「S■fnc」の子要素として追加します。 pg_ParsingLog.Increment("(SToE_F_4FFncImpl②)"); ConfigurationtreeToExpression_F14n16 to = new ConfigurationtreeToExpression_F14_FncImpl_(); to.Translate( s_Child,// s_Fnc,//※s_Node(「S■f-var」とか)を入れるのではなく、その親を入れます。 cur_Ec,//「E■fnc」とかか? memoryApplication, pg_ParsingLog, log_Reports ); pg_ParsingLog.Decrement(); } else if (NamesNode.S_F_PARAM == s_Child.Name) { //━━━━━ // f-param //━━━━━ //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#ParseChild:(f)f-param 使っていなければ廃止したい。"); // 【追加 2012-06-05】 ConfigurationtreeToExpression_F14_FparamImpl_ to4 = new ConfigurationtreeToExpression_F14_FparamImpl_(); to4.Translate( s_Child, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } else { // todo:2 goto gt_Error_UndefinedChlid; throw new Exception(Info_ConfigurationtreeToExpression.Name_Library + ":" + this.GetType().Name + "#ParseChild:(16) 「S■[" + cur_Cf.Name + "]」に、未定義の子要素「S■[" + s_Child.Name + "]」がありました。"); } } goto gt_EndMethod2; // gt_Error_UndefinedChlid: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, s_Child.Name, log_Reports);//子要素名 tmpl.SetParameter(3, cur_Cf.Dictionary_Attribute.Count.ToString(), log_Reports);//string属性の数 //string属性のリスト StringBuilder s1 = new StringBuilder(); cur_Cf.Dictionary_Attribute.ForEach(delegate(string sKey2, string sValue2, ref bool bBreak2) { s1.Append("s属 [" + sKey2 + "]=[" + sValue2 + "]\n"); }); tmpl.SetParameter(4, s1.ToString(), log_Reports); tmpl.SetParameter(5, cur_Cf.List_Child.Count.ToString(), log_Reports);//子要素の数 //子要素のリスト StringBuilder s2 = new StringBuilder(); cur_Cf.List_Child.ForEach( delegate(Configurationtree_Node cf_Child2, ref bool bBreak5) { s2.Append("子「S■" + cf_Child2.Name + "」\n"); }); tmpl.SetParameter(6, s2.ToString(), log_Reports); tmpl.SetParameter(7, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7005;", tmpl, log_Reports); } goto gt_EndMethod2; gt_EndMethod2: ; }); goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <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; }
//──────────────────────────────────────── /// <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> /// /// </summary> /// <param name="e_Result">検索結果。</param> /// <param name="name"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelect( out Expression_Node_String out_Result_Expr, string name, EnumHitcount hits, Log_Reports log_Reports//bug:ヌルのことがある? ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TrySelect", log_Reports); // bool isHit; if (this.dicExpression_Item.ContainsKey(name)) { // ヒット。 out_Result_Expr = this.dicExpression_Item[name]; isHit = true; } else { // 一致なし。 isHit = false; if (Utility_Hitcount.IsError_IfNoHit(hits,log_Reports)) { //エラーにする。 out_Result_Expr = null; goto gt_Error_NotFoundOne; } else { // 該当しないキーを指定され、値を取得できなかったが、エラー報告しない。 Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl("!ハードコーディング_NStringDictionaryImpl#Get", null); out_Result_Expr = new Expression_Leaf_StringImpl(null, parent_Conf); } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundOne: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー141!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("指定された名前["); s.Append(name); s.Append("]は、“EDic(連想配列)”の中にありませんでした。"); s.Newline(); s.Append("┌────────┐キー一覧(個数=["); s.Append(this.dicExpression_Item.Count); s.Append("])"); s.Newline(); foreach (string sKey in this.dicExpression_Item.Keys) { s.Append("["); s.Append(sKey); s.Append("]"); s.Newline(); } s.Append("└────────┘"); s.Newline(); // ヒント if (null != this.Owner_Conf) { s.Append("◆オーナー情報1"); s.Newline(); this.Owner_Conf.ToText_Content(s); } if (0 < this.dicExpression_Item.Count) { foreach (Expression_Node_String e_Item in this.dicExpression_Item.Values) { Expression_Node_String e_Parent = e_Item.Parent_Expression; if (null!=e_Parent)//親要素が設定されていないことがある。 { // 最初の1個。 s.Append("◆最初の要素の親の情報。"); s.Newline(); e_Parent.ToText_Snapshot(s); } break; } } // // オーナーの情報。 if (null != this.owner_Conf)//オーナー要素が設定されていないことがある。 { s.Newline(); s.Newline(); s.Append("◆オーナー情報2。"); s.Newline(); this.owner_Conf.ToText_Locationbreadcrumbs(s); } r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return isHit; }
//──────────────────────────────────────── protected void Execute6_Sub( object sender, Log_Reports log_Reports ) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); // // // // // // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("関数30「新規ウィンドウを開く」を実行します。"); } string sName_Fnc; this.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sName_Fnc + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // // //()タスク・デスクリプション // // // { if (sender is Customcontrol) { Customcontrol cct = (Customcontrol)sender; string sName_Control; if (null == cct.ControlCommon.Expression_Name_Control) { sName_Control = "<エラー:名無し>"; } else { sName_Control = cct.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports ); } log_Reports.Comment_EventCreationMe = "/追記:[" + sName_Control + "]コントロールが、[" + sName_Fnc + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe = "/追記:[" + sName_Fnc + "]アクションを実行。"; } } // ┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━ // ┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━ // 開始 // ┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━┳━ // ┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━┻━ Configurationtree_NodeImpl cf_ThisMethod = new Configurationtree_NodeImpl("!ハードコーディング_NAction30#Execute6_Sub", null); if (log_Reports.Successful) { // 正常時 Expression_Node_String ec_ArgFormgroup; this.TrySelectAttribute(out ec_ArgFormgroup, Expression_Node_Function30Impl.PM_NAME_FORM, EnumHitcount.One_Or_Zero, log_Reports); if (null == ec_ArgFormgroup) { // // エラー goto gt_Error_NoForm; } } // // // //(3)レイアウト_テーブル読取 // // // List<Table_Humaninput> oList_Table_Form;//(フォームのセットアップに使う) // // 「フォーム名(レイアウト_ターゲット名)」を指定。 if (log_Reports.Successful) { // 正常時 // テーブル名から、レイアウト・ファイルパスの取得。 Expression_Node_String ec_ArgFormgroup; this.TrySelectAttribute(out ec_ArgFormgroup, Expression_Node_Function30Impl.PM_NAME_FORM, EnumHitcount.One_Or_Zero, log_Reports); oList_Table_Form = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByFormgroup(ec_ArgFormgroup, true, log_Reports); } else { oList_Table_Form = new List<Table_Humaninput>(); } // // // //(4)formsフォルダーパス取得 // // // Expression_Node_Filepath ec_Fopath_Forms; if (log_Reports.Successful) { // 正常時 XenonName o_Name_Variable = new XenonNameImpl(NamesVar.S_SP_FORMS, this.Cur_Configuration); // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(this, o_Name_Variable.Cur_Configuration); ec_Atom.SetString(o_Name_Variable.SValue, log_Reports); // ファイルパス。 log_Reports.Log_Callstack.Push(log_Method, "⑤"); ec_Fopath_Forms = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(ec_Atom, true, log_Reports); log_Reports.Log_Callstack.Pop(log_Method, "⑤"); } else { ec_Fopath_Forms = null; } // // // //(5)フォームをセットアップ。 // // // if (log_Reports.Successful) { // 正常時 this.Owner_MemoryApplication.MemoryForms.SetupFormAndLoadUsercontrolconfigs( oList_Table_Form, ec_Fopath_Forms, this.Owner_MemoryApplication.MemoryForms.Mainwnd_FormWrapping.Form, log_Reports ); } // // // //(6)『トゥゲザー設定ファイル』読取。 // // // if (log_Reports.Successful) { // タイプデータ値「ScriptTogethers」。 Expression_Leaf_StringImpl ec_NameVariable = new Expression_Leaf_StringImpl(this, cf_ThisMethod); ec_NameVariable.SetString(ValuesTypeData.S_CODE_TOGETHERS, log_Reports); List<MemoryCodefileinfo> listInfo=null; if (log_Reports.Successful) { listInfo = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_NameVariable, true, log_Reports); } if (log_Reports.Successful) { foreach (MemoryCodefileinfo scriptfile in listInfo) { if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryTogethers.LoadFile(scriptfile.Expression_Filepath, log_Reports); } else { break; } } } } // // // //(7)「プロジェクトが選択(切替)されたとき」 // // // if (null != this.In_Subroutine_Function30_2) { this.In_Subroutine_Function30_2.Perform( oList_Table_Form, ec_Fopath_Forms, this.Cur_Configuration, this.Owner_MemoryApplication.MemoryForms.Mainwnd_FormWrapping.Form, sender, log_Reports ); } // // // //(8)独自実装のコントロールのプロパティー編集。主に、フォームの活性化をしているだけ。 // // // if (null != this.In_Subroutine_Function30_1) { this.In_Subroutine_Function30_1.Perform(this.Owner_MemoryApplication, log_Reports); } // (X5)コントロールに、妥当性判定を設定します。 if (log_Reports.Successful) { // タイプデータ値。 Expression_Leaf_StringImpl ec_Name_Variable = new Expression_Leaf_StringImpl(this, cf_ThisMethod); ec_Name_Variable.SetString(ValuesTypeData.S_CODE_VALIDATORS, log_Reports); List<MemoryCodefileinfo> list_Info = null; if (log_Reports.Successful) { list_Info = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_Name_Variable, true, log_Reports); } if (log_Reports.Successful) { foreach (MemoryCodefileinfo moScriptfile in list_Info) { if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryValidators.LoadFile( moScriptfile.Expression_Filepath.Execute4_OnExpressionString(EnumHitcount.Unconstraint,log_Reports), log_Reports); } else { break; } } } } // // // //(9)「レイアウトテーブル」に書かれているコントロール名だけの一覧を作成。 // // // List<string> sList_Name_Control = new List<string>(); foreach (Table_Humaninput tableH_Form in oList_Table_Form) { if (tableH_Form.DataTable.Columns.Contains(NamesFld.S_NAME)) { // 「NAME」フィールドのあるテーブルが本表。無いのは参照表。 foreach (DataRow row in tableH_Form.DataTable.Rows) { string name_Control = ((Value_Humaninput)row[NamesFld.S_NAME]).Text; sList_Name_Control.Add(name_Control.Trim()); } } } // // // //(10)指定レイアウト内の全てのコントロールの、"Se:読取時;" イベントを実行します。 // // // if (log_Reports.Successful) { Executer1_UsercontrolAndEvent exe1 = new Executer1_UsercontrolAndEventImpl(); exe1.Execute1_AllUsercontrols( sList_Name_Control, sender, new XenonNameImpl(NamesSe.S_LOAD, cf_ThisMethod), this.Owner_MemoryApplication, log_Reports ); } // // // // ロード完了 // // // goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NoForm: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cf_ThisMethod), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110015;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// プロジェクト読取り時の定形アクション実行。 /// </summary> /// <param name="sender"></param> /// <param name="st_PrevProjectElm_OrNull"></param> /// <param name="bProjectValid"></param> /// <param name="log_Reports"></param> public override string Execute5_Main(Log_Reports log_Reports) { //()メソッド開始 Log_Method log_Method = new Log_MethodImpl(1); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports); // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("「プロジェクト選択時」用のイベントハンドラーを実行します。"); } //()タスク_デスクリプション { string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)this.Functionparameterset.Sender; string sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe += "/追加:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe += "/追加:[" + sFncName0 + "]アクションを実行。"; } } Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null); if (this.EnumEventhandler == EnumEventhandler.Editor_B_Lr) { //(4)独自モデルの取得 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(4)独自モデルの取得"); } // this.On_P04_ReadNewModel(log_Reports); //(5)エディター名。ツール設定ファイルに記載されている方。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(5)エディター名。ツール設定ファイルに記載されている方。"); } // 表示用の名称。 string sName_SelectingEditor; if (this.Functionparameterset.SelectedProjectElement_Configurationtree == null) { // // 切り替えるプロジェクトが判明していない場合は、空文字列。 // sName_SelectingEditor = ""; } else { // // todo: エディター設定ファイルの方のエディター名を入れても意味ないのでは? // sName_SelectingEditor = ((MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree).Name; } //(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用) if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用)"); } // todo:イベントハンドラーを外してから、フォームを外すこと。リストボックスが誤挙動を起こしている。 this.On_P06_ClearProject(this.Functionparameterset.Sender, log_Reports); //(7)「Aa_Editor.xml」読取。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(7)「Aa_Editor.xml」読取。"); } // if (!this.Functionparameterset.IsProjectValid || this.Functionparameterset.SelectedProjectElement_Configurationtree == null) { MemoryAatoolxml_Editor moAatoolxml_PrevEditorElm_OrNull = null; // // // // デフォルト・プロジェクト名が指定されていない場合、 // ツール設定ファイルの最初に記述されているプロジェクトを選択します。 // // // if (log_Reports.Successful) { if ("" == sName_SelectingEditor) { // // デフォルト・エディター名が未指定の場合。 // MemoryAatoolxml_Editor moAatoolxml_DefaultEditor = this.Owner_MemoryApplication.MemoryAatoolxml.GetDefaultEditor(true, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } // ↓これ要る? sName_SelectingEditor = moAatoolxml_DefaultEditor.Name; } } this.On_P07_SelectDefaultProject(ref sName_SelectingEditor, ref moAatoolxml_PrevEditorElm_OrNull, this.Functionparameterset.IsProjectValid, log_Reports); this.Functionparameterset.SelectedProjectElement_Configurationtree = moAatoolxml_PrevEditorElm_OrNull; // // // //「プロジェクトを開いた時の初期化」イベントハンドラーで使うために、ここで設定します。 // // // this.Functionparameterset.SelectedProjectElement_Configurationtree = this.Owner_MemoryApplication.MemoryAatoolxml.GetEditorByName(sName_SelectingEditor, true, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } // ↓追加 if (null == this.Functionparameterset.SelectedProjectElement_Configurationtree) { { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_SelectingEditor, log_Reports);//エディター名 this.Owner_MemoryApplication.CreateErrorReport("Er:110003;", tmpl, log_Reports); } } // ↑追加 //(13a)エディター・フォルダー。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(13a)エディター・フォルダーパス類推。"); } // // // Expression_Node_Filepath ec_Fopath_Editor; if (log_Reports.Successful) { MemoryAatoolxml_Editor moAatoolxml_SelectedEditor = (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree; ec_Fopath_Editor = moAatoolxml_SelectedEditor.GetFilepathByFsetvarname( NamesVar.S_SP_EDITOR, this.Owner_MemoryApplication.MemoryVariables, true, log_Reports ); } else { ec_Fopath_Editor = null; } //(13b)「Aa_Editor.xml」読取。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(13b)「Aa_Editor.xml」ファイルパス類推。"); } // Expression_Node_Filepath ec_Fpath_AaEditorXml; if (log_Reports.Successful) { // // ツール設定ファイルで指定された値から、自動類推で設定されているはず。 // Configurationtree_NodeFilepath cf_Fpath_EditorXml = new Configurationtree_NodeFilepathImpl( "ツール設定ファイル[" + Application.StartupPath + System.IO.Path.DirectorySeparatorChar + ValuesAttr.S_FPATHR_AATOOLXML + "]の中の[" + sName_SelectingEditor + "]エディターへの指定から自動類推", null); // フォルダーパス + \Aa_Editor.xml string sFpatha_Aaeditorxml = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML; // プロジェクト起動時に。 cf_Fpath_EditorXml.InitPath( sFpatha_Aaeditorxml, log_Reports ); ec_Fpath_AaEditorXml = new Expression_Node_FilepathImpl(cf_Fpath_EditorXml); } else { ec_Fpath_AaEditorXml = null; } //(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M。この時点で「Sp:Engine;」といったシステム変数は自動類推が終わっている必要があります。"); } // MemoryAaeditorxml_Editor moAaeditorxml_Editor = null; if (log_Reports.Successful) { this.On_P08_SpToVar_( out moAaeditorxml_Editor, ec_Fpath_AaEditorXml, ec_Fopath_Editor, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, log_Reports ); } // // // // ここで「Aa_Files.csv」を読み込みたい。 // // // if (log_Reports.Successful) { //(9)変数ファイル読取 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(9)変数ファイル読取"); } // this.Owner_MemoryApplication.MemoryVariables.LoadVariables( Application.StartupPath, log_Reports ); } if (log_Reports.Successful) { //(10)プログラマー用・デバッグモードのON/OFF。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(10)プログラマー用・デバッグモードのON/OFF。"); } // //mainWndの作成より先に設定する必要がある。ステータスバーを出す、出さないについて。 { Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent); ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_PROGRAMMER, log_Reports); string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports); if (ValuesAttr.S_ON == sValue) { Log_ReportsImpl.BDebugmode_Static = true; } else if (ValuesAttr.S_OFF == sValue) { Log_ReportsImpl.BDebugmode_Static = false; } else if (ValuesAttr.S_EMPTY == sValue) { // 無視 } else { // TODO:エラー } } } if (log_Reports.Successful) { //(11)画面レイアウト・デバッグモードのON/OFF。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(11)フォーム・デバッグモードのON/OFF。"); } // Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent); ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_FORM, log_Reports); string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports); if (ValuesAttr.S_ON == sValue) { Log_ReportsImpl.BDebugmode_Form = true; } else if (ValuesAttr.S_OFF == sValue) { Log_ReportsImpl.BDebugmode_Form = false; } else if (ValuesAttr.S_EMPTY == sValue) { // 無視 } else { // TODO:エラー } } //(14)「Aa_Files.csv」読取。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(14)「Aa_Files.csv」読取。"); } // List<Expression_Node_Filepath> ecList_Fpath_BackupRequest; { if (log_Reports.Successful) { // 正常時 Expression_Node_Function function_Expr = Collection_Function.NewFunction2( Expression_Node_Function22Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); // 実行 function_Expr.Execute4_OnLr(this.Functionparameterset.Sender, log_Reports); // 実行後 ecList_Fpath_BackupRequest = ((Expression_Node_Function22Impl)function_Expr).List_Expression_Filepath_BackupRequest_Out; } else { // // エラー // ecList_Fpath_BackupRequest = null; } } //(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】"); } // if (log_Reports.Successful) { // タイプデータ値。 Expression_Leaf_StringImpl ec_NameVariable = new Expression_Leaf_StringImpl(this, new Configurationtree_NodeImpl("!ハードコーディング",null)); ec_NameVariable.SetString(ValuesTypeData.S_CODE_FUNCTIONS, log_Reports); List<MemoryCodefileinfo> listInfo = null; if (log_Reports.Successful) { listInfo = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_NameVariable, true, log_Reports); } if (log_Reports.Successful) { foreach (MemoryCodefileinfo scriptfile in listInfo) { if (log_Reports.Successful) { this.Owner_MemoryApplication.MemoryFunctions.LoadFile( scriptfile.Expression_Filepath, log_Reports); } else { break; } } } } //(16)『スタイルシート設定ファイル』読取 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(16)『スタイルシート設定ファイル』読取"); } // if (log_Reports.Successful) { Expression_Node_Function expr_Func = Collection_Function.NewFunction2( Expression_Node_Function19Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(this, conf_ThisMethod); ec_Str.AppendTextNode(NamesVar.S_ST_STYLESHEET, this.Cur_Configuration, log_Reports); expr_Func.SetAttribute(Expression_Node_Function19Impl.PM_NAME_TABLE_STYLESHEET, ec_Str, log_Reports); expr_Func.Execute4_OnLr( this.Functionparameterset.Sender, log_Reports ); } //(17a)「バックアップを取る」前にしておく独自実装をするタイミング。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(17a)「バックアップを取る」前にしておく独自実装をするタイミング。"); } // this.On_P17a_PreviousBackup( this.Functionparameterset.Sender, moAaeditorxml_Editor, ec_Fpath_AaEditorXml, ec_Fopath_Editor, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, log_Reports); //(17b)今日の分のバックアップを取ります。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(17b)今日の分のバックアップを取ります。"); } // this.On_P17b_DateBackup(ecList_Fpath_BackupRequest, this.Functionparameterset.Sender, log_Reports); //(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。"); } // this.On_P17c_PreviousOpenWindow( this.Functionparameterset.Sender, moAaeditorxml_Editor, ec_Fpath_AaEditorXml, ec_Fopath_Editor, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, log_Reports); //(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。"); } // { Expression_Node_Function expr_Func = Collection_Function.NewFunction2( Expression_Node_Function30Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); { //Expression_Node_Function30Impl f1 = { Expression_Node_StringImpl ec_FormStart; { Expression_FvarImpl ec_Fvar = new Expression_FvarImpl(this, this.Cur_Configuration, this.Owner_MemoryApplication); ec_Fvar.AppendTextNode(NamesVar.S_SS_FORM_START, this.Cur_Configuration, log_Reports); ec_FormStart = new Expression_Node_StringImpl(this, this.Cur_Configuration); ec_FormStart.List_Expression_Child.Add(ec_Fvar, log_Reports); } ((Expression_Node_Function30Impl)expr_Func).SetAttribute(Expression_Node_Function30Impl.PM_NAME_FORM, ec_FormStart, log_Reports); } ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_1 = this.In_Subroutine_Function30_1_OrNull; ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_2 = this.In_Subroutine_Function30_2_OrNull; ((Expression_Node_Function30Impl)expr_Func).SetAttribute( Expression_Node_Function30Impl.PM_NAME_TOGETHER, new Expression_Leaf_StringImpl(NamesStg.S_STG_BEGIN_APPLICATION, null, conf_ThisMethod), log_Reports); } expr_Func.Execute4_OnLr( this.Functionparameterset.Sender, log_Reports ); } //(19)最後に if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("(19)最後に"); } // this.On_P19_AtLast( this.Functionparameterset.Sender, (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree, this.Functionparameterset.IsProjectValid, log_Reports); // // 「S」と「E」を出力したい。 if (false) { // 「S」全てのコントロールと、ユーザー定義関数について。 log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのコントロールについて。"); this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); fcUc.ControlCommon.Expression_Control.Cur_Configuration.ToText_Content(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのユーザー定義関数について。"); this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); ec_CommonFunction.Cur_Configuration.ToText_Content(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); // 「E」全てのコントロールと、ユーザー定義関数について。 log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのコントロールについて。"); this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); fcUc.ControlCommon.Expression_Control.ToText_Snapshot(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのユーザー定義関数について。"); this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak) { Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("[" + sKey + "]"); s.Newline(); ec_CommonFunction.ToText_Snapshot(s); log_Method.WriteInfo_ToConsole(s.ToString()); }); log_Method.WriteInfo_ToConsole("└──────────┘"); } log_Method.WriteInfo_ToConsole("◆起動終了"); goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); } return ""; }
//──────────────────────────────────────── /// <summary> /// エラーログを出力します。(エラーが発生したときに呼び出してください) /// </summary> /// <param oVariableName="output_d_Logging"></param> /// <param name="runningHintName">このメソッドが呼び出された場所が分かるようなヒント。</param> public void WriteErrorLog( MemoryApplication moApplication, Log_Reports log_ReportsBuffer_Output, string sRunningHintName ) { Log_Method log_Method = new Log_MethodImpl(0); // メタ。 Log_Reports log_Reports_Meta = new Log_ReportsImpl(log_Method); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "WriteErrorLog",log_Reports_Meta); // // // 書き出すテキスト // string sOutput; { sOutput = log_ReportsBuffer_Output.ToText(); } // // 書き出し先ファイルへのパス // Expression_Node_Filepath ec_Fpath; if (log_Reports_Meta.Successful) { XenonName o_Name_Variable = new XenonNameImpl(NamesVar.S_SP_LOGS, new Configurationtree_NodeImpl("!ハードコーディング_MoOpyopyoImpl#WriteLog", null)); // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(null, o_Name_Variable.Cur_Configuration); ec_Atom.SetString( o_Name_Variable.SValue, log_Reports_Meta ); // ファイルパス。 log_Reports_Meta.Log_Callstack.Push(log_Method, "③"); ec_Fpath = moApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Atom, true, log_Reports_Meta ); log_Reports_Meta.Log_Callstack.Pop(log_Method, "③"); } else { ec_Fpath = null; } // // ファイルの書き出し // string err_SFpatha; { string sFpatha; if (log_Reports_Meta.Successful) { // フォルダーへの絶対パス string sFopatha_Logs = ec_Fpath.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports_Meta); if (!log_Reports_Meta.Successful) { // 既エラー。 goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath2; { Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("!ハードコーディング_MoOpyopyoImpl#WriteLog", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_6", parent_Cf); cf_Fpath.InitPath( sFopatha_Logs, "error-log.txt", log_Reports_Meta ); if (!log_Reports_Meta.Successful) { // 既エラー。 goto gt_EndMethod; } ec_Fpath2 = new Expression_Node_FilepathImpl(cf_Fpath); } sFpatha = ec_Fpath2.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports_Meta); } else { sFpatha = "<エラー>"; } if (log_Reports_Meta.Successful) { try { System.IO.File.WriteAllText(sFpatha, sOutput, Global.ENCODING_LOG); //#正常な、エラー出力 StringBuilder s0 = new StringBuilder(); s0.Append("エラーが発生しました!"); s0.Append(Environment.NewLine); s0.Append(Environment.NewLine); s0.Append("アプリケーションは正常に動作していない可能性があります。"); s0.Append(Environment.NewLine); s0.Append(Environment.NewLine); s0.Append("エラーログを書き出しました。"); s0.Append(Environment.NewLine); s0.Append("["); s0.Append(sFpatha); s0.Append("]"); s0.Append(Environment.NewLine); s0.Append(Environment.NewLine); s0.Append("このアプリケーションの開発者にエラーログをお知らせください。"); MessageBox.Show( s0.ToString(), "▲エラーが発生しました! " + Info_MiddleImpl.Name_Library + ":" + this.GetType().Name + "#WriteErrorLog"); } catch (Exception) { err_SFpatha = sFpatha; goto gt_Error_CanNotWriteErrorLog; } } else { // メタのロガーが、エラーを検知。 goto gt_Error_MetaNotSuccessful; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_CanNotWriteErrorLog: { StringBuilder s0 = new StringBuilder(); s0.Append("▲312!エラーが発生しましたが、エラーログを出力できませんでした。("); s0.Append(Info_MiddleImpl.Name_Library); s0.Append(") ファイルパス=["); s0.Append(err_SFpatha); s0.Append("]"); MessageBox.Show(sOutput, s0.ToString()); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_MetaNotSuccessful: { Log_TextIndented s0 = new Log_TextIndentedImpl(); s0.Append("エラーが発生しましたが、エラーログを出力できませんでした。"); s0.Newline(); s0.Newline(); s0.Append("もしかして?"); s0.Newline(); s0.Append(" ・設定ファイルの「エラーログの書出し先」を読み込む前に、エラーが出てしまった?"); s0.Newline(); s0.Append(" ・「ログファイル書き出し先」は指定されていますか?"); s0.Newline(); s0.Newline(); s0.Append("実行箇所ヒント:"); s0.Newline(); s0.Append(" ・"); s0.Append(sRunningHintName); s0.Newline(); s0.Newline(); MessageBox.Show( s0.ToString(), //sOutput, "▲エラー!【Er:101;】(" + log_Method.Fullname + ")"); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports_Meta); return; }
//──────────────────────────────────────── /// <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 oNodeName="request"></param> /// <param oNodeName="log_Reports"></param> /// <returns></returns> public Expression_Node_Filepath GetEFilePath( EnumHitcount hits, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "GetFilePath",log_Reports); // // Expression_Node_Filepath ec_Fpath_reslt; // // ファイルパス変数の名前 string sVariableName = this.Get00VariableName(log_Reports).Trim(); { // 変数名。 Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent); ec_Atom.SetString( sVariableName, log_Reports ); ec_Fpath_reslt = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename( ec_Atom, true, log_Reports ); } // // // // log_Method.EndMethod(log_Reports); return ec_Fpath_reslt; }
//──────────────────────────────────────── /// <summary> /// 文字列型変数の値をセットします。 /// </summary> /// <param select="oVariableName"></param> /// <param select="nValue"></param> /// <param select="bRequired"></param> public void SetStringValue( XenonName o_Name_Variable, string sValue, 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, "SetStringValue",log_Reports); // // if (bRequired && !this.dictionaryExpression_Item.ContainsKey(o_Name_Variable.SValue)) { goto gt_Error_NotFoundVariable; } else { Expression_Leaf_StringImpl ec_Str = new Expression_Leaf_StringImpl(null, new Configurationtree_NodeImpl("<SetStringValueから>", null)); ec_Str.SetString(sValue, log_Reports); this.dictionaryExpression_Item[o_Name_Variable.SValue] = ec_Str; //.WriteLine(this.GetType().Name + "#SetStringValue: ◆ 文字列型変数[" + oVariableName.OValue + "]に、値["+value+"]をセットしました。"); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー923!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append("["); t.Append(o_Name_Variable.SValue); t.Append("]という名前の 文字列型の変数は、存在しませんでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(" ヒント: 「変数設定ファイル」に登録されている変数だけ使えます。"); t.Append(Environment.NewLine); t.Append(" ヒント: 変数名の英字の大文字・小文字は完全に一致していますか?"); t.Append(Environment.NewLine); t.Append(" ヒント: 「ファイルパス型」と「文字列型」の2つがあります。"); t.Append(" 文字列型として利用されようとしました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(" 「変数設定ファイル」のファイルパス:"); t.Append(Environment.NewLine); t.Append(" "); if (null != this.parent_Variablesconfig_Configurationtree) { this.parent_Variablesconfig_Configurationtree.ToText_Locationbreadcrumbs(t); } else { t.Append("ヌル"); } t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(" 問題箇所ヒント:"); t.Append(Environment.NewLine); t.Append(" "); o_Name_Variable.Cur_Configuration.ToText_Locationbreadcrumbs(t); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_SSeparator()); t.Append(" 変数一覧:"); t.Append(Environment.NewLine); foreach (string sVarName in this.DictionaryExpression_Item.Keys) { t.Append(" "); t.Append(sVarName); 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); }
//──────────────────────────────────────── public void Translate( Configurationtree_Node cur_Cf,//<a-empty-field> Expression_Node_String parent_Expr,//Expressionv_5FAllTrueImpl MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(39)" + cur_Cf.Name); } // // // // // // // // 自 // // // Expressionv_6AEmptyFieldImpl ecv_AEmptyFld = new Expressionv_6AEmptyFieldImpl(parent_Expr, cur_Cf, memoryApplication); // // // // 属性 // // // { { PmName pmName = PmNames.S_TYPE; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { Expression_Leaf_String ec_Leaf = new Expression_Leaf_StringImpl(sValue, parent_Expr, cur_Cf); ecv_AEmptyFld.SetAttribute(pmName.Name_Pm, ec_Leaf, log_Reports); //evAEmptyFld.Dictionary_SAttribute.Add(sAttrName, s_Cur.SAttrDic.Get(sAttrName, true, log_Reports)); } else { // クリアー上書きしない。 } } { PmName pmName = PmNames.S_DESCRIPTION; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { Expression_Leaf_String ec_Leaf = new Expression_Leaf_StringImpl(sValue, parent_Expr, cur_Cf); ecv_AEmptyFld.SetAttribute(pmName.Name_Pm, ec_Leaf, log_Reports); } else { // クリアー上書きしない。 } } } // // // // 親へ連結 // // // { // TODO:? parent_Expr.List_Expression_Child.Add(ecv_AEmptyFld, log_Reports); } // // // // 子 // // // { // <f-cell>要素のリスト this.ParseChild_InConfigurationtreeToExpression( cur_Cf, ecv_AEmptyFld, memoryApplication, pg_ParsingLog, log_Reports ); } goto gt_EndMethod; // // // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// /// </summary> /// <param oVariableName="selectedFldDefinition"></param> /// <param oVariableName="selectedOValue"></param> /// <returns></returns> private Expression_Node_String GetSelectedFieldValue( Fielddefinition selectedFldDefinition, Value_Humaninput valueH_Selected, Configuration_Node parent_Cf_Select, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "GetSelectedFldValue",log_Reports); // // Expression_Node_String reslt_Expression_SelectedValue; switch (selectedFldDefinition.Type_Field) { case EnumTypeFielddefinition.String: { StringBuilder s = new StringBuilder(); s.Append("StringCellDataフィールド["); s.Append(selectedFldDefinition.Name_Humaninput); s.Append("]から取得"); string sValue = ((Value_Humaninput)valueH_Selected).Text; Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select); ec_Field.SetString(sValue, log_Reports); reslt_Expression_SelectedValue = ec_Field; } break; case EnumTypeFielddefinition.Int: { StringBuilder s = new StringBuilder(); s.Append("IntCellDataフィールド["); s.Append(selectedFldDefinition.Name_Humaninput); s.Append("]から取得"); string sValue = ((Value_Humaninput)valueH_Selected).Text; Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select); ec_Field.SetString(sValue, log_Reports); reslt_Expression_SelectedValue = ec_Field; } break; case EnumTypeFielddefinition.Bool: { StringBuilder s = new StringBuilder(); s.Append("Value_Humaninput_Boolフィールド["); s.Append(selectedFldDefinition.Name_Humaninput); s.Append("]から取得"); string sValue = ((Value_Humaninput)valueH_Selected).Text; Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select); ec_Field.SetString(sValue, log_Reports); reslt_Expression_SelectedValue = ec_Field; } break; default: { reslt_Expression_SelectedValue = null; goto gt_Error_NotSupportedType; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotSupportedType: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, selectedFldDefinition.ToString_Type(), log_Reports);//選択したフィールド定義の型名 this.Owner_MemoryApplication.CreateErrorReport("Er:6029;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return reslt_Expression_SelectedValue; }