//──────────────────────────────────────── /// <summary> /// 妥当性判定のグローバル設定ファイルの読取り。 /// </summary> /// <param name="sFpatha">絶対ファイルパス</param> /// <param name="log_Reports"></param> public void LoadFile( string sFpatha, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile",log_Reports); // // this.xToConfigurationtree_V.XmlToConfigurationtree( sFpatha, owner_MemoryApplication, log_Reports ); Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; this.givechapterandverseToExpression_V.Translate( owner_MemoryApplication, pg_ParsingLog, log_Reports ); if (log_Method.CanInfo() && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" d_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString()); } // // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// Exe_2ActionImpl#SToFc で使用。 /// </summary> /// <param name="s_Action"></param> /// <param name="bRequired"></param> /// <param name="log_Reports"></param> /// <returns></returns> public Expression_Node_Function Translate( Configurationtree_Node action_Conf, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Translate",log_Reports); // // string sName_Fnc; if (action_Conf.Dictionary_Attribute.ContainsKey(PmNames.S_NAME.Name_Pm)) { action_Conf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, true, log_Reports); } else { sName_Fnc = "<エラー:" + log_Method.Fullname + ">"; } Expression_Node_Function expr_Func = Collection_Function.NewFunction2( sName_Fnc, null, action_Conf, this.Owner_MemoryApplication, log_Reports); if (log_Reports.Successful) { if (null != expr_Func) { Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; expr_Func = ((Expression_Node_FunctionAbstract)expr_Func).Functiontranslatoritem.Translate( sName_Fnc, action_Conf,//これは生成時に指定できない? pg_ParsingLog, this.Owner_MemoryApplication, log_Reports ); if (Log_ReportsImpl.BDebugmode_Static && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" pg_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString()); } } } goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); return expr_Func; }
//──────────────────────────────────────── /// <summary> /// 『コントロール設定ファイル(Fcnf)』を読み取ります。 /// /// X→S、S→E、X→A。 /// </summary> public void XToEc_Usercontrolconfig( Configurationtree_Node cf_FcConfig, RecordUserformconfig fo_Record, Expression_Node_Filepath ec_Fopath_Forms, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "XToEc_Usercontrolcnf",log_Reports); // // // // 手入力の (Fcnf) ファイルパス Configurationtree_NodeFilepath cf_Fpath_Control; fo_Record.TryGetFilepath_Configurationtree(out cf_Fpath_Control, NamesFld.S_FILE, false, this.Owner_MemoryApplication, log_Reports); string sFpath_f = cf_Fpath_Control.GetHumaninput(); // // コントロール名。 string sName_Control; fo_Record.TryGetString(out sName_Control, NamesFld.S_NAME, true, "", this.Owner_MemoryApplication, log_Reports); // // (Fcnf) 絶対ファイルパス string sFpatha_f; { Utility_XmlToConfigurationtree_Usercontrolconfig to = new Utility_XmlToConfigurationtree_Usercontrolconfig(); Expression_Node_FilepathImpl e_Fpath = new Expression_Node_FilepathImpl(cf_Fpath_Control); sFpatha_f = to.GetSFilepath_UsercontrolconfigAbsolute( e_Fpath,//sl_record.Cf_File, ec_Fopath_Forms, log_Reports ); } // // X → S (データソース、データターゲットの変換) // S → E // if (log_Reports.Successful) { Utility_XmlToConfigurationtree_Usercontrolconfig to1 = new Utility_XmlToConfigurationtree_Usercontrolconfig(); List<string> sList_ControlName = to1.GetList_NameControl( sName_Control, sFpath_f, sFpatha_f, cf_FcConfig, ec_Fopath_Forms, this.Owner_MemoryApplication, log_Reports ); Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; ConfigurationtreeToExpression_F10_ControlList to2 = new ConfigurationtreeToExpression_F10_ControlListImpl(); to2.Translate( sList_ControlName, cf_FcConfig, this.Owner_MemoryApplication, pg_ParsingLog, log_Reports ); if (Log_ReportsImpl.BDebugmode_Static && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" parsingLog=" + pg_ParsingLog.ToString()); } } // // X → A (イベント_アクション_リストを構築します) // if (log_Reports.Successful) { // // (1)コントロールの名前を指定。 // List<Usercontrol> list_Usercontrol; { Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(null, fo_Record.Parent_TableUserformconfig.Cur_Configurationtree); ec_Str.AppendTextNode( sName_Control, fo_Record.Parent_TableUserformconfig.Cur_Configurationtree, log_Reports ); list_Usercontrol = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_Str, true, log_Reports ); } if (0 < list_Usercontrol.Count) { Usercontrol uct = list_Usercontrol[0]; if (null != uct.ControlCommon.Configurationtree_Control) { // // 「コントロール設定ファイル」のあったコントロールの // 場合に限る。 // List<Configurationtree_Node> cfList_Event = uct.ControlCommon.Configurationtree_Control.GetChildrenByNodename(NamesNode.S_EVENT, false, log_Reports); foreach (Configurationtree_Node cf_Event in cfList_Event) { ConfigurationtreeToExpression_Event sToE_Event = new ConfigurationtreeToExpression_EventImpl(); sToE_Event.Configurationtree_Event = cf_Event; Functionlist felist = uct.CreateFunctionlist( sToE_Event, this.Owner_MemoryApplication, log_Reports ); sToE_Event.Owner_Functionlist = felist; } // // TODO:「dt」「txa」コントロールの場合、 // 値が変わったイベントの時に、「値確定」アクションが必ず起動するように // 自動設定したい。 // } } } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 『ユーザー定義関数設定ファイル(Fnc)』を読み取ります。 /// </summary> public void LoadFile( Expression_Node_Filepath filepath_Userfunctionconfig_Expr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile", log_Reports); // // if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数設定ファイルの読み取り。"); } Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_FUNCTIONS, filepath_Userfunctionconfig_Expr.Cur_Configuration);//Info_OpyopyoImpl.LibraryName + ":" + this.GetType().Name + ".LoadFile_Fnc" Expression_Node_String userfunctionconfig_Expr = new Expression_Node_StringImpl(null, parent_Conf); string filepathabsolute = filepath_Userfunctionconfig_Expr.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { goto gt_Error_Fpath; } if (!System.IO.File.Exists(filepathabsolute)) { goto gt_Error_File; } XmlDocument xDoc = new XmlDocument(); Exception err_Excp = null; try { xDoc.Load(filepathabsolute); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (ArgumentException ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Doc; } XmlElement xRoot = null; if (log_Reports.Successful) { // ルート要素を取得 xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(関数登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(filepathabsolute, null), NamesNode.S_CODEFILE_FUNCTIONS ); } string sErrorElementName = ""; if (log_Reports.Successful) { XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { if (NamesNode.S_COMMON_FUNCTION == xTopNode.Name) { XmlElement x_Cur = (XmlElement)xTopNode; string sNameValue = x_Cur.GetAttribute(PmNames.S_NAME.Name_Attribute); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(" ユーザー定義関数の追加を開始:" + sNameValue); } // XToCf XmlToConfigurationtree_C15_Elm xToCf = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_COMMON_FUNCTION, log_Reports); xToCf.XmlToConfigurationtree( x_Cur, parent_Conf, this.Owner_MemoryApplication, log_Reports ); Configurationtree_Node s_Cur = null; parent_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak) { s_Cur = s_Child; bBreak = true; }); // SToE Expression_Node_FunctionImpl ec_CommonFunction = new Expression_Node_FunctionImpl(userfunctionconfig_Expr, s_Cur, new List<string>()); Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl(); pg_ParsingLog.BEnabled = false; ConfigurationtreeToExpression_AbstractImpl.ParseChild_InAnotherLibrary( s_Cur, ec_CommonFunction, this.Owner_MemoryApplication, pg_ParsingLog, log_Reports ); if (log_Method.CanInfo() && pg_ParsingLog.BEnabled) { log_Method.WriteInfo_ToConsole(" d_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString()); } this.Owner_MemoryApplication.MemoryFunctions.AddFunction(sNameValue, ec_CommonFunction, log_Reports); } else { // // エラー。 sErrorElementName = xTopNode.Name; goto gt_Error_UndefinedChild; } } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Fpath: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー101!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルへのパスにエラーがありました。"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_File: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー102!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ユーザー定義関数設定ファイルがありません。"); s.Newline(); s.Append("file=["); s.Append(filepathabsolute); s.Append("]"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Doc: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー103!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エラー:" + err_Excp.Message); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Log_RecordReportsImpl.ToText_Configuration(filepath_Userfunctionconfig_Expr.Cur_Configuration)); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChild: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー104!", log_Method); StringBuilder s = new StringBuilder(); s.Append("未定義の要素:" + sErrorElementName); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }