Exemple #1
0
        //────────────────────────────────────────

        /// <summary>
        /// 未実装の場合。
        /// </summary>
        /// <param name="parent_Conf"></param>
        /// <param name="log_Reports"></param>
        static public void NoImpl_Expression_AddChild(
            Configurationtree_Node parent_Conf,
            Log_Reports log_Reports
            )
        {
            //
            // エラー。

            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Syntax.Name_Library, "Util_Expression_Node_String", "NoImpl_Expression_AddChild", log_Reports);

            //
            //
            //
            //

            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー361!", log_Method);

                StringBuilder sb = new StringBuilder();

                sb.Append("Expression_AddChild メソッドは、未実装です。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント
                sb.Append(r.Message_Configuration(parent_Conf));

                r.Message = sb.ToString();
                log_Reports.EndCreateReport();
            }

            //
            //
            //
            //
            log_Method.EndMethod(log_Reports);
        }
Exemple #2
0
        //────────────────────────────────────────

        public List <Expression_Node_String> GetChildElements(
            EnumHitcount request,
            Log_Reports log_Reports
            )
        {
            //
            // エラー。

            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "GetChildElements", log_Reports);

            //
            //
            //
            //

            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);

                r.SetTitle("▲エラー101!", log_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();
                t.Append("このメソッド " + log_Method.Fullname + " は使わないでください。");

                // ヒント
                t.Append(r.Message_Configuration(this.Cur_Configuration));

                r.Message = t.ToString();

                log_Reports.EndCreateReport();
            }
            //
            //
            log_Method.EndMethod(log_Reports);
            return(null);
        }
Exemple #3
0
        //────────────────────────────────────────

        /// <summary>
        /// 子要素を追加します。
        /// </summary>
        /// <param name="nItems"></param>
        /// <param name="request"></param>
        /// <param name="log_Reports"></param>
        public void Expression_AddChild(
            Expression_Node_String child_Expression,
            Log_Reports log_Reports
            )
        {
            //
            // エラー。

            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "Expression_AddChild", log_Reports);

            //
            //
            //
            //

            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー101!", log_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();
                t.Append("このメソッド " + this.GetType().Name + "#AddChildN は使わないでください。");

                // ヒント
                t.Append(r.Message_Configuration(this.Cur_Configuration));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }

            //
            //
            log_Method.EndMethod(log_Reports);
        }
Exemple #4
0
        //────────────────────────────────────────

        /// <summary>
        /// 「フィールド名=値」という条件1つで検索。該当するレコード0~N件を返す。
        /// </summary>
        /// <param name="dst_Row"></param>
        /// <param name="name_KeyField"></param>
        /// <param name="value_Expected"></param>
        /// <param name="isRequired_ExpectedValue"></param>
        /// <param name="fielddefinition_Key"></param>
        /// <param name="dataTable"></param>
        /// <param name="s_ParentNode_query"></param>
        /// <param name="log_Reports"></param>
        public void Select(
            out List <DataRow> out_List_DstRow,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,
            Fielddefinition fielddefinition_Key,
            DataTable dataTable,
            Configuration_Node parent_Query,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, this, "Select", log_Reports);

            //
            //
            //
            //

            out_List_DstRow = new List <DataRow>();

            Judge_FieldBoolImpl   judgeB = new Judge_FieldBoolImpl();
            Judge_FieldIntImpl    judgeI = new Judge_FieldIntImpl();
            Judge_FieldStringImpl judgeS = new Judge_FieldStringImpl();


            foreach (DataRow row in dataTable.Rows)
            {
                bool bJudge;

                switch (fielddefinition_Key.Type_Field)
                {
                case EnumTypeFielddefinition.String:
                {
                    // string型フィールドなら
                    judgeS.Judge(
                        out bJudge,
                        name_KeyField,
                        value_Expected,
                        isRequired_ExpectedValue,
                        row,
                        parent_Query,
                        log_Reports
                        );
                }
                break;

                case EnumTypeFielddefinition.Int:
                {
                    // int型フィールドなら
                    judgeI.Judge(
                        out bJudge,
                        name_KeyField,
                        value_Expected,
                        isRequired_ExpectedValue,
                        row,
                        parent_Query,
                        log_Reports
                        );
                }
                break;

                case EnumTypeFielddefinition.Bool:
                {
                    // bool型フィールドなら
                    judgeB.Judge(
                        out bJudge,
                        name_KeyField,
                        value_Expected,
                        isRequired_ExpectedValue,
                        row,
                        parent_Query,
                        log_Reports
                        );
                }
                break;

                default:
                {
                    // エラー。
                    goto gt_Error_UndefinedClass;
                }
                break;
                }

                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                if (bJudge)
                {
                    out_List_DstRow.Add(row);
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedClass:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー899", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.AppendI(0, "<NFuncCellUpdaterImplクラス>");
                s.Append(Environment.NewLine);

                s.AppendI(1, "予期しない型です。");
                s.Append(Environment.NewLine);

                s.AppendI(1, "keyFldDefinition.Type=[");
                s.Append(fielddefinition_Key.ToString_Type());
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.AppendI(1, r.Message_Configuration(parent_Query));

                s.AppendI(0, "</NFuncCellUpdaterImplクラス>");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #5
0
        //────────────────────────────────────────

        /// <summary>
        /// 親要素に、この要素を追加。
        /// </summary>
        protected override void LinkToParent(
            Configurationtree_Node cur_Cf, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "LinkToParent", log_Reports);


            //
            // name属性は必須。
            //
            string sName_Fnc;

            cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, true, log_Reports);
            if (!log_Reports.Successful)
            {
                goto gt_EndMethod;
                //goto gt_Error_UndefinedFncNameAttr;
            }

            string parent_SName_Fnc;

            {
                //
                // ※注意 <data >も、<fnc >扱い。name属性を持っていない。
                //
                bool bRequired = false;
                parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out parent_SName_Fnc, bRequired, log_Reports);

                if (!log_Reports.Successful)
                {
                    goto gt_EndMethod;
                    //goto gt_Error_UndefinedFncNameAttr;
                }
            }



            if (NamesFnc.S_WHERE == sName_Fnc)
            {
                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );

                // デバッグ出力
                if (log_Method.CanDebug(1))
                {
                    Log_TextIndented s = new Log_TextIndentedImpl();
                    parent_Cf.ToText_Locationbreadcrumbs(s);
                    //log_Method.WriteDebug_ToConsole( "<fnc name=”[" + sFncName + "]”>要素 親要素「S■[" + s_Parent.Name_Node + "]」の子リストに、自分を追加。 子要素の数は[" + s_Cur.CountChildNodes + "]でした。");
                    log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>要素 親要素「S■[" + parent_Cf.Name + "]」の『属性[" + cur_Cf.Name + "]』に、自分「S■[" + cur_Cf.Name + "]」を追加。 子要素の数は[" + cur_Cf.List_Child.Count + "]でした。 Place=[" + s.ToString() + "]");
                }
            }
            else if (NamesFnc.S_CASE == sName_Fnc)
            {
                //
                // 親要素は Sf:switch; である必要があります。
                //
                if (NamesFnc.S_SWITCH != parent_SName_Fnc)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー308!", log_Method);

                        Log_TextIndented s = new Log_TextIndentedImpl();

                        s.Append("Sf:case;系要素の親は f-switch を期待します。");
                        s.Newline();
                        s.Newline();

                        s.Append("親ノード名=[");
                        s.Append(parent_Cf.Name);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        // ヒント
                        s.Append(r.Message_Configuration(parent_Cf));

                        r.Message = s.ToString();
                        log_Reports.EndCreateReport();
                    }

                    goto gt_EndMethod;
                }

                // 要素の(OAelemListではなく)OAcaseListに、この Sf:case; 要素を追加。

                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );
            }
            else if (
                NamesFnc.S_ITEM_LABEL2 == sName_Fnc
                )
            {
                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );
            }
            else if (
                NamesFnc.S_ITEM_VALUE == sName_Fnc
                )
            {
                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );
            }
            else if (
                NamesFnc.S_ITEM_GRAY_OUT == sName_Fnc
                )
            {
                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );
            }
            else if (
                NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc
                )
            {
                //
                // 暫定で、親要素は<f-all-true>である必要があります。
                //
                if (NamesFnc.S_ALL_TRUE != parent_SName_Fnc)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー404!", log_Method);

                        Log_TextIndented s = new Log_TextIndentedImpl();

                        s.Append("<a-empty-field>系要素の親は <f-all-true> であることを期待します。");
                        s.Newline();
                        s.Newline();

                        s.Append("oFnode.NodeName=[");
                        s.Append(parent_Cf.Name);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        // ヒント
                        s.Append(r.Message_Configuration(parent_Cf));

                        r.Message = s.ToString();
                        log_Reports.EndCreateReport();
                    }

                    goto gt_EndMethod;
                }

                if (!(NamesFnc.S_ALL_TRUE == parent_SName_Fnc))
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー403!", log_Method);

                        Log_TextIndented s = new Log_TextIndentedImpl();

                        s.Append("内部プログラムのミス。");
                        s.Newline();
                        s.Append("<a-empty-field>系要素の親が、OFAllTrueImplクラスでありませんでした。");
                        s.Newline();
                        s.Newline();

                        s.Append("oFnode.NodeName=[");
                        s.Append(parent_Cf.Name);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        s.Append("oFnode.GetType().Name=[");
                        s.Append(parent_Cf.GetType().Name);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        // ヒント
                        s.Append(r.Message_Configuration(parent_Cf));

                        r.Message = s.ToString();
                        log_Reports.EndCreateReport();
                    }

                    goto gt_EndMethod;
                }

                // 親要素の(OAelemListではなく)OArecordSetSaveToListに、この<fnc name=”Sf:a-record-set-save-to;”>要素を追加。

                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );
            }
            else if (
                NamesFnc.S_EMPTY_FIELD == sName_Fnc
                )
            {
                //
                // 親要素は<f-all-true>である必要があります。
                //
                if (NamesFnc.S_ALL_TRUE != parent_SName_Fnc)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー405!", log_Method);

                        Log_TextIndented s = new Log_TextIndentedImpl();

                        s.Append("<a-empty-field>系要素の親は <f-all-true> であることを期待します。");
                        s.Newline();
                        s.Newline();

                        s.Append("oFnode.NodeName=[");
                        s.Append(parent_Cf.Name);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        // ヒント
                        s.Append(r.Message_Configuration(parent_Cf));

                        r.Message = s.ToString();
                        log_Reports.EndCreateReport();
                    }

                    goto gt_EndMethod;
                }

                if (!(NamesFnc.S_ALL_TRUE == parent_SName_Fnc))
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー406!", log_Method);

                        Log_TextIndented s = new Log_TextIndentedImpl();

                        s.Append("内部プログラムのミス。");
                        s.Newline();
                        s.Append("<a-empty-field>系要素の親が、OFAllTrueImplクラスでありませんでした。");
                        s.Newline();
                        s.Newline();

                        s.Append("oFnode.NodeName=[");
                        s.Append(parent_Cf.Name);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        s.Append("oFnode.GetType().Name=[");
                        s.Append(parent_Cf.GetType().Name);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        // ヒント
                        s.Append(r.Message_Configuration(parent_Cf));

                        r.Message = s.ToString();
                        log_Reports.EndCreateReport();
                    }

                    goto gt_EndMethod;
                }

                //
                // <f-all-true>

                //
                // 親要素の(OAelemListではなく)OAemptyFldListに、この<a-empty-field>要素を追加。

                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );
            }
            else
            {
                // 親要素「S■??」に、この「S■fnc」要素を追加。
                // 同名要素が複数個並ぶので、属性ではなく子要素として追加する。

                //
                //
                //
                // 親へ連結。
                //
                //
                //
                parent_Cf.List_Child.Add(
                    cur_Cf,
                    log_Reports
                    );

                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>要素 親要素「S■[" + parent_Cf.Name + "]」の子リストに、自分を追加。 子要素の数は[" + cur_Cf.List_Child.Count + "]でした。");
                }
            }


            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #6
