示例#1
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="name">引数名</param>
        /// <param name="value">その値</param>
        /// <param name="cElm">引数のコンフィグ</param>
        /// <param name="eParent">親Expr</param>
        /// <param name="isRequired"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public bool TryGetValue2(
            PmName name,
            out Expr_String value,
            Conf_String cElm,
            Expr_String eParent,
            bool isRequired,
            Log_Reports log_Reports
            )
        {
            bool isHit = false;

            string s;//コントロール名

            this.TryGetValue(name, out s, isRequired, log_Reports);

            if (log_Reports.Successful)
            {
                value = new Expr_LeafStringImpl(s, eParent, cElm);
                isHit = true;
            }
            else
            {
                value = null;
            }

            return(isHit);
        }
        //────────────────────────────────────────
        /// <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;
        }
示例#3
0
        //────────────────────────────────────────

        private static void RegisterAttributeDictionary_(Dictionary <string, PmName> d, PmName pmName)
        {
            d.Add(pmName.Name_Attribute, pmName);
        }
示例#4
0
        //────────────────────────────────────────

        public PmNameItemImpl(PmName pmName, bool bRequired)
        {
            this.pmName    = pmName;
            this.bRequired = bRequired;
        }
示例#5
0
        //────────────────────────────────────────

        public void ConfigurationtreeToUsercontrol(
            Configurationtree_Node cur_Cf,//Sv_3Validator <validator>
            Usercontrol ucontrol,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToFc", log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(41)" + cur_Cf.Name);
            }

            //
            //
            //
            //

            string    err_SParameterValue = null;
            Exception err_Excp            = null;
            string    err_SValue          = null;
            string    err_SName_Validator = null;



            EnumValidation_Old enumResult = EnumValidation_Old.Thru;

            if (cur_Cf.Dictionary_Attribute.ContainsKey(PmNames.S_VALUE_RESULT.Name_Pm))
            {
                string sValue_Parameter;
                cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE_RESULT, out sValue_Parameter, true, log_Reports);
                switch (sValue_Parameter)
                {
                case "OK":
                    enumResult = EnumValidation_Old.Ok;
                    break;

                case "NG":
                    enumResult = EnumValidation_Old.Ng;
                    break;

                case "THRU":
                    enumResult = EnumValidation_Old.Thru;
                    break;

                default:
                    //
                    // エラー。
                    goto gt_Error_UndefinedValidator02;
                }
            }



            string sName;
            string sName_ValidatorTrim;

            {
                PmName pmName = PmNames.S_NAME;
                if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                {
                    cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sName, true, log_Reports);
                    sName_ValidatorTrim = sName.Trim();
                }
                else
                {
                    sName = "";
                    sName_ValidatorTrim = "";
                }
            }



            //
            // バリデーターの選択
            switch (sName_ValidatorTrim)
            {
            case NamesFnc.S_VLD_SPACES:
            {
                // SToE:
                Expressionv_SpacesTextValidator_Old nValidator = new Expressionv_SpacesTextValidator_Old(enumResult);

                ucontrol.AddValidator(
                    nValidator,
                    log_Reports
                    );
            }
            break;

            case NamesFnc.S_VLD_MATCH:
            {
                string sValue_Parameter;
                cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_EXPECTED, out sValue_Parameter, false, log_Reports);
                err_SParameterValue = sValue_Parameter;

                // SToE:
                Expressionv_MatchTextValidator_Old ecv_Validator = new Expressionv_MatchTextValidator_Old(sValue_Parameter);

                ucontrol.AddValidator(
                    ecv_Validator,
                    log_Reports
                    );
            }
            break;

            case NamesFnc.S_VLD_INT_RANGE:
            {
                bool bSuccessful = true;
                int  nBeginValue = 0;
                if (bSuccessful)
                {
                    string sBegin;
                    cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_BEGIN, out sBegin, false, log_Reports);

                    if (!int.TryParse(sBegin, out nBeginValue))
                    {
                        // エラー。
                        err_Excp   = null;
                        err_SValue = sBegin;
                        goto gt_Error_InvalidatedBegin02;
                    }
                }

                int nEndValue = 0;
                if (bSuccessful)
                {
                    string sEnd;
                    cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_END, out sEnd, false, log_Reports);

                    if (!int.TryParse(sEnd, out nEndValue))
                    {
                        // エラー。
                        err_Excp   = null;
                        err_SValue = sEnd;
                        goto gt_Error_InvalidatedEnd02;
                    }
                }

                if (bSuccessful)
                {
                    // SToE:
                    Expressionv_IntRangeTextValidator_Old nValidator = new Expressionv_IntRangeTextValidator_Old(nBeginValue, nEndValue);

                    ucontrol.AddValidator(
                        nValidator,
                        log_Reports
                        );
                }
            }
            break;

            case NamesFnc.S_VLD_ALL:
            {
                // SToE:
                Expressionv_AllTextValidator_Old ecv_Validator = new Expressionv_AllTextValidator_Old(enumResult);

                ucontrol.AddValidator(
                    ecv_Validator,
                    log_Reports
                    );
            }
            break;

            default:
                //
                // エラー。
                err_SName_Validator = sName;
                goto gt_Error_UndefinedValidator03;
            }//switch

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedValidator02:
            // TODO 未定義のバリデーターの場合。
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, PmNames.S_VALUE_RESULT.Name_Pm, log_Reports); //引数名
                tmpl.SetParameter(2, err_SParameterValue, log_Reports);            //バリデーター名

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7012;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_InvalidatedBegin02:
            // 設定エラー
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, PmNames.S_BEGIN.Name_Pm, log_Reports);                          //属性名
                tmpl.SetParameter(2, err_SValue, log_Reports);                                       //属性値
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7013;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_InvalidatedEnd02:
            // 設定エラー
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, PmNames.S_END.Name_Pm, log_Reports);                            //属性名
                tmpl.SetParameter(2, err_SValue, log_Reports);                                       //属性値
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7014;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_UndefinedValidator03:
            // TODO 未定義のバリデーターの場合。
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_SName_Validator, log_Reports);//バリデーター名

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7015;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
示例#6
0
 //────────────────────────────────────────
 public PmNameItemImpl(PmName pmName, bool bRequired)
 {
     this.pmName = pmName;
     this.bRequired = bRequired;
 }
