예제 #1
0
        //────────────────────────────────────────

        /// <summary>
        /// 文字列型変数の値をセットします。
        /// </summary>
        /// <param select="oVariableName"></param>
        /// <param select="nValue"></param>
        /// <param select="bRequired"></param>
        public void SetStringValue(
            XenonName o_Name_Variable,
            string sValue,
            bool bRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

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

            if (bRequired && !this.dictionaryExpression_Item.ContainsKey(o_Name_Variable.SValue))
            {
                goto gt_Error_NotFoundVariable;
            }
            else
            {
                Expression_Leaf_StringImpl ec_Str = new Expression_Leaf_StringImpl(null, new Configurationtree_NodeImpl("<SetStringValueから>", null));
                ec_Str.SetString(sValue, log_Reports);
                this.dictionaryExpression_Item[o_Name_Variable.SValue] = ec_Str;

                //.WriteLine(this.GetType().Name + "#SetStringValue: ◆ 文字列型変数[" + oVariableName.OValue + "]に、値["+value+"]をセットしました。");
            }

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

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append("[");
                t.Append(o_Name_Variable.SValue);
                t.Append("]という名前の 文字列型の変数は、存在しませんでした。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append(" ヒント: 「変数設定ファイル」に登録されている変数だけ使えます。");
                t.Append(Environment.NewLine);
                t.Append(" ヒント: 変数名の英字の大文字・小文字は完全に一致していますか?");
                t.Append(Environment.NewLine);
                t.Append(" ヒント: 「ファイルパス型」と「文字列型」の2つがあります。");
                t.Append("      文字列型として利用されようとしました。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append(" 「変数設定ファイル」のファイルパス:");
                t.Append(Environment.NewLine);
                t.Append("  ");
                if (null != this.parent_Variablesconfig_Configurationtree)
                {
                    this.parent_Variablesconfig_Configurationtree.ToText_Locationbreadcrumbs(t);
                }
                else
                {
                    t.Append("ヌル");
                }
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);


                t.Append(" 問題箇所ヒント:");
                t.Append(Environment.NewLine);
                t.Append("  ");
                o_Name_Variable.Cur_Configuration.ToText_Locationbreadcrumbs(t);
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                t.Append(r.Message_SSeparator());
                t.Append(" 変数一覧:");
                t.Append(Environment.NewLine);
                foreach (string sVarName in this.DictionaryExpression_Item.Keys)
                {
                    t.Append("  ");
                    t.Append(sVarName);
                    t.Append(Environment.NewLine);
                }
                t.Append(Environment.NewLine);

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