0
        //────────────────────────────────────────

        protected override Configurationtree_Node CreateMyself(
            XmlElement cur_X,
            Configurationtree_Node parent_Cf,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "CreateMyself", log_Reports);

            if (log_Method.CanDebug(1))
            {
            }

            //
            //

            Configurationtree_Node cur_Cf = null;

            //
            // name属性は必須。
            //
            string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute);

            if ("" == sName_Fnc)
            {
                goto gt_Error_UndefinedFncNameAttr;
            }

            //
            //

            if (
                NamesFnc.S_CELL == sName_Fnc ||           //Sf:cell;
                NamesFnc.S_WHERE == sName_Fnc ||          //Sf:where;
                NamesFnc.S_REC_COND == sName_Fnc ||       //Sf:rec-cond;
                NamesFnc.S_VALUE_CONTROL == sName_Fnc ||
                NamesFnc.S_CASE == sName_Fnc ||           //Sf:case;”
                NamesFnc.S_LISTBOX_LABELS == sName_Fnc || //Sf:list-box-labels;
                NamesFnc.S_SWITCH == sName_Fnc ||         //Sf:switch;
                NamesFnc.S_ITEM_LABEL2 == sName_Fnc ||    //Sf:item-label;
                NamesFnc.S_ITEM_VALUE == sName_Fnc ||     //Sf:item-value;
                NamesFnc.S_ITEM_GRAY_OUT == sName_Fnc ||  //Sf:item-gray-out;
                NamesFnc.S_TEXT_TEMPLATE == sName_Fnc ||  //Sf:text-template;
                NamesFnc.S_EMPTY_FIELD == sName_Fnc ||
                NamesFnc.S_ALL_TRUE == sName_Fnc
                )
            {
                cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf);
            }
            else if (NamesNode.S_DATA == cur_X.Name)
            {
                // 【追加】
                cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_DATA, parent_Cf);
            }
            else if (NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc)
            {
                // ノード名は fnc では。
                cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_A_RECORD_SET_SAVE_TO, parent_Cf);
            }
            else
            {
                // <fnc name=”Sa:入力値の確定;”>
                // などがここにくる。
                cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf);
            }


            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedFncNameAttr:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー412!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("<fnc>要素に、name属性が指定されていませんでした。");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(parent_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(cur_Cf);
        }
Exemple #7
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// テーブル名を指定することで、テーブルを返します。
        /// </summary>
        /// <param select="nTableName"></param>
        /// <param select="bRequired">該当しなかった場合に警告表示を行うなら真。</param>
        /// <returns>該当しなかった場合はヌルを返します。</returns>
        public Table_Humaninput GetTable_HumaninputByName(
            Expression_Node_String ec_TableName,
            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, "GetTable_HumaninputByName", log_Reports);

            //
            //
            //
            //

            Table_Humaninput o_Table;
            string           sTableName = ec_TableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);;

            if (this.dictionary_Table_Humaninput.ContainsKey(sTableName))
            {
                o_Table = this.dictionary_Table_Humaninput[sTableName];
            }
            else
            {
                o_Table = null;


                if (bRequired)
                {
                    //
                    // エラー
                    goto gt_Error_NotFoundTable;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFoundTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー928!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("[");

                s.Append(sTableName);

                s.Append("]という名前のテーブルは存在しませんでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_TableName.Cur_Configuration.Parent));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(o_Table);
        }
Exemple #8
0
        /// <summary>
        /// テーブルを返します。レイアウト_グループ名を指定してください。
        /// </summary>
        /// <param select="nTableName"></param>
        /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param>
        /// <returns>該当しなかった場合はヌルを返します。</returns>
        public List <Table_Humaninput> GetTable_HumaninputByTypedata(
            Expression_Node_String expr_KeyExpected,
            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, "GetTable_HumaninputByTypedata", log_Reports);
            //
            //

            List <Table_Humaninput> list_ResltTable = new List <Table_Humaninput>();
            string str_KeyExpected = "";

            if (null == expr_KeyExpected)
            {
                if (bRequired)
                {
                    goto gt_Error_NullExpected;
                }

                goto gt_EndMethod;
            }

            try
            {
                str_KeyExpected = expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                foreach (Table_Humaninput xenonTable in this.dictionary_Table_Humaninput.Values)
                {
                    if (null != xenonTable.Typedata &&
                        str_KeyExpected == xenonTable.Typedata)
                    {
                        list_ResltTable.Add(xenonTable);
                    }
                }
            }
            catch (KeyNotFoundException)
            {
                if (bRequired)
                {
                    // エラー
                    goto gt_Error_NotFound;
                }
            }

            if (list_ResltTable.Count < 1)
            {
                // エラー
                goto gt_Error_NotFound;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullExpected:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー929!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("指定したキー比較値がヌルでした。[" + str_KeyExpected + "]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_NotFound:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー929!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("指定した" + NamesFld.S_TYPE_DATA + "[");

                t.Append(expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));

                t.Append("]にヒットするテーブルは、存在しませんでした。\n\nもしかして?\n ・ツール設定ファイル、プロジェクトファイル、ファイル一覧ファイル、テーブルファイルをまだ読み込めていない?\n ・ファイル名が間違っている?");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(list_ResltTable);
        }
Exemple #9
0
        //────────────────────────────────────────

        /// <summary>
        /// スクリプトファイル情報を返します。TYPE_DATA値を指定してください。
        /// </summary>
        /// <param select="nTableName"></param>
        /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param>
        /// <returns>該当しなかった場合はヌルを返します。</returns>
        public List <MemoryCodefileinfo> GetCodefileinfoByTypedata(
            Expression_Node_String ec_Typedata,
            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, "GetCodefileinfoByTypedata", log_Reports);
            //
            //

            List <MemoryCodefileinfo> result = new List <MemoryCodefileinfo>();

            if (null == ec_Typedata)
            {
                goto gt_EndMethod;
            }

            try
            {
                string sExpectedTypedata = ec_Typedata.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                foreach (MemoryCodefileinfo codefile in this.Dictionary_Table.Values)
                {
                    if (sExpectedTypedata == codefile.Typedata)
                    {
                        result.Add(codefile);
                    }
                }
            }
            catch (KeyNotFoundException)
            {
                if (bRequired)
                {
                    //
                    // エラー
                    goto gt_Error_NotFound;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFound:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー927!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("指定したタイプデータ名[");

                s.Append(ec_Typedata.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));

                s.Append("]は、存在しませんでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_Typedata.Cur_Configuration.Parent));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
Exemple #10
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// attr系要素の追加。
        ///
        /// 既に追加されている要素は、追加できない。
        /// </summary>
        public void Add(
            string sKey,
            string sValue,
            Configuration_Node conf_Value,
            bool bRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "Add", log_Reports);

            //
            //

            if (!this.dictionary_Attribute.ContainsKey(sKey))
            {
                this.dictionary_Attribute.Add(sKey, sValue);
            }
            else
            {
                if (bRequired)
                {
                    // エラー
                    goto gt_Error_Duplicate;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_Duplicate:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー345!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("要素<");
                s.Append(this.owner.Name);
                s.Append(">に、同じ名前の属性が重複していました。");
                s.Newline();

                s.Append("入れようとした要素の名前=[");
                s.Append(sKey);
                s.Append("]");
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(conf_Value));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #11
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// 『レイアウト設定ファイル』をもとに、
        /// コントロール(UserControl)を作成します。
        ///
        /// 作成できなかった、または作成しなかった場合はヌル。
        ///
        /// プロパティーの設定は、この時点では、名前だけ行います。
        /// </summary>
        /// <param name="fo_Record"></param>
        /// <param name="bRequired">未定義の設定があったときに、エラーにするなら真。</param>
        /// <param name="pg_Logging"></param>
        public Usercontrol Create(
            RecordUserformconfig fo_Record,
            bool bRequired_NotUse,// TODO:必ず真でいいのでは?
            MemoryApplication owner_MemoryApplication,
            Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "Create", pg_Logging);
            //
            //


            string sName_Control;

            fo_Record.TryGetString(out sName_Control, NamesFld.S_NAME, true, "", owner_MemoryApplication, pg_Logging);

            //
            // コントロール名 レコード→Ec
            Expression_Node_StringImpl ec_Name_Control = new Expression_Node_StringImpl(null, fo_Record.Parent_TableUserformconfig.Cur_Configurationtree);

            ec_Name_Control.AppendTextNode(
                sName_Control,
                fo_Record.Parent_TableUserformconfig.Cur_Configurationtree,
                pg_Logging
                );


            Usercontrol ucontrol = null;

            string sType_Control;

            fo_Record.TryGetString(out sType_Control, NamesFld.S_TYPE, true, "", owner_MemoryApplication, pg_Logging);
            if (null == sType_Control)
            {
                goto gt_Error_Type;
            }
            else if (!this.Dictionary_UsercontrolCreator.ContainsKey(sType_Control))//TODO:設定ミス時への対応。フィールド名がヌル?
            {
                goto gt_Error_FName;
            }

            UsercontrolCreator2 uctCreator = this.Dictionary_UsercontrolCreator[sType_Control];

            ucontrol = uctCreator.Perform(ec_Name_Control, owner_MemoryApplication);


            if (null != ucontrol)
            {
                // ヌル オブジェクトを設定。
                ucontrol.ControlCommon.Expression_Control = new Expression_ControlImpl(
                    null,
                    new Configurationtree_NodeImpl(NamesNode.S_HARDCODING_CONTROL, null),
                    ucontrol,
                    owner_MemoryApplication
                    );


                ucontrol.ControlCommon.Owner_MemoryApplication = owner_MemoryApplication;
            }
            else
            {
                goto gt_Error_NullUsercontrol;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullUsercontrol:
            if (pg_Logging.CanCreateReport)
            {
                Log_RecordReports r = pg_Logging.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー356!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("ucontrolがヌルでした。");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(fo_Record.Parent_TableUserformconfig.Cur_Configurationtree));

                r.Message = s.ToString();
                pg_Logging.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Type:
            if (pg_Logging.CanCreateReport)
            {
                Log_RecordReports r = pg_Logging.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー355!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("コントロールの型が指定されていません。");
                s.Newline();
                s.Newline();

                s.Append(" 『レイアウト設定』をもとに、コントロールを作成しているときに、");
                s.Newline();
                s.Append(" エラーが発生しました。");
                s.Newline();


                // ヒント
                s.Append(r.Message_Configuration(fo_Record.Parent_TableUserformconfig.Cur_Configurationtree));

                r.Message = s.ToString();
                pg_Logging.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_FName:
            // テーブルタイプが「Form」で、"TREE" フィールドがないとき。
            // (Form_lstタイプには、TREEフィールドは要らない)
            if (pg_Logging.CanCreateReport)
            {
                Log_RecordReports r = pg_Logging.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー354!", pg_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append(" 『レイアウト設定』をもとに、コントロールを作成しているときに、");
                t.Newline();
                t.Append(" エラーが発生しました。");
                t.Newline();
                t.Newline();

                t.Append("  指定の型=[");
                t.Append(sType_Control);
                t.Append("]は未定義のコントロールの型です。");

                // ヒント
                t.Append(r.Message_Configuration(fo_Record.Parent_TableUserformconfig.Cur_Configurationtree));

                r.Message = t.ToString();
                pg_Logging.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
            return(ucontrol);
        }
Exemple #12
0
        //────────────────────────────────────────

        /// <summary>
        /// ノード名を指定して、直近の子ノードを取得したい。
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="bRequired">偽を指定した時は、要素数0のリストを返す。</param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public List <Configurationtree_Node> GetChildrenByNodename(string sName, bool bRequired, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "GetChildrenByNodename", log_Reports);
            //
            //
            List <Configurationtree_Node> result = new List <Configurationtree_Node>();

            if (log_Reports.Successful)
            {
                this.list_Child.ForEach(delegate(Configurationtree_Node child_Conf, ref bool bBreak)
                {
                    if (sName == child_Conf.Name)
                    {
                        // ノード名が一致
                        result.Add(child_Conf);
                    }
                    else
                    {
                        // ノード名が一致しないとき
                    }
                });
            }
            else
            {
                // 既にエラーが出ているとき
                goto gt_EndMethod;
            }

            if (result.Count < 1 && bRequired)
            {
                if (bRequired)
                {
                    goto gt_Error_EmptyHitChild;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_EmptyHitChild:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー502!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("該当した子要素がありませんでした。");
                s.Newline();


                s.Append("指定ノード名[");
                s.Append(sName);
                s.Append("]");
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(this));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
Exemple #13
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// 『Aa_Tool.xml/<editor>要素』または、『Aa_Editor.xml/<ルート>要素』を読み取ります。
        /// <f-set-var>を読み取った場合、逐次、変数モデルに追加していきます。
        /// </summary>
        public void LoadFile_Aaxml(
            Expression_Node_Filepath ec_Fpath_Aaxml,
            MemoryVariables moVariables,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile_Aaxml", log_Reports);

            string sFpatha;

            {
                sFpatha = ec_Fpath_Aaxml.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint,
                    log_Reports //out sErrorMsg
                    );          //絶対ファイルパス
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }

            System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();

            Exception err_Excp;

            try
            {
                xDoc.Load(sFpatha);

                // ルート要素を取得
                System.Xml.XmlElement xRoot = xDoc.DocumentElement;


                // <f-set-var>要素を列挙
                XmlNodeList xNl_Fsetvar = xRoot.GetElementsByTagName(NamesNode.S_F_SET_VAR);

                foreach (XmlNode xNode_Fsetvar in xNl_Fsetvar)
                {
                    if (XmlNodeType.Element == xNode_Fsetvar.NodeType)
                    {
                        //<f-set-var>要素
                        XmlElement xFsetvar = (XmlElement)xNode_Fsetvar;

                        //name-var属性
                        string sNamevar = xFsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute);

                        //folder属性
                        string sFolder = xFsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute);

                        //value属性
                        string sValue = xFsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute);

                        //description属性
                        string sDescription = xFsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute);

                        Configurationtree_Node cf_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR,
                                                                                           null//todo:親ノード
                                                                                           );
                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports);
                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports);
                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports);
                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports);


                        this.Dictionary_Fsetvar_Configurationtree.List_Child.Add(cf_Fsetvar, log_Reports);

                        //変数への追加
                        {
                            if (
                                NamesVar.Test_Filepath(sNamevar)
                                )
                            {
                                // ファイルパスの場合
                                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("name-var=[" + sNamevar + "]", ec_Fpath_Aaxml.Cur_Configuration);
                                cf_Fpath.InitPath(
                                    sValue,
                                    log_Reports
                                    );
                                if ("" != sFolder)
                                {
                                    Expression_Node_Filepath ec_Folder = moVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sFolder, ec_Fpath_Aaxml, cf_Fsetvar), true, log_Reports);

                                    if (log_Reports.Successful)
                                    {
                                        cf_Fpath.SetDirectory_Base(
                                            ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)
                                            //sFolder
                                            );
                                    }
                                }

                                if (log_Reports.Successful)
                                {
                                    Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                                    moVariables.PutFilepath(
                                        sNamevar,
                                        ec_Fpath,
                                        true,
                                        log_Reports
                                        );
                                }
                            }
                            else
                            {
                                // ファイルパスでない場合
                                moVariables.PutString(
                                    sNamevar,
                                    sValue,
                                    log_Reports
                                    );
                            }
                        }
                    }


                    if (!log_Reports.Successful)
                    {
                        //既エラー
                        break;
                    }
                }



                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }
            catch (System.IO.IOException ex)
            {
                // 既エラー。
                err_Excp = ex;
                goto gt_Error_IOException;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_IOException:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー283!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("エディター設定ファイルが見つかりません。:" + err_Excp.Message);

                //ヒント
                s.Append(r.Message_Configuration(ec_Fpath_Aaxml.Cur_Configuration));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
Exemple #14
0
        //────────────────────────────────────────

        /// <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);
        }