示例#7
0
        //────────────────────────────────────────

        /// <summary>
        /// <要素名 属性=”☆”> の、属性部分を解析。
        /// </summary>
        /// <param name="x_Cur"></param>
        /// <param name="s_Cur"></param>
        /// <param name="memoryApplication"></param>
        /// <param name="log_Reports"></param>
        protected virtual 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);


            //
            //
            //
            //()全属性解析
            //
            //
            //
            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
                    {
                        // エラー
                        err_XAttr = xAttr;
                        goto gt_Error_UndefinedAttr;

                        //// 【廃止方針】
                        //if (log_Method.CanInfo())
                        //{
                        //    log_Method.WriteInfo_ToConsole("廃止方針のAdd([" + x_Attr.Name + "], [" + x_Attr.Value + "])");
                        //}

                        //throw new Exception("廃止方針のAdd([" + x_Attr.Name + "], [" + x_Attr.Value + "])");
                        //s_Cur.Dictionary_Attribute.Add(x_Attr.Name, x_Attr.Value, s_Cur, true, log_Reports);
                    }
                }
                else
                {
                    err_XAttr = xAttr;
                    goto gt_Error_UndefinedAttr;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedAttr:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, cur_X.Name, log_Reports);                                         //設定ノード名
                tmpl.SetParameter(2, err_XAttr.Name, log_Reports);                                     //属性名
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports); //設定位置パンくずリスト

                memoryApplication.CreateErrorReport("Er:8008;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#8
0
        //────────────────────────────────────────

        public override void Translate(
            Configurationtree_Node cur_Cf,    //<lookup-id>
            Expression_Node_String parent_Ec, //< Sf:text-template;>
            MemoryApplication memoryApplication,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE", log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(9)" + cur_Cf.Name);
            }

            //
            //

            //
            //
            //
            // 自
            //
            //
            //
            Expression_Node_String cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf);


            //
            //
            //
            // 親へ連結 (value属性)
            //
            //
            //
            {
                //
                // 自要素の value="" 属性を、親へ連結
                //
                PmName pmName = PmNames.S_VALUE;

                string sValue;
                bool   bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports);
                if (bHit)
                {
                    cur_Ec.AppendTextNode(
                        sValue,
                        cur_Cf,
                        log_Reports
                        );

                    //
                    //
                    //
                    // 子
                    //
                    //
                    //
                    this.ParseChild_InConfigurationtreeToExpression(
                        cur_Cf,
                        cur_Ec,//自
                        memoryApplication,
                        pg_ParsingLog,
                        log_Reports
                        );

                    //
                    //
                    //
                    // 親へ連結 ※属性連結
                    //
                    //
                    //
                    parent_Ec.SetAttribute(PmNames.S_LOOKUP_ID.Name_Pm, cur_Ec, log_Reports);

                    goto gt_EndMethod;
                }
                else
                {
                }
            }


            //
            //
            //
            // 子
            //
            //
            //
            {
                //<a-default>の子要素を確認し、親<f-switch>のdefault属性に追加します。

                this.ParseChild_InConfigurationtreeToExpression(
                    cur_Cf,
                    cur_Ec,
                    memoryApplication,
                    pg_ParsingLog,
                    log_Reports
                    );
            }


            //
            //
            //
            // 親へ連結
            //
            //
            //
            parent_Ec.SetAttribute(PmNames.S_LOOKUP_ID.Name_Pm, cur_Ec, log_Reports);


            //
            //
            //
            // 親へ連結 debug
            //
            //
            //
            if (log_Method.CanDebug(1))
            {
                string parent_SName_Fnc;
                parent_Ec.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                log_Method.WriteDebug_ToConsole(" ☆☆☆☆☆☆☆☆ 親<[" + parent_Ec.Cur_Configuration.Name + "] name=”[" + parent_SName_Fnc + "]” >");

                string sName_MyFnc;
                cur_Ec.TrySelectAttribute(out sName_MyFnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                log_Method.WriteDebug_ToConsole(" ☆☆☆☆☆☆☆☆ 自<[" + cur_Ec.Cur_Configuration.Name + "] name=”[" + sName_MyFnc + "]” >");
            }


            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
示例#9
0
        //────────────────────────────────────────

        /// <summary>
        /// 例えば ("access","from")と指定すれば、
        /// 指定リストの要素の中で 「~ access=”from,to”」 といった属性を持つものはヒットする。
        ///
        /// 選択アイテムをリストから除外するなら bRemove=true にします。
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="sExpectedValue"></param>
        /// <param name="request_Items"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public static List <Configurationtree_Node> SelectItemsBySAttrAsCsv(
            List <Configurationtree_Node> items,
            PmName pmName /*string sName_Attr*/,
            string sValue_Expected,
            bool bRemove,
            EnumHitcount hits,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_XmlToConf.Name_Library, "Util_XmlToConfigurationtree_NodeImpl", "SelectItemsBySAttrAsCsv", log_Reports);

            List <Configurationtree_Node> cfList_Result = new List <Configurationtree_Node>();

            for (int nI = 0; nI < items.Count; nI++)
            {
                Configurationtree_Node cf_Item = items[nI];

                if (log_Reports.Successful)
                {
                    string sValue_Attr;
                    bool   bHit = cf_Item.Dictionary_Attribute.TryGetValue(pmName, out sValue_Attr, false, log_Reports);
                    if (bHit)
                    {
                        CsvTo_ListImpl to          = new CsvTo_ListImpl();
                        List <string>  sList_Value = to.Read(sValue_Attr);

                        if (sList_Value.Contains(sValue_Expected))
                        {
                            cfList_Result.Add(cf_Item);

                            if (bRemove)
                            {
                                // 削除
                                items.RemoveAt(nI);
                                nI--;
                            }


                            if (EnumHitcount.First_Exist == hits ||
                                EnumHitcount.First_Exist_Or_Zero == hits)
                            {
                                // 最初の1件で削除は終了。複数件ヒットするかどうかは判定しない。
                                break;
                            }
                        }
                    }
                }
            }


            //ystem.Console.WriteLine(Info_Forms.LibraryName + ":EUtil_NodeImpl.GetItemsByAttrAsCsv: 直後 list_Result.Count=[" + list_Result.Count + "]");


            if (EnumHitcount.One == hits)
            {
                // 必ず1件だけヒットする想定。

                if (cfList_Result.Count != 1)
                {
                    goto gt_errorNotOne;
                }
            }
            else if (EnumHitcount.First_Exist == hits)
            {
                // 必ずヒットする。複数件あれば、最初の1件だけ取得。

                if (0 == cfList_Result.Count)
                {
                    goto gt_errorNoHit;
                }
                else if (1 < cfList_Result.Count)
                {
                    cfList_Result.RemoveRange(1, cfList_Result.Count - 1);
                }
            }
            else if (EnumHitcount.First_Exist_Or_Zero == hits)
            {
                // ヒットすれば最初の1件だけ、ヒットしなければ0件の想定。

                if (1 < cfList_Result.Count)
                {
                    cfList_Result.RemoveRange(1, cfList_Result.Count - 1);
                }
            }
            else
            {
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_errorNoHit:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, cfList_Result.Count.ToString(), log_Reports);//検索ヒット数

                memoryApplication.CreateErrorReport("Er:8002;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_errorNotOne:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, cfList_Result.Count.ToString(), log_Reports);//検索ヒット数

                memoryApplication.CreateErrorReport("Er:8003;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
gt_EndMethod:
            return(cfList_Result);
        }
示例#10
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);
        }
示例#11
0
        //────────────────────────────────────────

        public void Translate(
            Configurationtree_Node cur_Cf,//<a-select-record>
            Expressionv_3FListboxValidationImpl parent_Exprv,
            MemoryApplication memoryApplication,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE", log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(36)" + cur_Cf.Name);
            }

            //
            //
            //
            //


            //
            //
            //
            // 自
            //
            //
            //
            Expressionv_4ASelectRecordImpl cur_Exprv = new Expressionv_4ASelectRecordImpl(parent_Exprv, cur_Cf, memoryApplication);


            //
            //
            //
            // 属性
            //
            //
            //
            {
                {
                    PmName pmName = PmNames.S_FIELD_KEY;
                    if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                    {
                        string sValue;
                        cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, true, log_Reports);

                        Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(parent_Exprv, cur_Cf);
                        ec_Str.AppendTextNode(
                            sValue,
                            cur_Cf,
                            log_Reports
                            );
                        cur_Exprv.Expression_Field = ec_Str;
                    }
                }

                {
                    PmName pmName = PmNames.S_VALUE_KEY;
                    if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                    {
                        string sValue;
                        cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, true, log_Reports);

                        Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(parent_Exprv, cur_Cf);
                        ec_Str.AppendTextNode(
                            sValue,
                            cur_Cf,
                            log_Reports
                            );
                        cur_Exprv.Expression_LookupVal = ec_Str;
                    }
                }

                {
                    PmName pmName = PmNames.S_REQUIRED;
                    if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                    {
                        string sValue;
                        cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, true, log_Reports);

                        Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(parent_Exprv, cur_Cf);
                        ec_Str.AppendTextNode(
                            sValue,
                            cur_Cf,
                            log_Reports
                            );
                        cur_Exprv.Expression_Required = ec_Str;
                    }
                }

                {
                    PmName pmName = PmNames.S_FROM;
                    if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                    {
                        string sValue;
                        cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, true, log_Reports);

                        Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(parent_Exprv, cur_Cf);
                        ec_Str.AppendTextNode(
                            sValue,
                            cur_Cf,
                            log_Reports
                            );
                        cur_Exprv.Expression_From = ec_Str;
                    }
                }

                {
                    PmName pmName = PmNames.S_STORAGE;
                    if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                    {
                        string sValue;
                        cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, true, log_Reports);

                        Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(parent_Exprv, cur_Cf);
                        ec_Str.AppendTextNode(
                            sValue,
                            cur_Cf,
                            log_Reports
                            );
                        cur_Exprv.Expression_Storage = ec_Str;
                    }
                }

                {
                    PmName pmName = PmNames.S_DESCRIPTION;
                    if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                    {
                        string sValue;
                        cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, true, log_Reports);

                        Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(parent_Exprv, cur_Cf);
                        ec_Str.AppendTextNode(
                            sValue,
                            cur_Cf,
                            log_Reports
                            );
                        cur_Exprv.Expression_Description = ec_Str;
                    }
                }
            }//属性


            //
            //
            //
            // 親へ連結
            //
            //
            //
            parent_Exprv.List_Expressionv_ASelectRecord.Add(cur_Exprv);//.Add(nA66, EnumHitcount.Unconstraint, log_Reports);


            //
            //
            //
            // 子
            //
            //
            //
            {
                // <f-cell>要素のリスト
                this.ParseChild_InConfigurationtreeToExpression(
                    cur_Cf,
                    cur_Exprv,
                    memoryApplication,
                    pg_ParsingLog,
                    log_Reports
                    );
            }

            goto gt_EndMethod;
            //
            //
            //
            //