Exemple #15
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// インスタンスを作ります。
        /// </summary>
        /// <param name="out_recCond"></param>
        /// <param name="logic"></param>
        /// <param name="sField"></param>
        /// <param name="s_ParentNode"></param>
        /// <returns></returns>
        public static bool TryBuild(
            out Recordcondition out_RecCond,
            EnumLogic enumLogic,
            string sField,
            Configuration_Node parent_Conf,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, "RecCondImpl", "TryBuild", log_Reports);

            bool bSuccessful;

            sField = sField.Trim();

            if (EnumLogic.None == enumLogic && "" != sField)
            {
                // 条件式

                RecordconditionImpl rc = new RecordconditionImpl(parent_Conf);
                rc.sField   = sField;
                out_RecCond = rc;
                bSuccessful = true;
            }
            else if (EnumLogic.None != enumLogic && "" == sField)
            {
                // グループ

                RecordconditionImpl rc = new RecordconditionImpl(parent_Conf);
                rc.sField    = "(▲グループにフィールド属性無し103![" + enumLogic + "])";
                rc.enumLogic = enumLogic;
                out_RecCond  = rc;
                bSuccessful  = true;
            }
            else
            {
                out_RecCond = null;
                bSuccessful = false;
                goto gt_Error_Attribute;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_Attribute:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー101!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("<rec-cond>インスタンスを作成する引数にエラー。");
                s.Append(Environment.NewLine);
                s.Append("logic=[");
                s.Append(enumLogic);
                s.Append("] sField=[");
                s.Append(sField);
                s.Append("]");
                s.Append(Environment.NewLine);

                s.Append(r.Message_Configuration(parent_Conf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();

                //throw new Exception(s.ToString());
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(bSuccessful);
        }
Exemple #16
0
        //────────────────────────────────────────

        public void ToMemory_ParentFcells(
            string sValue_Output,
            Expression_Node_String parent_Expr_Fcells,//子「Sf:Cell;」関数を持った親要素。
            MemoryApplication moApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM_ParentFcells", log_Reports);
            //
            //

            // <data>の子要素のリスト。
            parent_Expr_Fcells.List_Expression_Child.ForEach(delegate(Expression_Node_String child_Expr, ref bool bRemove, ref bool bBreak)
            {
                string sName_Fnc;
                child_Expr.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);

                if (log_Reports.Successful)
                {
                    if (NamesFnc.S_CELL == sName_Fnc)
                    {
                        // Sf:cell;

                        this.ToMemory_DataTargetFcell(
                            sValue_Output,
                            child_Expr,
                            moApplication,
                            log_Reports
                            );
                    }
                    //else if (NamesNode.S_ARG3 == e_Child.Cur_Configurationtree.Name_Node)
                    //{
                    //    // スルー
                    //    d_InMethod.WarningWrite("[" + e_Child.Cur_Configurationtree.Name_Node + "]ノードを無視しました。");
                    //}
                    else
                    {
                        if (log_Reports.CanCreateReport)
                        {
                            Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                            r.SetTitle("▲エラー377!", pg_Method);

                            Log_TextIndented t = new Log_TextIndentedImpl();

                            t.AppendI(0, "Sf:cell; 以外の要素が指定されていました。");
                            t.Newline();
                            t.AppendI(0, "「データターゲット」または「arg3 to」には、Sf:cell; 要素1つしか指定してはいけません。");
                            t.Newline();
                            t.Newline();

                            t.AppendI(0, "もしかして? 「『Sf:cell;』の親」 を渡すべきところに、「『arg3 to』の親」を渡していませんか?");
                            t.Newline();

                            // ヒント
                            t.AppendI(1, r.Message_Configuration(child_Expr.Cur_Configuration));

                            r.Message = t.ToString();
                            log_Reports.EndCreateReport();
                        }
                    }
                }
            });

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Exemple #17
0
        //────────────────────────────────────────

        /// <summary>
        /// 空白は、無いのと同じに扱う。
        /// </summary>
        /// <param name="sKey"></param>
        /// <param name="sResult"></param>
        /// <param name="bRequired"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public bool TryGetValue(
            PmName pmName,//Pmオブジェクトにしたい。
            out string sResult,
            bool bRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TryGetValue", log_Reports);
            //


            bool bHit = this.dictionary_Attribute.TryGetValue(pmName.Name_Pm, out sResult);

            if (!bHit || "" == sResult)
            {
                if (bRequired)
                {
                    goto gt_Error_NoHit;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NoHit:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("Er:004;", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();


                s.Append("name=\"");
                s.Append(pmName.Name_Attribute);
                s.Append("\" 属性か、または <arg name=\"");
                s.Append(pmName.Name_Pm);
                s.Append("\" ~> 要素のどちらかが必要でしたが、違う方を書いたか、記述されていないか、空文字列でした。");
                s.Newline();
                s.Newline();

                if (null != this.owner)
                {
                    //ヒント
                    s.Append(r.Message_Configuration(this.owner));
                }
                else
                {
                    s.Append("どの要素かは不明。");
                    s.Newline();
                }

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(bHit);
        }
Exemple #18
0
        //────────────────────────────────────────

        public override void XmlToConfigurationtree(
            XmlElement cur_X,                 //<arg1>
            Configurationtree_Node parent_Cf, //<fnc>
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports);
            //
            //


            //
            //
            //
            // 自
            //
            //
            //
            Configurationtree_Node cur_Cf = this.CreateMyself(cur_X, parent_Cf, memoryApplication, log_Reports);



            //
            //
            //
            // 属性
            //
            //
            //
            //string sFncName;
            //s_Parent.Dictionary_Attribute.TryGetValue(PmNames.NAME.Name_Attr, out sFncName, false, log_Reports);
            if (NamesNode.S_VALIDATOR == parent_Cf.Name)
            {
                //
                // <validator>の子<arg>
                //

                //
                // name=””
                {
                    XmlNode xNode = cur_X.Attributes.GetNamedItem(PmNames.S_NAME.Name_Attribute);
                    if (null != xNode)
                    {
                        string sName = xNode.Value;

                        cur_Cf.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sName, log_Reports);
                    }
                }

                //
                // value=””
                string sValue;
                {
                    XmlNode xNode = cur_X.Attributes.GetNamedItem(PmNames.S_VALUE.Name_Attribute);
                    if (null != xNode)
                    {
                        sValue = xNode.Value;
                        cur_Cf.Dictionary_Attribute.Add(PmNames.S_VALUE.Name_Pm, sValue, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        sValue = "";
                    }
                }

                {
                    string sName;
                    cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName, false, log_Reports);

                    //O_Name o_Name = new O_NameImpl(sName, s_Cur);

                    parent_Cf.Dictionary_Attribute.Add(sName, sValue, parent_Cf, false, log_Reports);
                }
            }
            else
            {
                this.Parse_SAttribute(cur_X, cur_Cf, memoryApplication, log_Reports);
            }



            //
            //
            //
            // 子
            //
            //
            //
            this.Parse_ChildNodes(cur_X, cur_Cf, memoryApplication, log_Reports);



            //
            //
            //
            // 親へ連結
            //
            //
            //
            string err_Parent_SName;
            string parent_SName_Fnc;
            string parent_SAmemory;

            if (!log_Reports.Successful)
            {
                // エラー
                goto gt_EndMethod;
            }
            else if (
                // 親<data >
                NamesNode.S_DATA == parent_Cf.Name
                )
            {
                bool bHit = parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out parent_SName_Fnc, false, log_Reports);

                bool bHit3 = parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_MEMORY, out parent_SAmemory, true, log_Reports);

                if (
                    ValuesAttr.S_RECORDS == parent_SAmemory ||
                    ValuesAttr.S_VARIABLE == parent_SAmemory
                    )
                {
                    //
                    // 親 <data memory=”records”>
                    // 親 <data memory=”variable”>
                    //

                    //
                    // 属性としては追加する。
                    //
                    string sName_Fnc;
                    bool   bHit2 = cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, false, log_Reports);
                    if (bHit2)
                    {
                        string sValue_Arg;
                        cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue_Arg, false, log_Reports);

                        // 「S■data-source」の(<arg5 name属性>としてtarget値を追加。

                        // 属性とする。
                        if (log_Method.CanDebug(1))
                        {
                            log_Method.WriteDebug_ToConsole("<データ target=[" + parent_SAmemory + "]>に属性追加 [" + sName_Fnc + "]←[" + sValue_Arg + "]");
                        }
                        parent_Cf.Dictionary_Attribute.Add(sName_Fnc, sValue_Arg, parent_Cf, true, log_Reports);
                    }
                }
                else
                {
                    // エラー
                    err_Parent_SName = parent_Cf.Name;
                    goto gt_Error_Target;
                }
            }
            else
            {
                // 親が<data>以外。
                bool bHit = parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out parent_SName_Fnc, true, log_Reports);//name属性が無い親もある??

                if (!log_Reports.Successful)
                {
                    log_Method.WriteWarning_ToConsole("s_Parent.Name_Node=[" + parent_Cf.Name + "]");
                }
                else
                {
                }

                if (
                    NamesNode.S_FNC != parent_Cf.Name &&
                    NamesNode.S_VALIDATOR != parent_Cf.Name &&
                    NamesNode.S_COMMON_FUNCTION != parent_Cf.Name &&
                    NamesFnc.S_SWITCH != parent_SName_Fnc //旧仕様に対応
                    )
                {
                    // 親要素が<fnc>でも<validator><common-function><f-switch>でもない。

                    // エラー
                    err_Parent_SName = parent_Cf.Name;
                    goto gt_Error_Parent;
                }
                else if (
                    // 親が<fnc name=”Sf:where;”>
                    NamesNode.S_FNC == parent_Cf.Name &&
                    NamesFnc.S_WHERE == parent_SName_Fnc)
                {
                    // この子arg1要素は、
                    // 親要素「S■f-cell」には追加しません。

                    // 【追加 2012-06-02】
                    // 現状では、「S■a-where」に子「S■arg1」要素が含まれていると、
                    // 「E■f-cell」にarg1要素を追加してしまうので都合が悪い。

                    //
                    // 属性としては追加する。
                    //
                    string sArgAname;
                    bool   bHit2 = cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sArgAname, true, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        goto gt_EndMethod;
                    }

                    string sValue;
                    cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, false, log_Reports);


                    // 「S■fnc」のlogic属性として追加。

                    // 属性連結
                    parent_Cf.Dictionary_Attribute.Add(sArgAname, sValue, parent_Cf, true, log_Reports);
                }
                else
                {
                    // 属性にせず、子まま連結。

                    // 子連結
                    parent_Cf.List_Child.Add(cur_Cf, log_Reports);
                }
            }



            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_Parent:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー361!", log_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();
                t.Append("<");
                t.Append(cur_X.Name);
                t.Append(">要素の親は、<fnc>でなければなりませんでしたが、別の要素<");
                t.Append(err_Parent_SName);
                t.Append(">でした。");
                t.Newline();
                t.Newline();

                // ヒント
                t.Append(r.Message_Configuration(parent_Cf));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Target:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー562!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("<");
                s.Append(cur_X.Name);
                s.Append(">要素のtarget属性が予想外でした。<[");
                s.Append(err_Parent_SName);
                s.Append("] target=”[");
                s.Append(parent_SAmemory);
                s.Append("]”>");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(parent_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #19
0
        //────────────────────────────────────────

        protected override void Parse_SAttribute(
            XmlElement cur_X,
            Configurationtree_Node cur_Cf,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "Parse_SAttr", log_Reports);
            //
            //

            XmlAttribute err_XAttr = null;

            foreach (XmlAttribute xAttr in cur_X.Attributes)
            {
                //
                if (this.List_SName_Attribute.Contains(xAttr.Name))
                {
                    // 属性連結

                    // ⑦
                    PmName pmName = PmNames.FromSAttribute(xAttr.Name);
                    if (null != pmName)
                    {
                        cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        cur_Cf.Dictionary_Attribute.Add(xAttr.Name, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                }
                else
                {
                    err_XAttr = xAttr;
                    goto gt_Error_UndefinedAttr;
                }

                goto gt_attrEnd;

gt_attrEnd:
                ;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedAttr:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー336!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("[");
                s.Append(cur_X.Name);
                s.Append("]要素を探索中に、未対応の属性が記述されていました。");
                s.Newline();

                s.Append("xAttr.Name=[");
                s.Append(err_XAttr.Name);
                s.Append("]");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(cur_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #20
0
        //────────────────────────────────────────

        /// <summary>
        /// 変数名を指定することで、ファイルパスを返します。
        /// </summary>
        /// <param select="oVariableName"></param>
        /// <param select="bRequired"></param>
        /// <param select="log_Reports"></param>
        /// <returns></returns>
        public Expression_Node_Filepath GetExpressionfilepathByVariablename(
            Expression_Node_String ec_Name_Variable,
            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, "GetExpressionfilepathByVariablename", log_Reports);

            //
            //
            //
            //

            Expression_Node_Filepath ec_Fpath_Result;

            string sName_Var = ec_Name_Variable.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

            if (!this.dictionaryExpression_Item.ContainsKey(sName_Var))
            {
                ec_Fpath_Result = null;

                if (bRequired)
                {
                    // 未該当の場合、エラーにします。
                    goto gt_Error_NotFoundVariable;
                }
            }
            else
            {
                Expression_Node_String ec_Str = this.dictionaryExpression_Item[sName_Var];
                if (ec_Str is Expression_Node_Filepath)
                {
                    ec_Fpath_Result = (Expression_Node_Filepath)ec_Str;

                    //if (ec_Fpath_Result.SDirectory_Base == "" && null != this.ec_FpathBaseOrNull)
                    //{
                    //    string sFopath = this.ec_FpathBaseOrNull.Execute4_OnExpressionString(
                    //        EnumHitcount.Unconstraint, log_Reports);
                    //    if (log_Reports.Successful)
                    //    {
                    //        ec_Fpath_Result.SetDirectory_Base(sFopath, log_Reports);
                    //    }
                    //}
                }
                else
                {
                    ec_Fpath_Result = null;
                    goto gt_Error_AnotherClass;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFoundVariable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー376!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("変数[");
                s.Append(sName_Var);
                s.Append("]は存在しませんでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("ヒント:登録されている変数の個数=[");
                s.Append(this.dictionaryExpression_Item.Count);
                s.Append("]");
                s.Append(Environment.NewLine);

                s.Append("──────────ここから");
                s.Append(Environment.NewLine);
                foreach (KeyValuePair <string, Expression_Node_String> kvp in this.dictionaryExpression_Item)
                {
                    s.Append("key=[" + kvp.Key + "] value=[" + kvp.Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    s.Append(Environment.NewLine);
                }
                s.Append("──────────ここまで");
                s.Append(Environment.NewLine);


                // ヒント
                s.Append(r.Message_Configuration(ec_Name_Variable.Cur_Configuration));
                //s.Append(r.Message_Configuration(ec_Name_Variable.Cur_Configurationtree.Parent));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_AnotherClass:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー909", log_Method);
                r.Message = "変数[" + sName_Var + "]はファイルパス型を期待しましたが、ファイルパス型ではありませんでした。";
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(ec_Fpath_Result);
        }
Exemple #21
0
        /// <summary>
        /// テーブルを返します。NAME_FORM列値を指定してください。
        /// </summary>
        /// <param select="nTableName"></param>
        /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param>
        /// <returns>該当しなかった場合はヌルを返します。</returns>
        public List <Table_Humaninput> GetTable_HumaninputByFormgroup(
            Expression_Node_String expr_KeyExpected,
            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, "GetTable_HumaninputByFormgroup", log_Reports);
            //
            //

            List <Table_Humaninput> list_ResltTable = new List <Table_Humaninput>();

            if (null == expr_KeyExpected)
            {
                goto gt_EndMethod;
            }

            try
            {
                string str_KeyExpected = expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                foreach (Table_Humaninput xenonTable in this.dictionary_Table_Humaninput.Values)
                {
                    if (null != xenonTable.Tableunit &&
                        str_KeyExpected == xenonTable.Tableunit)
                    {
                        list_ResltTable.Add(xenonTable);
                    }
                }
            }
            catch (KeyNotFoundException)
            {
                if (bRequired)
                {
                    //
                    // エラー
                    goto gt_Error_NotFound;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFound:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー929!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("指定したレイアウト_グループ名[");

                t.Append(expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));

                t.Append("]は、存在しませんでした。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(list_ResltTable);
        }
Exemple #22
0
        //────────────────────────────────────────

        /// <summary>
        /// ノード名を指定して、直近の親ノードを取得したい。
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="enumConf">「Configuration_Node」「Configurationtree_Node」のいずれか。</param>
        /// <param name="bRequired">偽を指定した時は、不一致の時ヌルを返す。</param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public virtual Configuration_Node GetParentByNodename(
            string sName, EnumConfiguration enumConf, bool bRequired, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "GetParentByNodename", log_Reports);
            //
            //
            Configuration_Node result;

            Configuration_Node err_Parent_Conf;

            if (log_Reports.Successful)
            {
                if (null != this.Parent)
                {
                    // 親要素があるとき

                    if (sName == this.Parent.Name)
                    {
                        // ノード名が一致
                        result = this.Parent;
                    }
                    else
                    {
                        // ノード名が一致しないとき
                        result = this.Parent.GetParentByNodename(sName, enumConf, bRequired, log_Reports);
                    }
                }
                else
                {
                    // 親要素がないとき

                    result          = null;
                    err_Parent_Conf = null;
                    goto gt_Error_NotFoundParent;
                }
            }
            else
            {
                // 既にエラーが出ているとき

                result = null;
            }

            if (enumConf == EnumConfiguration.Tree)
            {
                if (!(result is Configurationtree_Node))
                {
                    //エラー
                    goto gt_Error_AnotherClass;
                }
            }
            else if (enumConf == EnumConfiguration.Unknown)
            {
                if (!(result is Configuration_Node))
                {
                    //エラー
                    goto gt_Error_AnotherClass;
                }
            }
            else
            {
                //エラー
                goto gt_Error_UnsupportedConfigurationType;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFoundParent:
            if (log_Reports.CanCreateReport)
            {
                if (bRequired)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー501!", log_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append("親要素の取得に失敗しました。");
                    s.Newline();


                    s.Append("指定ノード名[");
                    s.Append(sName);
                    s.Append("]");
                    s.Newline();

                    s.Append("親要素はヌルです。");
                    s.Newline();

                    if (null != err_Parent_Conf)
                    {
                        s.Append("親要素ノード名[");
                        s.Append(err_Parent_Conf.Name);
                        s.Append("]");
                        s.Newline();
                    }

                    // ヒント
                    s.Append(r.Message_Configuration(this));

                    r.Message = s.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_AnotherClass:
            if (log_Reports.CanCreateReport)
            {
                if (bRequired)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー502!", log_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append("(内部プログラム・エラー)取得した親要素は、指定のクラスとは異なりました。");
                    s.Newline();

                    s.Append("指定コンフィグ形[");
                    s.Append(enumConf);
                    s.Append("]");
                    s.Newline();

                    s.Append("取得した親要素のクラス名[");
                    s.Append(result.GetType().Name);
                    s.Append("]");
                    s.Newline();

                    // ヒント
                    s.Append(r.Message_Configuration(this));

                    r.Message = s.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_UnsupportedConfigurationType:
            if (log_Reports.CanCreateReport)
            {
                if (bRequired)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー503!", log_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append("(内部プログラム・エラー)コンフィグ・クラスの指定に対応できませんでした。");
                    s.Newline();

                    s.Append("指定コンフィグ形[");
                    s.Append(enumConf);
                    s.Append("]");
                    s.Newline();

                    //s.Append("取得した親要素のクラス名[");
                    //s.Append(result.GetType().Name);
                    //s.Append("]");
                    //s.Newline();

                    // ヒント
                    s.Append(r.Message_Configuration(this));

                    r.Message = s.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
Exemple #23
0
        //────────────────────────────────────────

        /// <summary>
        /// テーブルを、コレクションに追加します。
        /// </summary>
        /// <param select="oTable"></param>
        public void AddTable_Humaninput(
            Table_Humaninput o_Table,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "AddTable_Humaninput", log_Reports);

            string sTableName_Trimed = o_Table.Name_Table.Trim();

            if ("" == sTableName_Trimed)
            {
                // エラー
                goto gt_Error_NoName;
            }

            if (log_Reports.Successful)
            {
                if (!this.Dictionary_Table_Humaninput.ContainsKey(sTableName_Trimed))
                {
                    this.dictionary_Table_Humaninput[sTableName_Trimed] = o_Table;
                }
                else
                {
                    // エラー
                    goto gt_Error_OverlappedTableName;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NoName:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー930!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("テーブル名を指定してください。無名です。[");
                t.Append(o_Table.Name);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append("テーブルを登録するには、テーブル名が必要です。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_OverlappedTableName:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー931!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("登録しようとしたテーブルの名前は、既に登録されていました。[");
                t.Append(o_Table.Name);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append("同じ名前のテーブルは、2度登録できません。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(o_Table));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #24
0
        //────────────────────────────────────────
        #endregion



        #region 判定
        //────────────────────────────────────────

        /// <summary>
        /// (code file verseion)
        /// </summary>
        /// <param name="sCodefileVersion"></param>
        /// <param name="pg_Loggin"></param>
        /// <param name="gcav_Codefile"></param>
        /// <param name="info_Name_Node"></param>
        public static void Test_Codefileversion(
            string sCodefileVersion,
            Log_Reports pg_Loggin,
            Configurationtree_Node gcav_Codefile,
            string info_Name_Node
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0);

            pg_Method.BeginMethod(Info_Middle.Name_Library, "ValuesAttr", "Test_CodefileVersion", pg_Loggin);


            double nNow;
            bool   bSuccessful = double.TryParse(ValuesAttr.S_VERSION_CODEFILE, out nNow);

            double nFile = 0.0;

            if (bSuccessful)
            {
                bSuccessful = double.TryParse(sCodefileVersion, out nFile);
            }
            else
            {
                goto gt_Error_Parse;
            }

            if (!bSuccessful)
            {
                //エラー
                goto gt_Error_Parse;
            }


            if (bSuccessful)
            {
                if (nNow < nFile)
                {
                    // 未来のバージョンの場合。
                    goto gt_Error_FutureVersion;
                }

                if (1.0 <= (Math.Floor(nNow) - Math.Floor(nFile)))
                {
                    // メジャーバージョンが1以上古かった場合。
                    goto gt_Error_OldMajor;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_OldMajor:
            if (pg_Loggin.CanCreateReport)
            {
                Log_RecordReports r = pg_Loggin.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー41!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("指定のスクリプトファイルは、メジャーバージョンが古くて読めないバージョンでした。");
                s.Newline();
                s.Append("  スクリプトファイルのバージョン=[");
                s.Append(sCodefileVersion);
                s.Append("]");
                s.Newline();
                s.Append("  このアプリケーションのバージョン=[");
                s.Append(ValuesAttr.S_VERSION_CODEFILE);
                s.Append("]");
                s.Newline();
                s.Newline();

                //ヒント
                s.Append(r.Message_Configuration(gcav_Codefile));

                r.Message = s.ToString();
                pg_Loggin.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_FutureVersion:
            if (pg_Loggin.CanCreateReport)
            {
                Log_RecordReports r = pg_Loggin.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー41!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("指定のスクリプトファイルは、このアプリケーションより新しくて読めないバージョンでした。");
                s.Newline();
                s.Append("  スクリプトファイルのバージョン=[");
                s.Append(sCodefileVersion);
                s.Append("]");
                s.Newline();
                s.Append("  このアプリケーションのバージョン=[");
                s.Append(ValuesAttr.S_VERSION_CODEFILE);
                s.Append("]");
                s.Newline();
                s.Newline();

                //ヒント
                s.Append(r.Message_Configuration(gcav_Codefile));

                r.Message = s.ToString();
                pg_Loggin.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Parse:
            if (pg_Loggin.CanCreateReport)
            {
                Log_RecordReports r = pg_Loggin.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー41!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("指定のスクリプトファイルの、バージョンを読み取れませんでした。");
                s.Newline();
                s.Newline();
                s.Append("  スクリプトファイルに書かれていたバージョン表記=[");
                s.Append(sCodefileVersion);
                s.Append("]");
                s.Newline();
                s.Append("  期待する書き方の例: <");
                s.Append(info_Name_Node);
                s.Append(" ");
                s.Append(PmNames.S_CODEFILE_VERSION.Name_Attribute);
                s.Append("=\"");
                s.Append(ValuesAttr.S_VERSION_CODEFILE);
                s.Append("\">");
                s.Newline();
                s.Newline();

                //ヒント
                s.Append(r.Message_Configuration(gcav_Codefile));

                r.Message = s.ToString();
                pg_Loggin.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(pg_Loggin);
        }
Exemple #25
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        protected override void Parse_SAttribute(
            XmlElement cur_X,
            Configurationtree_Node cur_Cf,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "Parse_SAttr", log_Reports);
            //
            //



            //
            // name属性は必須。
            //
            string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute);

            if ("" == sName_Fnc)
            {
                goto gt_Error_UndefinedFncNameAttr;
            }


            XmlAttribute err_XAttr = null;

            if (NamesFnc.S_CELL == sName_Fnc)
            {
                foreach (XmlAttribute xAttr in cur_X.Attributes)
                {
                    // ②
                    // name,description
                    PmName pmName = PmNames.FromSAttribute(xAttr.Name);
                    if (null != pmName)
                    {
                        cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        err_XAttr = xAttr;
                        goto gt_Error_UndefinedAttr;
                    }
                }
            }
            else if (NamesFnc.S_SWITCH == sName_Fnc)
            {
                foreach (XmlAttribute xAttr in cur_X.Attributes)
                {
                    // ③
                    // name,description
                    PmName pmName = PmNames.FromSAttribute(xAttr.Name);
                    if (null != pmName)
                    {
                        cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        err_XAttr = xAttr;
                        goto gt_Error_UndefinedAttr;
                    }
                }
            }
            else if (NamesFnc.S_CASE == sName_Fnc)
            {
                foreach (XmlAttribute xAttr in cur_X.Attributes)
                {
                    // ④
                    // name,description
                    PmName pmName = PmNames.FromSAttribute(xAttr.Name);
                    if (null != pmName)
                    {
                        cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        err_XAttr = xAttr;
                        goto gt_Error_UndefinedAttr;
                    }
                }
            }
            else if (NamesFnc.S_VALUE_CONTROL == sName_Fnc)
            {
                foreach (XmlAttribute xAttr in cur_X.Attributes)
                {
                    // ⑤
                    // name,description
                    PmName pmName = PmNames.FromSAttribute(xAttr.Name);
                    if (null != pmName)
                    {
                        cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        err_XAttr = xAttr;
                        goto gt_Error_UndefinedAttr;
                    }
                }

                // value属性の指定がなければ、このコントロールの名前を入れておく。
                if (!cur_Cf.Dictionary_Attribute.ContainsKey(PmNames.S_VALUE.Name_Pm))
                {
                    Configurationtree_Node owner_Configurationtree_Control;
                    if (!(cur_Cf.Parent is Configurationtree_Node))
                    {
                        //todo:エラーか?
                        owner_Configurationtree_Control = null;
                        goto gt_Error_UndefinedClass;
                    }
                    else
                    {
                        Configurationtree_Node parent_Cf = (Configurationtree_Node)cur_Cf.Parent;

                        if (NamesNode.S_CONTROL1 == parent_Cf.Name)
                        {
                            owner_Configurationtree_Control = parent_Cf;
                        }
                        else
                        {
                            Configuration_Node parent2 = parent_Cf.GetParentByNodename(
                                NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports);
                            if (log_Reports.Successful)
                            {
                                owner_Configurationtree_Control = (Configurationtree_Node)parent2;
                            }
                            else
                            {
                                owner_Configurationtree_Control = null;
                            }
                        }
                    }

                    if (null != owner_Configurationtree_Control)
                    {
                        if (owner_Configurationtree_Control.Dictionary_Attribute.ContainsKey(PmNames.S_NAME.Name_Pm))
                        {
                            string sFcName;
                            owner_Configurationtree_Control.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sFcName, true, log_Reports);
                            cur_Cf.Dictionary_Attribute.Add(PmNames.S_VALUE.Name_Pm, sFcName, cur_Cf, true, log_Reports);
                        }
                    }
                }
            }
            else if (NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc)
            {
                foreach (XmlAttribute xAttr in cur_X.Attributes)
                {
                    string xName_AttrTrim = xAttr.Name.Trim();

                    if (
                        PmNames.S_REQUIRED.Name_Attribute == xAttr.Name || // 特にS→Eにパースは無い
                        PmNames.S_FROM.Name_Attribute == xAttr.Name || // Xn_L07_SToE:SToE_F_5FElem/Xn_L07_SToE:SToE_F_A6FromImpl
                        PmNames.S_STORAGE.Name_Attribute == xAttr.Name || // 特にS→Eにパースは無い
                        PmNames.S_FIELD.Name_Attribute == xAttr.Name    // 特にS→Eにパースは無い
                        )
                    {
                        //
                        // 属性=””
                        cur_Cf.Dictionary_Attribute.Add(xAttr.Name, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        //
                        // エラー。
                        err_XAttr = xAttr;
                        goto gt_Error_UndefinedAttr;
                    }
                }//foreach
            }
            else
            {
                foreach (XmlNode xAttr in cur_X.Attributes)
                {
                    // とりあえず、どんな属性名でも受け入れる。

                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>の属性 " + xAttr.Name + "=”" + xAttr.Value + "”");
                    }

                    //
                    // value=""
                    //

                    // ⑥
                    PmName pmName = PmNames.FromSAttribute(xAttr.Name);
                    if (null != pmName)
                    {
                        cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports);
                    }
                    else
                    {
                        cur_Cf.Dictionary_Attribute.Add(xAttr.Name, xAttr.Value, cur_Cf, true, log_Reports);
                    }

                    //
                    // 子<arg1>は、ここでは処理しない。
                    //
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedAttr:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー336!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("[");
                s.Append(cur_X.Name);
                s.Append("]要素を探索中に、未対応の属性が記述されていました。");
                s.Newline();

                s.Append("xAttr.Name=[");
                s.Append(err_XAttr.Name);
                s.Append("]");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(cur_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_UndefinedFncNameAttr:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー413!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("<fnc>要素に、name属性が指定されていませんでした。");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(cur_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_UndefinedClass:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー341!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("何らかのエラー。");
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(cur_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #26
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// Rfrファイル読取。
        ///
        /// 呼び出し元で、memoryApplicationに Stg をセットする。
        /// </summary>
        public Configurationtree_Node XmlToConfigurationtree(
            string sFpatha,//絶対ファイルパス
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports);
            //
            //

            // リローディング設定。
            Configurationtree_Node sTg_Cnf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_TOGETHERS, new Configurationtree_NodeImpl(sFpatha, null));

            System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();

            XmlElement err_XTop;
            Exception  err_Excp;

            try
            {
                xDoc.Load(sFpatha);


                // ルート要素を取得
                System.Xml.XmlElement xRoot = xDoc.DocumentElement;

                // スクリプトファイルのバージョンチェック。(関数登録ファイル)
                ValuesAttr.Test_Codefileversion(
                    xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute),
                    log_Reports,
                    new Configurationtree_NodeImpl(sFpatha, null),
                    NamesNode.S_CODEFILE_TOGETHERS
                    );

                if (log_Reports.Successful)
                {
                    XmlNodeList xTopNL = xRoot.ChildNodes;

                    foreach (XmlNode xTopNode in xTopNL)
                    {
                        if (XmlNodeType.Element == xTopNode.NodeType)
                        {
                            XmlElement xTop = (XmlElement)xTopNode;

                            if (NamesNode.S_TOGETHER == xTop.Name)
                            {
                                XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_TOGETHER, log_Reports);
                                to.XmlToConfigurationtree(
                                    xTop,
                                    sTg_Cnf,
                                    memoryApplication,
                                    log_Reports
                                    );
                            }
                            else
                            {
                                err_XTop = xTop;
                                goto gt_Error_NotSupportedChild;
                            }
                        }
                    }
                }
            }
            catch (System.IO.IOException ex)
            {
                err_Excp = ex;
                goto gt_Error_IOException;
            }
            catch (Exception ex)
            {
                err_Excp = ex;
                goto gt_Error_Exception;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotSupportedChild:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー387!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("トゥゲザー登録ファイルに、<" + NamesNode.S_TOGETHER + ">要素以外の要素[");
                t.Append(err_XTop.Name);
                t.Append("]が含まれていました。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(sTg_Cnf));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_IOException:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー388!", log_Method);

                StringBuilder t = new StringBuilder();

                t.Append("ファイルが見つかりません。");
                t.Append(Environment.NewLine);
                t.Append("absoluteFilePath=[");
                t.Append(sFpatha);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(sTg_Cnf));
                t.Append(r.Message_SException(err_Excp));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Exception:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー344!", log_Method);

                StringBuilder t = new StringBuilder();

                t.Append("読み込むファイルを間違えているかも?");
                t.Append(Environment.NewLine);
                t.Append("トゥゲザー登録ファイル(絶対パス)=[" + sFpatha + "]");
                t.Append(Environment.NewLine);
                t.Append("ex.Message=[" + err_Excp.Message + "]");
                t.Append(Environment.NewLine);
                t.Append("ex.GetType().Name=[" + err_Excp.GetType().Name + "]");

                // ヒント
                t.Append(r.Message_Configuration(sTg_Cnf));
                t.Append(r.Message_SException(err_Excp));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(sTg_Cnf);
        }
Exemple #27
0
        //────────────────────────────────────────

        protected override void Test_ChildNodes(
            XmlElement cur_X, Configurationtree_Node cur_Cf, Log_Reports log_Reports)
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "Test_ChildNodes", log_Reports);

            //
            // name属性は必須。
            //
            string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute);

            if ("" == sName_Fnc)
            {
                goto gt_Error_UndefinedFncNameAttr;
            }


            //
            //
            //
            // 「Sf:cell;」では、子要素<fnc name=”Sf:where;”>が必須。
            //
            //
            //
            int nAwhrCount = 0;//where要素の数。

            {
                if (NamesFnc.S_CELL == sName_Fnc)
                {
                    cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak)
                    {
                        string sName_Attr;
                        bool bHit = s_Child.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Attr, false, log_Reports);
                        if (bHit)
                        {
                            if (NamesFnc.S_WHERE == sName_Attr)
                            {
                                nAwhrCount++;
                            }
                        }
                    });

                    if (0 == nAwhrCount)
                    {
                        goto gt_Error_ZeroAwhr;
                    }
                    else if (1 < nAwhrCount)
                    {
                        goto gt_Error_SomeAwhr;
                    }
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedFncNameAttr:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー411!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("<fnc>要素に、name属性が指定されていませんでした。");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(cur_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_ZeroAwhr:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー377!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("func系要素の下に、<a-where>要素がありませんでした。");

                // ヒント
                s.Append(r.Message_Configuration(cur_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_SomeAwhr:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー319!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("<a-where>要素が[");
                s.Append(nAwhrCount);
                s.Append("]つありました。<a-where>要素は、<f-cell>要素の中に1つまでしか書いてはいけません。");

                // ヒント
                s.Append(r.Message_Configuration(cur_Cf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #28
0
        //────────────────────────────────────────

        public void ToMemory_DataTargetFcell(
            string sValue_Output,
            Expression_Node_String ec_SfCell,//Sf:cell;
            MemoryApplication moApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0);

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM_DataTargetFcell", log_Reports);
            //
            //


            string sName_Fnc;

            ec_SfCell.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);
            if (NamesFnc.S_CELL != sName_Fnc)
            {
                // エラー。
                goto gt_Error_NotSfcell;
            }



            // ■f-cellの子要素
            Expression_Node_String ec_KeyExpected1 = null;
            int nKeyCount = 0;

            {
                //
                //「E■f-cell」の子要素のリスト。
                ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Item, ref bool bRemove2, ref bool bBreak2)
                {
                    // キー値 が1つ入っています。
                    ec_KeyExpected1 = e_Item;
                    nKeyCount++;
                });
            }

            // それでも @keyValueを取得できなければ。
            if (null == ec_KeyExpected1)
            {
                //「E■rec-cond」を調べる。
                Expression_Node_String ec_Where;
                bool bHit2 = ec_SfCell.TrySelectAttribute(out ec_Where, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit2)
                {
                    ec_Where.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Item, ref bool bRemove2, ref bool bBreak2)
                    {
                        if (NamesNode.S_FNC == e_Item.Cur_Configuration.Name)
                        {
                            //ystem.Console.WriteLine(Info_Forms.LibraryName + ":" + this.GetType().Name + "#ToM: 「E■f-cell」の「E■@where」属性の下の「E■fnc」を解析。その子要素がvalue相当であるはず。");
                            ec_KeyExpected1 = e_Item;
                        }
                        else
                        {
                        }
                    });
                }
            }


            if (1 < nKeyCount)
            {
                ec_KeyExpected1 = null;

                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー311!", pg_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();

                    s.Append("「E■f-cell」系要素の子要素が、「E■rec-cond」を除いて[" + nKeyCount + "]個ありました。");
                    s.Newline();

                    s.Append("この子要素は キー値になるもので、1個でなければいけません。");
                    s.Newline();

                    // 一覧
                    s.Append("──────────子要素名一覧");
                    s.Newline();

                    ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Str1, ref bool bRemove2, ref bool bBreak2)
                    {
                        if ("" == e_Str1.Cur_Configuration.Name)
                        {
                            s.Append("E■(要素名無し)");
                            s.Newline();
                        }
                        else
                        {
                            s.Append("E■");
                            s.Append(e_Str1.Cur_Configuration.Name);
                            s.Newline();
                        }
                    });
                    s.Append("──────────");
                    s.Newline();

                    // ヒント
                    s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                    r.Message = s.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            else if (null == ec_KeyExpected1)
            {
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー312!", pg_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();

                    //s.Append("「E■f-cell」系要素の子要素に、「E■f-text」や「E■f-cell」が無いのか、有っても値がありませんでした。");
                    s.Append("「E■f-cell」の「keyValue」相当の値が指定されていませんでした。");
                    s.Newline();

                    // 一覧
                    s.Append("──────────子要素名一覧");
                    s.Newline();
                    ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Str1, ref bool bRemove2, ref bool bBreak2)
                    {
                        if ("" == e_Str1.Cur_Configuration.Name)
                        {
                            s.Append("E■(要素名無し)");
                            s.Newline();
                        }
                        else
                        {
                            s.Append("E■");
                            s.Append(e_Str1.Cur_Configuration.Name);
                            s.Newline();
                        }
                    });
                    s.Append("──────────");
                    s.Newline();

                    // ヒント
                    s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                    r.Message = s.ToString();
                    log_Reports.EndCreateReport();
                }
            }

            if (log_Reports.Successful)
            {
                //
                // <f-cell>1つにつき。
                //
                ExpressionToMemory_FcellImpl to = new ExpressionToMemory_FcellImpl();
                to.Translate(
                    sValue_Output,
                    ec_KeyExpected1,
                    ec_SfCell,// <f-cell>相当と想定。
                    moApplication,
                    log_Reports
                    );
            }

            goto gt_EndMethod;
            //
            //
gt_Error_NotSfcell:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー909!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("Sf:cell;でないExpression_Node_Stringが指定されました。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));
                if (null != ec_SfCell)
                {
                    ec_SfCell.ToText_Snapshot(s);
                }

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Exemple #29
0
        //────────────────────────────────────────

        /// <summary>
        /// <f-cell>→M
        /// </summary>
        /// <param name="outputValueStr"></param>
        /// <param name="nKeyExpected"></param>
        /// <param name="nFcell"></param>
        /// <param name="moApplication"></param>
        /// <param name="log_Reports"></param>
        public void Translate(
            string sOutputValue,
            Expression_Node_String ec_KeyExpected,
            Expression_Node_String ec_SfCell,//Sf:cell;相当と想定。
            MemoryApplication moApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0);

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "EToM2", log_Reports);
            //
            //

            string sName_Fnc;

            ec_SfCell.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);
            if (NamesFnc.S_CELL != sName_Fnc)
            {
                // エラー。
                goto gt_Error_NotSfcell;
            }


            string sSelectedFldName;

            if (log_Reports.Successful)
            {
                bool bHit = ec_SfCell.TrySelectAttribute(
                    out sSelectedFldName,
                    PmNames.S_SELECT.Name_Pm,
                    EnumHitcount.One_Or_Zero,
                    log_Reports
                    );

                //if (!bHit)
                //{
                //    // 【追加 2012-07-10】
                //    // Sf:cell; の子要素arg1 には、name="select" のものがある。本来これは属性連結しておいて欲しい。
                //    List<Expression_Node_String> list_Arg1 = e_SfCell.SelectDirectchildByNodename(NamesNode.S_ARG1, false, EnumHitcount.Unconstraint, log_Reports);

                //    d_InMethod.WriteDebug_ToConsole(1, "sSelectedFldNameが属性になかった。子要素arg1(" + list_Arg1 .Count+ "個)から探す。");
                //    if (0<d_InMethod.NDebugLevel && list_Arg1.Count<=0)
                //    {
                //        Log_TextIndented s = new Log_TextIndentedImpl();
                //        e_SfCell.ToText_Snapshot(s);
                //        d_InMethod.WriteDebug_ToConsole(1, s.ToString());
                //    }

                //    EUtil_NodeImpl.SelectItemsByAttrAsCsv(list_Arg1, PmNames.NAME.SAttrName, ValuesAttr.S_SELECT, false, EnumHitcount.First_Exist, log_Reports);

                //    if (log_Reports.Successful)
                //    {
                //        sSelectedFldName = list_Arg1[0].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                //    }
                //}
            }
            else
            {
                sSelectedFldName = "";
            }


            Expression_Node_String ec_KeyFldName1 = null;

            if (log_Reports.Successful)
            {
                Expression_Node_String ec_Where = null;

                //
                // 「E■where」は子要素。
                //

                // 再検索。
                ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String ec_Child, ref bool bRemove, ref bool bBreak)
                {
                    string sValue;
                    ec_Child.TrySelectAttribute(out sValue, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);

                    if (NamesNode.S_FNC == ec_Child.Cur_Configuration.Name &&
                        NamesFnc.S_WHERE == sValue)
                    {
                        ec_Where = ec_Child;

                        if (pg_Method.CanDebug(2))
                        {
                            pg_Method.WriteDebug_ToConsole("子「E■[" + ec_Child.Cur_Configuration.Name + "]」。子要素数=[" + ec_Where.List_Expression_Child.Count + "]");
                        }

                        ec_Where.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Item, ref bool bRemove2, ref bool bBreak2)
                        {
                            if (NamesNode.S_FNC == e_Item.Cur_Configuration.Name)
                            {
                                Expression_Node_String ec_Field;
                                bool bHit3 = e_Item.TrySelectAttribute(out ec_Field, PmNames.S_FIELD.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                                if (bHit3)
                                {
                                    //「E■f-cell」/「E■@where」/「E■fnc field=”★”」。
                                    ec_KeyFldName1 = ec_Field;

                                    if (pg_Method.CanDebug(2))
                                    {
                                        pg_Method.WriteDebug_ToConsole("「E■f-cell」/「E■a-where」/「E■fnc field=”[" + ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]”」。");
                                    }
                                }
                                else
                                {
                                    throw new Exception("ここは通らない?");
                                }
                            }
                            else
                            {
                                // #エラー
                                System.Console.WriteLine(Info_Controls.Name_Library + ":" + this.GetType().Name + "#EToM: 「E■fnc」がありませんでした。");
                            }
                        });
                    }
                    else
                    {
                        if (pg_Method.CanDebug(2))
                        {
                            pg_Method.WriteDebug_ToConsole("(無視)  子「E■[" + ec_Child.Cur_Configuration.Name + "]」。");
                        }
                    }
                });

                if (null == ec_Where)
                {
                    // #エラー
                    System.Console.WriteLine(Info_Controls.Name_Library + ":" + this.GetType().Name + "#EToM: 「E■f-cell」に、子「E■where」が無かった? そういう場合(無条件)もある。");
                }
            }
            else
            {
                ec_KeyFldName1 = null;
            }


            //
            // from
            //
            Expression_Node_String ec_TableName1;//ソース情報利用

            if (log_Reports.Successful)
            {
                // Sf:cell; に from が指定されていない?
                bool bHit = ec_SfCell.TrySelectAttribute(
                    out ec_TableName1,
                    PmNames.S_FROM.Name_Pm,
                    EnumHitcount.One,
                    log_Reports
                    );

                //if (null == e_TableName1)
                //{
                //    d_InMethod.WriteDebug_ToConsole(1, "e_TableName1が属性になかった。子要素arg1から探す。");
                //    // 【追加 2012-07-10】
                //    // Sf:cell; の子要素arg1 には、name=”from” のものがある。本来これは属性連結しておいて欲しい。
                //    List<Expression_Node_String> list_Arg1 = e_SfCell.SelectDirectchildByNodename(NamesNode.S_ARG1, false, EnumHitcount.Unconstraint, log_Reports);
                //    EUtil_NodeImpl.SelectItemsByAttrAsCsv(list_Arg1, PmNames.NAME.SAttrName, ValuesAttr.S_FROM, false, EnumHitcount.First_Exist, log_Reports);

                //    if (log_Reports.Successful)
                //    {
                //        e_TableName1 = list_Arg1[0];
                //    }
                //}
            }
            else
            {
                ec_TableName1 = null;
            }


            //
            // required
            //
            bool bExpectedValueRequired = false;

            if (log_Reports.Successful)
            {
                string sRequired1;
                bool   bHit = ec_SfCell.TrySelectAttribute(out sRequired1, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit)
                {
                    // 【旧仕様】
                    bool bParseSuccessful = bool.TryParse(sRequired1, out bExpectedValueRequired);
                }
                else
                {
                    // 【新仕様】

                    //
                    // 新仕様では、「E■f-cell/@E■where/E■prm name=”required”」。
                    //
                    {
                        Expression_Node_String ec_Where;
                        bool bHit1 = ec_SfCell.TrySelectAttribute(out ec_Where, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                        if (bHit1)
                        {
                            throw new Exception("こーこは通らない?");
                        }
                    }
                }
            }
            else
            {
            }


            // e_TableName を取得してから引数エラーチェック。
            if (null == ec_KeyExpected)
            {
                // エラー
                goto gt_Error_NullKeyExpected;
            }

            // ──────────

            Table_Humaninput o_Table;

            if (log_Reports.Successful)
            {
                o_Table = moApplication.MemoryTables.GetTable_HumaninputByName(ec_TableName1, true, log_Reports);
                // エラー時には、エラーメッセージを出させます。

                if (null == o_Table)
                {
                    //
                    // エラー中断。
                    goto gt_Error_NotFoundTable;
                }
                else
                {
                    //
                    // 正常時
                    //
                    //.WriteLine("(" + Info_Forms .LibraryName+ ")" + this.GetType().NFcName + "#...: (1)テーブル検索終了 refOTable=[" + refOTable.SourceFilePath + "]");
                }
            }
            else
            {
                o_Table = null;
            }


            string err_SKeyFldName;
            string err_SSelectedFldName;

            // field=""。
            Fielddefinition o_KeyFldDef;

            if (log_Reports.Successful)
            {
                //
                // 検索のキーとなるフィールドの定義を調べます。
                //

                List <string> sList_KeyFldName;
                {
                    sList_KeyFldName = new List <string>();

                    string sKeyFldName = ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                    if ("" == sKeyFldName.Trim())
                    {
                        // エラー
                        err_SKeyFldName = sKeyFldName;
                        goto gt_Error_EmptyKeyField;
                    }
                    sList_KeyFldName.Add(sKeyFldName);
                    if (sList_KeyFldName.Count < 1)
                    {
                        // エラー
                        err_SKeyFldName = sKeyFldName;
                        goto gt_Error_ZeroKeyField;
                    }
                }

                RecordFielddefinition recordFielddefinition;
                bool bHit = o_Table.TryGetFieldDefinitionByName(
                    out recordFielddefinition,
                    sList_KeyFldName,
                    true,
                    log_Reports
                    );
                if (!log_Reports.Successful || !bHit)
                {
                    goto gt_EndMethod;
                }

                o_KeyFldDef = recordFielddefinition.ValueAt(0);
            }
            else
            {
                o_KeyFldDef = null;
            }


            RecordFielddefinition recordFielddefinition_Selected;

            if (log_Reports.Successful)
            {
                // 選択対象のフィールドの定義を調べます。

                List <string> sList_SelectedFldName;
                {
                    sList_SelectedFldName = new CsvTo_ListImpl().Read(sSelectedFldName);
                    foreach (string sName in sList_SelectedFldName)
                    {
                        if ("" == sName.Trim())
                        {
                            // エラー
                            err_SSelectedFldName = sSelectedFldName;
                            goto gt_Error_EmptySelectField;
                        }
                    }

                    if (sList_SelectedFldName.Count < 1)
                    {
                        // エラー
                        err_SSelectedFldName = sSelectedFldName;
                        goto gt_Error_ZeroSelectField;
                    }
                }

                bool bHit = o_Table.TryGetFieldDefinitionByName(
                    out recordFielddefinition_Selected,
                    sList_SelectedFldName,
                    false,
                    log_Reports
                    );
                if (!log_Reports.Successful || !bHit)
                {
                    goto gt_EndMethod;
                }
            }
            else
            {
                recordFielddefinition_Selected = null;
            }



            if (log_Reports.Successful)
            {
                if (null == o_KeyFldDef)
                {
                    //
                    // エラー中断。
                    goto gt_Error_NotFoundKeyFldDefinition;
                }
            }



            if (log_Reports.Successful)
            {
                if (recordFielddefinition_Selected.Count < 1)
                {
                    //
                    // エラー中断。
                    goto gt_Error_NotFoundSelectFldDefinition;
                }
            }


            if (log_Reports.Successful)
            {
                List <DataRow> dst_Row = new List <DataRow>();


                string             sKeyFieldName         = ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                string             sExpectedValue        = ec_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                Configuration_Node cf_WrittenPlace_Query = ec_SfCell.Cur_Configuration;

                SelectPerformerImpl sp = new SelectPerformerImpl();
                sp.Select(
                    out dst_Row,
                    sKeyFieldName,
                    sExpectedValue,
                    bExpectedValueRequired,
                    o_KeyFldDef,
                    o_Table.DataTable,
                    cf_WrittenPlace_Query,
                    log_Reports
                    );



                if (0 < dst_Row.Count)
                {
                    //.WriteLine("(" + Info_Forms .LibraryName+ ")" + this.GetType().NFcName + "#...: (6a)該当 recordSet.Count=[" + recordSet.Count + "]");

                    foreach (DataRow row in dst_Row)
                    {
                        ToMemory_CellImpl updater = new ToMemory_CellImpl();

                        recordFielddefinition_Selected.ForEach(delegate(Fielddefinition fielddefinition_Selected, ref bool isBreak2, Log_Reports log_Reports2)
                        {
                            updater.ToMemory_ToSelectedField(
                                sOutputValue,
                                ec_SfCell,
                                row,
                                fielddefinition_Selected,
                                log_Reports
                                );
                        }, log_Reports);
                    }
                }
                else
                {
                    // エラー。
                    goto gt_Error_NotFoundRecord;
                }
            }

            goto gt_EndMethod;
            //
            //
gt_Error_NotSfcell:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー909!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("Sf:cell;でないExpression_Node_Stringが指定されました。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));
                if (null != ec_SfCell)
                {
                    ec_SfCell.ToText_Snapshot(s);
                }

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //
            //
gt_Error_NullKeyExpected:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー906!", pg_Method);

                StringBuilder s = new StringBuilder();

                s.Append("引数e_KeyExpectedにヌルが指定されました。 e_KeyExpected=[");
                s.Append(ec_KeyExpected);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  this.TableName=[");
                s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

gt_Error_EmptyKeyField:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー903!", pg_Method);

                StringBuilder s = new StringBuilder();

                s.Append("fieldで指定されたキーフィールドの名前が空文字列でした。 err_SKeyFldName=[");
                s.Append(err_SKeyFldName);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  this.TableName=[");
                s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

gt_Error_ZeroKeyField:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー902!", pg_Method);

                StringBuilder s = new StringBuilder();

                s.Append("fieldで指定されたキーフィールドの個数が0個でした。 err_SKeyFldName=[");
                s.Append(err_SKeyFldName);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  this.TableName=[");
                s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

gt_Error_EmptySelectField:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー904!", pg_Method);

                StringBuilder s = new StringBuilder();

                s.Append("selectで指定されたフィールドの名前に空文字列がありました。 err_SSelectedFldName=[");
                s.Append(err_SSelectedFldName);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  this.TableName=[");
                s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

gt_Error_ZeroSelectField:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー901!", pg_Method);

                StringBuilder s = new StringBuilder();

                s.Append("selectで指定されたフィールドの個数が0個でした。 err_SSelectedFldName=[");
                s.Append(err_SSelectedFldName);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  this.TableName=[");
                s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

            // エラー。
gt_Error_NotFoundTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー1011!", pg_Method);

                StringBuilder s = new StringBuilder();

                s.Append(" ヌル=refTable");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  this.TableName=[");
                s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

gt_Error_NotFoundKeyFldDefinition:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー478!", pg_Method);

                StringBuilder t = new StringBuilder();

                t.Append(" キーフィールドの定義を取得できませんでした。");
                t.Append(Environment.NewLine);

                t.Append("「E■[");
                t.Append(ec_KeyFldName1.Cur_Configuration.Name);
                t.Append("]」、キーフィールド名=[");
                t.Append(ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

gt_Error_NotFoundSelectFldDefinition:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー479!", pg_Method);

                StringBuilder t = new StringBuilder();

                t.Append(" 取得データが入っているはずのフィールドの定義を取得できませんでした。");
                t.Append(Environment.NewLine);
                t.Append("  指定されたフィールド名=[");
                t.Append(sSelectedFldName);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;

gt_Error_NotFoundRecord:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー344!", pg_Method);

                string sDebugExceptedKey = ec_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("【失敗】");
                s.Newline();
                s.Newline();

                s.Append("[");
                s.Append(o_Table.Name);
                s.Append("](テーブル)には、");
                s.Append(Environment.NewLine);

                s.Append("[");
                s.Append(ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                s.Append("]フィールドに");

                s.Append("[");
                s.Append(sDebugExceptedKey);
                s.Append("]が入っているレコードは、見つかりませんでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);
                s.Append("この入力したデータは、入力が確定されず、無視されています。");
                s.Append(Environment.NewLine);

                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);
                s.Append("もしかして?");
                s.Append(Environment.NewLine);
                s.Append(" ・ツールの不便さにより、手入力で");
                s.Append(Environment.NewLine);
                s.Append("  指定のテーブルに ID付きのレコードの空欄を");
                s.Append(Environment.NewLine);
                s.Append("  予め 作っておかなければならなかった、といった決まりごとはありませんか?");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);
                s.Append(" ・それとも、それ以外の理由?");
                s.Append(Environment.NewLine);

                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);
                s.Append("────────以下はプログラマー用の情報。");
                s.Append(Environment.NewLine);


                // ヒント
                s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration));

                r.Message = s.ToString();

                //essageBox.Show(r.SMsg(log_Reports), Info_Forms.LibraryName + ":" + this.GetType().Name );
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Exemple #30
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// パーサーのハブ。
        ///
        /// </summary>
        /// <param name="request_ReadsTable">テーブルに付けたい名前や、ファイルパスの要求。</param>
        /// <param name="xenonTableFormat_puts">テーブルの行列が逆になっているなどの、設定。</param>
        /// <param name="isRequired">テーブルが無かった場合、エラーとするなら真。</param>
        /// <param name="out_sErrorMsg"></param>
        /// <returns></returns>
        public Table_Humaninput Read(
            Request_ReadsTable request_ReadsTable,
            Format_Table_Humaninput xenonTableFormat_puts,
            bool isRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, this, "Read", log_Reports);



            Table_Humaninput xenonTable_Result;

            string filepathabsolute_Csv = request_ReadsTable.Expression_Filepath.Execute4_OnExpressionString(
                EnumHitcount.Unconstraint, log_Reports);

            if (!log_Reports.Successful)
            {
                // 既エラー。
                xenonTable_Result = null;
                goto gt_EndMethod;
            }

            string string_Csv;

            // CSVテキスト
            Exception error_Excp;

            if (CsvTo_Table_HumaninputImpl.S_WRITE_ONLY != request_ReadsTable.Use)
            {
                // 書き出し専用でなければ。
                // ファイル読取を実行します。

                try
                {
                    if (!System.IO.File.Exists(filepathabsolute_Csv))
                    {
                        // ファイルが存在しない場合。
                        xenonTable_Result = null;
                        goto gt_Error_NotExistsFile;
                    }

                    // TODO:IOException 別スレッドで開いているときなど。

                    string_Csv = System.IO.File.ReadAllText(filepathabsolute_Csv, Global.ENCODING_CSV);
                    //log_Method.WriteDebug_ToConsole(string_Csv);
                }
                catch (System.IO.IOException e)
                {
                    // エラー処理。
                    xenonTable_Result = null;
                    string_Csv        = "";
                    error_Excp        = e;
                    goto gt_Error_FileOpen;
                }
                catch (Exception e)
                {
                    // エラー処理。
                    xenonTable_Result = null;
                    string_Csv        = "";
                    error_Excp        = e;
                    goto gt_Error_Exception;
                }
            }
            else
            {
                string_Csv = "";
            }

            xenonTable_Result = this.Read(
                string_Csv,
                request_ReadsTable,
                xenonTableFormat_puts,
                log_Reports
                );
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            // NOフィールドの値を 0からの連番に振りなおします。
            xenonTable_Result.RenumberingNoField();

            if (isRequired && null == xenonTable_Result)
            {
                goto gt_Error_NullTable;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_FileOpen:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("Er:201;", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("ファイルの読取りに失敗しました。");
                s.Newline();
                s.Newline();

                s.Append(" ファイル=[");
                s.Append(filepathabsolute_Csv);
                s.Append("]");
                s.Newline();
                s.Newline();

                s.Append("もしかして?");
                s.Newline();

                s.Append(" ・ファイルの有無、ファイル名、ファイル パスを確認してください。");
                s.Newline();
                s.Append(" ・別アプリケーションで ファイルを開いていれば、閉じてください。");
                s.Newline();
                s.Newline();

                //
                // ヒント
                request_ReadsTable.Expression_Filepath.Cur_Configuration.ToText_Locationbreadcrumbs(s);
                s.Append(error_Excp.Message);

                r.Message = s.ToString();

                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_NotExistsFile:
            if (log_Reports.CanCreateReport)
            {
                if ("" == request_ReadsTable.Expression_Filepath.Directory_Base)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("Er:202;", log_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append("指定されたファイルはありませんでした。CSVファイルを読み込もうとしたとき。");
                    s.Newline();
                    s.Newline();

                    s.AppendI(1, "指定されたファイルパス=[");
                    s.Append(filepathabsolute_Csv);
                    s.Append("]");
                    s.Newline();

                    {
                        s.AppendI(1, "ベース・ディレクトリは指定されていません。");
                        s.Newline();
                        s.AppendI(2, "もし相対パスが指定されていた場合、実行した.exeファイルからの相対パスとします。");
                        s.Newline();
                        s.Newline();
                    }

                    s.Append(" ヒント:ファイルの有無、ファイル名、ファイル パスを確認してください。");
                    s.Newline();

                    // ヒント
                    s.Append(r.Message_Configuration(
                                 request_ReadsTable.Expression_Filepath.Cur_Configuration));
                    r.Message = s.ToString();
                }
                else
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー235!", log_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append("指定されたファイルはありませんでした。CSVファイルを読み込もうとしたとき。");
                    s.Newline();
                    s.Newline();

                    s.AppendI(1, "指定されたファイルパス=[");
                    s.Append(filepathabsolute_Csv);
                    s.Append("]");
                    s.Newline();

                    {
                        s.AppendI(1, "指定されたベース・ディレクトリ=[");
                        s.Append(request_ReadsTable.Expression_Filepath.Directory_Base);
                        s.Append("]");
                        s.Newline();
                        s.Newline();
                    }

                    s.Append(" ヒント:ファイルの有無、ファイル名、ファイル パスを確認してください。");
                    s.Newline();

                    // ヒント
                    s.Append(r.Message_Configuration(
                                 request_ReadsTable.Expression_Filepath.Cur_Configuration));
                    r.Message = s.ToString();
                }


                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Exception:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー104!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("▲エラー4030!(" + Info_Table.Name_Library + ")");
                s.Newline();
                s.Append("CSV読み取り中にエラーが発生しました。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);
                s.Append("指定CSVファイル=[");
                s.Append(filepathabsolute_Csv);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                //
                // ヒント
                request_ReadsTable.Expression_Filepath.Cur_Configuration.ToText_Locationbreadcrumbs(s);


                s.Append("エラーの種類:");
                s.Append(error_Excp.GetType().Name);
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);
                s.Append("エラーメッセージ:");
                s.Append(error_Excp.Message);

                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("▲エラー105!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("▲エラー131!");
                s.Newline();
                s.Append("[");
                s.Append(request_ReadsTable.Name_PutToTable);
                s.Append("]テーブルがありませんでした。");
                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);
            return(xenonTable_Result);
        }