gt_EndMethod:

            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
示例#12
0
        //────────────────────────────────────────

        public void Translate(
            Configurationtree_Node cur_Cf,
            Expressionv_3FListboxValidationImpl parent_Exprv,
            UsercontrolListbox uctLst,
            MemoryApplication memoryApplication,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE", log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(35)" + cur_Cf.Name);
            }

            //
            //

            string err_Child_SName_Node             = "";
            string err_Parent_SName_Node            = "";
            Configurationtree_Node err_Child_CfNode = null;



            //
            //
            //
            // 自
            //
            //
            //
            Expressionv_4ADisplayImpl cur_Exprv = new Expressionv_4ADisplayImpl(parent_Exprv, cur_Cf, memoryApplication);


            //
            //
            //
            // 属性
            //
            //
            //
            {
                {
                    PmName pmName = PmNames.S_TYPE;
                    string sValue;
                    bool   bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports);
                    if (bHit)
                    {
                        cur_Exprv.Dictionary_SAttribute.Add(pmName.Name_Pm, sValue);
                    }
                }

                {
                    PmName pmName = PmNames.S_DESCRIPTION;
                    string sValue;
                    bool   bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports);
                    if (bHit)
                    {
                        cur_Exprv.Dictionary_SAttribute.Add(pmName.Name_Pm, sValue);
                    }
                }
            }

            parent_Exprv.List_Expressionv_ADisplay.Add(cur_Exprv);
            uctLst.AddValidator_FListboxForItems(parent_Exprv, log_Reports);

            // #デバッグ中
            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole(" 子<f-●●>数=[" + cur_Cf.List_Child.Count + "]");
            }

            //
            //
            //
            // 子
            //
            //
            //
            cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node child_Cf, ref bool bBreak)
            {
                if (child_Cf is Configurationtree_Node)
                {
                    Configurationtree_Node child_Configurationtree_Node = (Configurationtree_Node)child_Cf;

                    string sName_Fnc;
                    child_Configurationtree_Node.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, false, log_Reports);

                    if (NamesFnc.S_VLD_ALL_FIELDS_IS_EMPTY == sName_Fnc)
                    {
                        //
                        // <f-all-fields-is-empty>要素
                        ConfigurationtreeToExpression_V54_FAllFieldsIsEmptyImpl_ to = new ConfigurationtreeToExpression_V54_FAllFieldsIsEmptyImpl_();
                        to.Translate(
                            child_Configurationtree_Node,
                            cur_Exprv,
                            memoryApplication,
                            pg_ParsingLog,
                            log_Reports
                            );
                    }
                    else if (NamesFnc.S_ALL_TRUE == sName_Fnc)
                    {
                        //
                        // <f-all-true>要素
                        ConfigurationtreeToExpression_V54_FAllTrueImpl_ to = new ConfigurationtreeToExpression_V54_FAllTrueImpl_();
                        to.Translate(
                            child_Configurationtree_Node,
                            cur_Exprv,
                            memoryApplication,
                            pg_ParsingLog,
                            log_Reports
                            );
                    }
                    else
                    {
                        //
                        // エラー。
                        err_Child_SName_Node  = child_Configurationtree_Node.Name;
                        err_Parent_SName_Node = cur_Cf.Name;
                        err_Child_CfNode      = child_Configurationtree_Node;
                        bBreak = true;
                    }
                }
            });
            if (null != err_Child_SName_Node)
            {
                goto undefined_element;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
undefined_element:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_Child_SName_Node, log_Reports);                                         //子設定ノード名
                tmpl.SetParameter(2, err_Parent_SName_Node, log_Reports);                                        //親設定ノード名
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(err_Child_CfNode), log_Reports); //設定位置パンくずリスト

                memoryApplication.CreateErrorReport("Er:7020;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 例えば ("access","from")と指定すれば、
        /// 指定リストの要素の中で 「~ access=”from,to”」 といった属性を持つものはヒットする。
        /// 
        /// 選択アイテムをリストから除外するなら bRemove=true にします。
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="sExpectedValue"></param>
        /// <param name="request_Items"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public static List<Configurationtree_Node> SelectItemsBySAttrAsCsv(
            List<Configurationtree_Node> items,
            PmName pmName/*string sName_Attr*/,
            string sValue_Expected,
            bool bRemove,
            EnumHitcount hits,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_XmlToConf.Name_Library, "Util_XmlToConfigurationtree_NodeImpl", "SelectItemsBySAttrAsCsv",log_Reports);

            List<Configurationtree_Node> cfList_Result = new List<Configurationtree_Node>();

            for (int nI = 0; nI < items.Count; nI++ )
            {
                Configurationtree_Node cf_Item = items[nI];

                if (log_Reports.Successful)
                {
                    string sValue_Attr;
                    bool bHit = cf_Item.Dictionary_Attribute.TryGetValue(pmName, out sValue_Attr, false, log_Reports);
                    if (bHit)
                    {
                        CsvTo_ListImpl to = new CsvTo_ListImpl();
                        List<string> sList_Value = to.Read(sValue_Attr);

                        if (sList_Value.Contains(sValue_Expected))
                        {
                            cfList_Result.Add(cf_Item);

                            if (bRemove)
                            {
                                // 削除
                                items.RemoveAt(nI);
                                nI--;
                            }

                            if (EnumHitcount.First_Exist == hits ||
                                EnumHitcount.First_Exist_Or_Zero == hits)
                            {
                                // 最初の1件で削除は終了。複数件ヒットするかどうかは判定しない。
                                break;
                            }
                        }
                    }
                }
            }

            //ystem.Console.WriteLine(Info_Forms.LibraryName + ":EUtil_NodeImpl.GetItemsByAttrAsCsv: 直後 list_Result.Count=[" + list_Result.Count + "]");

            if (EnumHitcount.One == hits)
            {
                // 必ず1件だけヒットする想定。

                if (cfList_Result.Count != 1)
                {
                    goto gt_errorNotOne;
                }
            }
            else if (EnumHitcount.First_Exist == hits)
            {
                // 必ずヒットする。複数件あれば、最初の1件だけ取得。

                if (0 == cfList_Result.Count)
                {
                    goto gt_errorNoHit;
                }
                else if (1 < cfList_Result.Count)
                {
                    cfList_Result.RemoveRange(1, cfList_Result.Count - 1);
                }
            }
            else if (EnumHitcount.First_Exist_Or_Zero == hits)
            {
                // ヒットすれば最初の1件だけ、ヒットしなければ0件の想定。

                if (1 < cfList_Result.Count)
                {
                    cfList_Result.RemoveRange(1, cfList_Result.Count - 1);
                }
            }
            else
            {
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_errorNoHit:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, cfList_Result.Count.ToString(), log_Reports);//検索ヒット数

                memoryApplication.CreateErrorReport("Er:8002;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_errorNotOne:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, cfList_Result.Count.ToString(), log_Reports);//検索ヒット数

                memoryApplication.CreateErrorReport("Er:8003;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            gt_EndMethod:
            return cfList_Result;
        }
示例#14
0
        //────────────────────────────────────────

        public void Translate(
            Configurationtree_Node cur_Cf,      //<a-empty-field>
            Expression_Node_String parent_Expr, //Expressionv_5FAllTrueImpl
            MemoryApplication memoryApplication,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE", log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(39)" + cur_Cf.Name);
            }

            //
            //
            //
            //


            //
            //
            //
            // 自
            //
            //
            //
            Expressionv_6AEmptyFieldImpl ecv_AEmptyFld = new Expressionv_6AEmptyFieldImpl(parent_Expr, cur_Cf, memoryApplication);


            //
            //
            //
            // 属性
            //
            //
            //
            {
                {
                    PmName pmName = PmNames.S_TYPE;
                    string sValue;
                    bool   bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports);
                    if (bHit)
                    {
                        Expression_Leaf_String ec_Leaf = new Expression_Leaf_StringImpl(sValue, parent_Expr, cur_Cf);
                        ecv_AEmptyFld.SetAttribute(pmName.Name_Pm, ec_Leaf, log_Reports);
                        //evAEmptyFld.Dictionary_SAttribute.Add(sAttrName, s_Cur.SAttrDic.Get(sAttrName, true, log_Reports));
                    }
                    else
                    {
                        // クリアー上書きしない。
                    }
                }

                {
                    PmName pmName = PmNames.S_DESCRIPTION;
                    string sValue;
                    bool   bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports);
                    if (bHit)
                    {
                        Expression_Leaf_String ec_Leaf = new Expression_Leaf_StringImpl(sValue, parent_Expr, cur_Cf);
                        ecv_AEmptyFld.SetAttribute(pmName.Name_Pm, ec_Leaf, log_Reports);
                    }
                    else
                    {
                        // クリアー上書きしない。
                    }
                }
            }


            //
            //
            //
            // 親へ連結
            //
            //
            //
            {
                // TODO:?
                parent_Expr.List_Expression_Child.Add(ecv_AEmptyFld, log_Reports);
            }


            //
            //
            //
            // 子
            //
            //
            //
            {
                // <f-cell>要素のリスト
                this.ParseChild_InConfigurationtreeToExpression(
                    cur_Cf,
                    ecv_AEmptyFld,
                    memoryApplication,
                    pg_ParsingLog,
                    log_Reports
                    );
            }

            goto gt_EndMethod;
            //
            //
            //
            //
gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
示例#15
0
        //────────────────────────────────────────

        public static Usercontrol GetUsercontrol(
            Configurationtree_Node cf_CurTree,
            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, "Util_XmlToConfigurationtree_NodeImpl", "GetUsercontrol", log_Reports);

            Usercontrol fcUc = null;
            string      sFcName;
            string      err_FcName;

            //
            // 対応するコントロール。
            List <Usercontrol> list_Usercontrol;

            {
                // コントロール名。
                Expression_Node_StringImpl ec_String = new Expression_Node_StringImpl(null, memoryApplication.MemoryValidators.Configurationtree_Validatorsconfig);
                {
                    PmName pmName = PmNames.S_NAME;
                    if (cf_CurTree.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                    {
                        cf_CurTree.Dictionary_Attribute.TryGetValue(pmName, out sFcName, true, log_Reports);

                        ec_String.AppendTextNode(
                            sFcName,
                            memoryApplication.MemoryValidators.Configurationtree_Validatorsconfig,
                            log_Reports
                            );
                    }
                    else
                    {
                        //
                        // エラー。
                        err_FcName = "<コントロール名無し>";
                        goto gt_Error_NotFoundFc02;
                    }
                }


                list_Usercontrol = memoryApplication.MemoryForms.GetUsercontrolsByName(
                    ec_String,
                    true,
                    log_Reports
                    );
            }

            if (list_Usercontrol.Count < 1)
            {
                //
                // エラー。
                err_FcName = sFcName;
                goto gt_Error_NotFoundFc02;
            }
            else
            {
                fcUc = list_Usercontrol[0];
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFoundFc02:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_FcName, log_Reports);                                                                                                        //関数名
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(memoryApplication.MemoryValidators.Configurationtree_Validatorsconfig), log_Reports); //設定位置パンくずリスト

                memoryApplication.CreateErrorReport("Er:8001;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(fcUc);
        }
示例#16
0
        /// <summary>
        /// 空白は、無いのと同じに扱う。
        /// </summary>
        /// <param name="name"></param>
        /// <param name="result"></param>
        /// <param name="isRequired"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public bool TryGetValue(
            PmName name,//Pmオブジェクトにしたい。
            out string result,
            bool isRequired,
            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.map.TryGetValue(name.Pm, out result);

            if (!bHit || "" == result)
            {
                if (isRequired)
                {
                    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(name.Plain);
                s.Append("\" 属性か、または <arg name=\"");
                s.Append(name.Pm);
                s.Append("\" ~> 要素のどちらかが必要でしたが、違う方を書いたか、記述されていないか、空文字列でした。");
                s.Newline();
                s.Newline();

                if (null != this.owner)
                {
                    //ヒント
                    s.Append(r.Message_Conf(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);
        }
示例#17
0
文件: PmNames.cs 项目: muzudho/CSVExE
 //────────────────────────────────────────
 private static void RegisterAttributeDictionary_(Dictionary<string, PmName> d, PmName pmName)
 {
     d.Add(pmName.Name_Attribute, pmName);
 }
示例#18
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);
        }
示例#19
0
        /// <summary>
        /// 直近の1件の子要素を返します。
        /// 該当がなければヌルを返します。
        /// </summary>
        /// <param name="projectName"></param>
        /// <param name="isRequired">該当がない場合にエラー扱いにするなら真</param>
        /// <returns></returns>
        public Conf_String GetFirstChildByAttr(
            PmName expectedName,
            string sExpectedValue,
            bool isRequired,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

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

            Conf_String cResult = null;

            if (log_Reports.Successful)
            {
                bool isHit = false;

                this.ChildNodes.ForEach(delegate(Conf_String item2, ref bool isBreak2)
                {
                    string value;
                    item2.Attributes.TryGetValue(expectedName, out value, false, log_Reports);

                    if (value == sExpectedValue)
                    {
                        isHit    = true;
                        cResult  = item2;
                        isBreak2 = true;
                    }
                });

                if (!isHit)
                {
                    cResult = null;

                    if (isRequired)
                    {
                        // エラーとして扱います。
                        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("▲エラー002!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("指定された要素は存在しませんでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("指定属性=[");
                s.Append(expectedName.Pm);
                s.Append("]");
                s.Append(Environment.NewLine);

                s.Append("指定値=[");
                s.Append(sExpectedValue);
                s.Append("]");
                s.Append(Environment.NewLine);

                //s.Append("┌──────────┐");
                //this.ChildNodes.ForEach(delegate(Conf_String item2, ref bool isBreak2)
                //{
                //    string value;
                //    item2.Attributes.TryGetValue(expectedName, out value, false, log_Reports);

                //    if (value == sExpectedValue)
                //    {
                //        isHit = true;
                //        cResult = item2;
                //        isBreak2 = true;
                //    }
                //});
                //s.Append("└──────────┘");

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

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