コード例 #1
0
ファイル: SelectPerformerImpl.cs プロジェクト: muzudho/XtA
        //────────────────────────────────────────
        /// <summary>
        /// 無条件で、全てのレコードを返す。
        /// </summary>
        /// <param name="dst_Row"></param>
        /// <param name="isRequired_ExpectedValue"></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,
            bool isRequired_ExpectedValue,
            DataTable dataTable,
            Configuration_Node parent_Conf,
            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>();

            foreach (DataRow row in dataTable.Rows)
            {
                out_List_DstRow.Add(row);
            }

            goto gt_EndMethod;

            //
            //
            //
            //

            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #2
0
        public override Expression_Node_Function NewInstance(
            Expression_Node_String parent_Expression, Configuration_Node cur_Conf,
            object owner_MemoryApplication, Log_Reports pg_Logging)
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_CSVEditorImpl.Name_Library, this, "NewInstance",pg_Logging);
            //

            Expression_Node_Function f0 = new Expression_Node_Function_BootCsvEditorExImpl(this.EnumEventhandler,this.List_NameArgumentInitializer,this.Functiontranslatoritem);
            f0.Parent_Expression = parent_Expression;
            f0.Cur_Configuration = cur_Conf;
            ((Expression_Node_FunctionAbstract)f0).Owner_MemoryApplication = (MemoryApplication)owner_MemoryApplication;
            //関数名初期化
            f0.Dictionary_Expression_Attribute.Set(PmNames.S_NAME.Name_Pm, new Expression_Leaf_StringImpl(NAME_FUNCTION, null, cur_Conf), pg_Logging);

            //「プロジェクト選択時」のイベントハンドラーを上書き要求。
            {
                Expression_Node_Function expr_Func2 = Collection_Function.NewFunction2(
                        Expression_Node_Function_OnEditorSelected_Impl.NAME_FUNCTION,
                        f0,
                        cur_Conf,
                        //EnumEventhandler.Tp_B_Wr_Rhn,
                        owner_MemoryApplication,
                        pg_Logging);

                ((Expression_Node_Function_BootCsvEditorExImpl)f0).Functionitem_OnProjectSelected = expr_Func2;
            }

            //
            pg_Method.EndMethod(pg_Logging);
            return f0;
        }
コード例 #3
0
        //────────────────────────────────────────
        /// <summary>
        /// 「ツール設定ウィンドウ」を開きます。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="eventMonitor"></param>
        /// <param name="log_Reports"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports);

            if (this.EnumEventhandler == EnumEventhandler.O_Lr)
            {
                if (log_Reports.CanStopwatch)
                {
                    string sFncName;
                    this.TrySelectAttribute(out sFncName, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                    log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName + "]実行";
                    log_Method.Log_Stopwatch.Begin();
                }

                //
                //
                //
                //

                // ツール設定モデルを共有します。
                this.Owner_MemoryApplication.MemoryForms.MemoryAatoolxmlDialog.MemoryAatoolxml = this.Owner_MemoryApplication.MemoryAatoolxml;

                // 「SelectedIndexイベント」を必ず動かすために、リストボックスを空にします。
                this.Owner_MemoryApplication.MemoryForms.Form_Toolwindow.Clear();

                // ダイアログボックスを出します。
                ((Form)this.Owner_MemoryApplication.MemoryForms.Form_Toolwindow).ShowDialog(this.Owner_MemoryApplication.MemoryForms.Mainwnd_FormWrapping.Form);
            }

            log_Method.EndMethod(log_Reports);
            return "";
        }
コード例 #4
0
        //────────────────────────────────────────
        /// <summary>
        /// アクション実行。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports);

            string sFncName0;
            this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);

            if (log_Reports.CanStopwatch)
            {
                log_Method.Log_Stopwatch.Message = "「E■[" + sFncName0 + "]アクション」実行(A)";
                log_Method.Log_Stopwatch.Begin();
            }
            //
            //

            if (this.EnumEventhandler == EnumEventhandler.O_Lr)
            {
                this.Execute6_Sub(log_Reports);
            }
            else if (this.EnumEventhandler == EnumEventhandler.O_Ea)
            {
                this.Execute6_Sub(log_Reports);
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return "";
        }
コード例 #5
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<Expression_Node_String> SelectItemsByPmAsCsv(
            List<Expression_Node_String> ecList_Item, string sPmName, string sExpectedValue,
            bool bRemove, EnumHitcount hits, Log_Reports log_Reports)
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_Controls.Name_Library, "Util_E_NodeImpl", "SelectItemsByAttrAsCsv",log_Reports);
            //
            //
            //Util_E_NodeImpl dammy_This = new Util_E_NodeImpl();

            List<Expression_Node_String> ecList_Result;
            ecList_Result =  Utility_Expression_NodeImpl.SelectItemsByPmAsCsv_Full_(
                ecList_Item,
                sPmName,
                false,
                sExpectedValue,
                bRemove,
                hits,
                log_Reports
                );

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);

            // 正常終了
            return ecList_Result;
        }
コード例 #6
0
        //────────────────────────────────────────
        /// <summary>
        /// アクション実行。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports);

            //
            //

            if (this.EnumEventhandler == EnumEventhandler.O_Lr)
            {
                this.Execute6_Sub(
                    log_Reports
                    );
            }
            else if (this.EnumEventhandler == EnumEventhandler.O_Ea)
            {
                this.Execute6_Sub(
                    log_Reports
                    );

            }

            //
            //
            log_Method.EndMethod(log_Reports);
            return "";
        }
コード例 #7
0
        //────────────────────────────────────────
        /// <summary>
        /// イベントハンドラーの作成。
        /// </summary>
        /// <param name="s_Action"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public Expression_Node_Function ConfigurationtreeToFunction(
            Configurationtree_Node action_Conf,
            MemoryApplication owner_MemoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "ConfigurationtreeToFunction",log_Reports);

            if (log_Reports.CanStopwatch)
            {
                log_Method.Log_Stopwatch.Begin();
            }
            //

            Expression_Node_Function expr_Func;
            if (log_Reports.Successful)
            {
                expr_Func = owner_MemoryApplication.MemoryForms.ConfigurationtreeToFunction.Translate(
                    action_Conf,
                    true,
                    log_Reports
                    );
            }
            else
            {
                expr_Func = null;
            }

            goto gt_EndMethod;
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return expr_Func;
        }
コード例 #8
0
ファイル: XToMemory_Style.cs プロジェクト: muzudho/CSVExE
        //────────────────────────────────────────
        public XenonStyle Parse(string sText, Log_Reports log_Reports)
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Parse",log_Reports);

            XenonStyle o_Style = new XenonStyleImpl();

            string[] properties = sText.Split(';');

            foreach (string sProperty in properties)
            {
                string[] keyValue = sProperty.Split(':');

                if (2 <= keyValue.Length)
                {
                    if ("color" == keyValue[0].Trim().ToLower())
                    {
                        string sValue = keyValue[1].Trim().ToLower();

                        ColorResult colorResult = BuilderColor.Parse(keyValue[1].Trim().ToLower(), Color.Black, true);
                        if (colorResult.BNotFound)
                        {
                            // 該当がなければ

                            // #連続エラー処理
                            if (log_Reports.CanCreateReport)
                            {
                                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                                r.SetTitle("▲エラー4301!", pg_Method);
                                r.Message = "color属性に["+sValue+"]が指定されましたが、対応していない値です。";
                                log_Reports.EndCreateReport();
                            }
                        }
                        else
                        {
                            o_Style.ForeXenonColor = new XenonColorImpl();
                            o_Style.ForeXenonColor.Color = colorResult.Color;
                            o_Style.ForeXenonColor.Name_Color = sValue;
                        }
                    }
                    else
                    {
                        // 無視
                    }
                }
                else
                {
                    // エラー処理
                }
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return o_Style;
        }
コード例 #9
0
ファイル: Flow0010.cs プロジェクト: muzudho/CSVExE
        //────────────────────────────────────────
        /// <summary>
        /// tool-saveファイルへの絶対パスを取得します。
        /// 取得できなかった場合、空文字列を返します。
        /// </summary>
        /// <returns></returns>
        public string GetFilepathabsolute(
            string sFpath,
            bool bRequired,
            Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Toolwindow.Name_Library, this, "GetFilepathabsolute", pg_Logging);

            string sFpatha_xml;

            if (pg_Logging.Successful)
            {
                // 正常時

                // ツールの設定のファイルパス
                Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("!ハードコーディング_Flow0010#GetFileAbsPath", null);

                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09TcDlg_1", parent_Cf);
                cf_Fpath.InitPath(
                    sFpath,
                    pg_Logging
                    );
                if (!pg_Logging.Successful)
                {
                    // 既エラー。
                    sFpatha_xml = "";
                    goto gt_EndMethod;
                }

                Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                sFpatha_xml = ec_Fpath.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint, pg_Logging);
                if (!pg_Logging.Successful)
                {
                    // 既エラー。
                    sFpatha_xml = "";
                    goto gt_EndMethod;
                }
            }
            else
            {
                // 既エラー。
                sFpatha_xml = "";
                goto gt_EndMethod;
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
            return sFpatha_xml;
        }
コード例 #10
0
        //────────────────────────────────────────
        /// <summary>
        /// パスはルートかどうか。
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static bool IsRooted_Path(
            string filepath,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Syntax.Name_Library, "Utility_Configurationtree_Filepath", "IsRooted_Path", log_Reports);
            //
            //
            bool bPathRooted;

            Exception err_Excp;
            try
            {
                // 「絶対パス」か、「相対パス」かを判断します。
                bPathRooted = System.IO.Path.IsPathRooted(filepath);
            }
            catch (ArgumentException e)
            {
                // エラー
                err_Excp = e;
                goto gt_Error_MissInput;
            }

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

                StringBuilder sb = new StringBuilder();
                sb.Append("エラー 入力パス=[" + filepath + "]:(" + err_Excp.GetType().Name + ") ");
                sb.Append(err_Excp.Message);

                r.Message = sb.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return bPathRooted;
        }
コード例 #11
0
        //────────────────────────────────────────
        /// <summary>
        /// アクション実行。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports);

            if (log_Method.CanWarning())
            {
                log_Method.WriteWarning_ToConsole(" ▲▲▲▲▲オーバーライド実装してください。");
            }

            log_Method.EndMethod(log_Reports);
            return "";
        }
コード例 #12
0
ファイル: ControlCommonImpl.cs プロジェクト: muzudho/CSVExE
        //────────────────────────────────────────
        /// <summary>
        /// コンストラクター。
        /// </summary>
        public ControlCommonImpl()
        {
            Log_Method log_Method = new Log_MethodImpl();
            Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(log_Method);
            log_Method.BeginMethod(Info_Controls.Name_Library, this, "ControlCommonImpl", log_Reports_ThisMethod);

            // コントロールを作った時に、必ずnameプロパティを設定してください。
            // ただし、直接 Visual Studio のビジュアルエディターで配置した場合は設定できません。
            Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname+"<init>", null);

            this.configurationtree_Control = new Configurationtree_NodeImpl(NamesNode.S_CONTROL1, cur_Cf);//ダミーのデフォルト・オブジェクト?
            this.expression_Name_Control = new Expression_Node_StringImpl(null, cur_Cf);

            log_Method.EndMethod(log_Reports_ThisMethod);
            log_Reports_ThisMethod.EndLogging(log_Method);
        }
        //────────────────────────────────────────
        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_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "LinkToParent", log_Reports);

            Usercontrol uct = null;
            if (log_Reports.Successful)
            {
                Configuration_Node cf_Control = cur_Cf.GetParentByNodename(
                    NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports);

                if (log_Reports.Successful)
                {
                    uct = Utility_XmlToConfigurationtree_NodeImpl.GetUsercontrol(
                        (Configurationtree_Node)cf_Control, memoryApplication, log_Reports);
                }
            }

            uct.ControlCommon.Configurationtree_Control.List_Child.Add(cur_Cf, log_Reports);
            goto gt_EndMethod;
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_UndefinedClass:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー386!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("なんらかのエラー。");
                s.Append(Environment.NewLine);

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        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);
            //
            //

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #15
0
        //────────────────────────────────────────
        /// <summary>
        /// このデータ・ターゲットに指定されている場所へ、値をセットします。
        /// </summary>
        /// <returns>成功すれば真。</returns>
        public void ToMemory(
            string sValue_Output,
            Expression_Node_String ec_Control,//「Expr■control」相当。
            MemoryApplication moApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM",log_Reports);

            //
            //

            List<Expression_Node_String> listExpr_Data = ec_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports);
            List<Expression_Node_String> listExpr_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(listExpr_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports);
            if (!log_Reports.Successful)
            {
                goto gt_EndMethod;
            }
            Expression_Node_String ec_DataTarget = listExpr_DataTarget[0];

            this.ToMemory_ParentFcells(
                sValue_Output,
                ec_DataTarget,
                moApplication,
                log_Reports
                );

            //essageBox.Show("アップデートデータ【終了】", "(FormsImpl)" + this.GetType().NFcName + "#:");
            //.WriteLine(this.GetType().NFcName + "#: 【終了】");

            //
            //
            //
            //
            goto gt_EndMethod;

            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);

            // 正常終了
            return;
        }
コード例 #16
0
ファイル: Expression_FvarImpl.cs プロジェクト: muzudho/CSVExE
        //────────────────────────────────────────
        public override string Execute5_Main(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Execute5_Main", log_Reports);
            //
            //
            string sResult;

            //
            // 変数の名前が入っています。
            string sVarName = this.Get00VariableName(log_Reports).Trim();

            {
                // 変数名。
                Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent);
                ec_Atom.SetString(
                    sVarName,
                    log_Reports
                );

                //
                // 値を取り出し。
                sResult = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(
                    ec_Atom,
                    true,
                    log_Reports
                    );
            }
            //ystem.Console.WriteLine(this.GetType().Name + "#GetString: <f-var>変数名=[" + sVarName + "] 結果=["+sResult+"]");

            //
            //
            //
            //

            log_Method.EndMethod(log_Reports);
            return sResult;
        }
コード例 #17
0
        //────────────────────────────────────────
        /// <summary>
        /// 未実装の場合。
        /// </summary>
        /// <param name="parent_Conf"></param>
        /// <param name="log_Reports"></param>
        public static 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);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 【追加 2012-07-05】
        /// </summary>
        /// <param name="s_Cur"></param>
        /// <param name="e_Cur"></param>
        /// <param name="bRequired_NameAttr"></param>
        /// <param name="bRequired_ValueAttrIsChild"></param>
        /// <param name="log_Reports"></param>
        public static void ParseAttr_InAnotherLibrary(
            Configurationtree_Node cur_Cf,
            Expression_Node_String cur_Ec,
            bool bRequired_NameAttr,//name属性が必須な場合、真。
            bool bRequired_ValueAttrIsChild,//value属性を、子<f-str>にする場合、真。
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, "SToE_F14n16_AbstractImpl_", "ParseAttr_InAnotherLibrary",log_Reports);

            if (log_Method.CanDebug(1))
            {
                //d_ParsingLog.Increment("(5.FElem汎用)"+s_Cur.Name_Node);
            }

            ConfigurationtreeToExpression_F14_FncImpl_ dammy = new ConfigurationtreeToExpression_F14_FncImpl_();//メソッドが使いたいだけなので、何でもいい。
            dammy.ParseAttr_InConfigurationtreeToExpression(
                cur_Cf,
                cur_Ec,
                bRequired_NameAttr,
                bRequired_ValueAttrIsChild,
                log_Reports
                );

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:

            if (Log_ReportsImpl.BDebugmode_Static)
            {
                //d_ParsingLog.Decrement(s_Cur.Name_Node);
            }
            log_Method.EndMethod(log_Reports);
        }
コード例 #19
0
        public MemoryGloballist Perform(
            Expression_Node_Filepath expr_Fpath_GloballistText,
            Encoding encoding,
            Log_Reports log_Reports,
            string sRunningHintName
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform",log_Reports);

            MemoryGloballist moGl = new MemoryGloballistImpl();

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

            if ("" == sFpatha)
            {
                // グローバルリスト ファイルへのパスが空文字列だった場合
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー080011!", pg_Method);
                    r.Message = "グローバルリスト ファイルへのパスを指定してください。";
                    log_Reports.EndCreateReport();
                }
            }

            string sText1;
            if (log_Reports.Successful)
            {
                // 正常時

                // テキスト読取り
                try
                {
                    sText1 = System.IO.File.ReadAllText(sFpatha, encoding);
                }
                catch(Exception ex)
                {
                    sText1 = null;
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー0800023!", pg_Method);

                        StringBuilder t = new StringBuilder();
                        t.Append("ファイルの読み取りに失敗しました。");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("ファイルパス=[");
                        t.Append(sFpatha);
                        t.Append("]");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("エンコーディング=[");
                        t.Append(encoding.ToString());
                        t.Append("]");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("例外:[");
                        t.Append(ex.GetType().Name);
                        t.Append("]:");
                        t.Append(ex.Message);

                        r.Message = t.ToString();

                        log_Reports.EndCreateReport();
                    }
                }
            }
            else
            {
                // エラー時
                sText1 = null;
            }

            if (log_Reports.Successful)
            {
                // 正常時

                // テキストをストリーム化します。
                System.IO.StringReader reader = new System.IO.StringReader(sText1);

                while (-1 < reader.Peek())
                {
                    string sLine = reader.ReadLine();

                    string parent_SNode = sFpatha;
                    MemoryGloballistLine modelOfGlLine = this.Sub_ParseLine(sLine, log_Reports, parent_SNode);

                    if (log_Reports.Successful)
                    {
                        // 正常時

                        moGl.AddLine(modelOfGlLine);
                    }
                }
                // ストリームを閉じます。
                reader.Close();
            }

            //
            //
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return moGl;
        }
コード例 #20
0
        //────────────────────────────────────────
        /// <summary>
        /// アクション実行。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports);

            string sFncName0;
            this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);

            if (log_Reports.CanStopwatch)
            {
                log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行";
                log_Method.Log_Stopwatch.Begin();
            }
            //
            //

            if (this.EnumEventhandler == EnumEventhandler.O_Ea)
            {
                if (this.Functionparameterset.Sender is Customcontrol)
                {
                    Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender;

                    string fcNameStr = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                    log_Reports.Comment_EventCreationMe += "/追記:[" + fcNameStr + "]コントロールが、[" + sFncName0 + "]アクションを実行。";
                }
                else
                {
                    log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName0 + "]アクションを実行。";
                }

                // テーブル
                Table_Humaninput o_Table_Src;
                {
                    Expression_Node_String ec_ArgTableName;
                    this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function05Impl.PM_NAME_TABLE_SOURCE, EnumHitcount.One_Or_Zero, log_Reports);

                    o_Table_Src = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        ec_ArgTableName,
                        true,
                        log_Reports
                        );
                }

                //
                // 書き出すテキスト
                //
                string sCsvText;
                {
                    ToCsv_Table_Humaninput_Impl toCsv = new ToCsv_Table_Humaninput_Impl();

                    //
                    // 出力しないフィールド名(英字は、大文字にして入れること)
                    //
                    toCsv.ExceptedFields.List_SExceptedFields_Starts_Upper.Add("Expl".ToUpper());

                    //
                    // 一時的にプロパティー変更
                    //
                    bool bOldRowColRev = o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse;
                    o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse = false;//行と列を、ひっくり返さずに書きだす。

                    sCsvText = toCsv.ToCsvText(o_Table_Src, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    //
                    // 元に戻す。
                    //
                    o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse = bOldRowColRev;
                }

                //
                // 書き出し先のテーブル
                //
                Table_Humaninput o_Table_Dst;
                if (log_Reports.Successful)
                {
                    Expression_Node_String ec_ArgTableName;
                    this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function05Impl.PM_NAME_TABLE_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports);

                    o_Table_Dst = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        ec_ArgTableName,
                        true,
                        log_Reports
                        );
                }
                else
                {
                    o_Table_Dst = null;
                }

                //
                // 書き出し先ファイルへのパス
                //
                string sFpatha_Dst;//絶対ファイルパス
                if (log_Reports.Successful)
                {
                    sFpatha_Dst = o_Table_Dst.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                }
                else
                {
                    sFpatha_Dst = null;
                }

                //
                // ファイルの書き出し
                //
                if (log_Reports.Successful)
                {
                    // 正常時

                    CsvWriterImpl writer = new CsvWriterImpl();
                    writer.Write(sCsvText, sFpatha_Dst, true);
                }
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return "";
        }
コード例 #21
0
        //────────────────────────────────────────

        public Expression_Node_String Compile(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            String sTxtTmpl = this.Text;



            Configurationtree_Node     parent_Cnf = new Configurationtree_NodeImpl("!ハードコーディング_TextTemplateImpl#Compile", null);
            Expression_Node_StringImpl result     = new Expression_Node_StringImpl(null, parent_Cnf);

            int nCur = 0;

            while (nCur < sTxtTmpl.Length)
            {
                int nPreCur = nCur;

                // 開き%記号(open percent)
                int nOp = sTxtTmpl.IndexOf('%', nCur);

                if (nOp != -1)
                {
                    // 開き%記号があった。

                    nCur = nOp + 1;//「開き%」の次へ。

                    // 閉じ%記号(close percent)
                    int cp = sTxtTmpl.IndexOf('%', nCur);

                    if (cp != -1)
                    {
                        // 閉じ%記号があれば。

                        nCur = cp + 1;//「閉じ%」の次へ。

                        // 「%」と「%」の間に数字があるはず。
                        // 「開き%」の次から、「閉じ% - 開き% - 1」文字分。(-1しないと、終了%を含んでしまう)
                        string sMarker = sTxtTmpl.Substring(nOp + 1, cp - nOp - 1);


                        // 「%1%」といった記号の数字部分。
                        int nParameterIndex;


                        try
                        {
                            nParameterIndex = Int32.Parse(sMarker);


                            // 開き「%」までを、まず文字列化。
                            int    nPreLen = nOp - nPreCur;
                            string sPre    = sTxtTmpl.Substring(nPreCur, nPreLen);
                            result.AppendTextNode(
                                sPre,
                                parent_Cnf,
                                log_Reports
                                );



                            // 引数から値を取得。

                            // %数字%を、Expression化して追加。
                            Expression_TexttemplateP1pImpl expr_P1p = new Expression_TexttemplateP1pImpl(null, parent_Cnf);
                            expr_P1p.NumberP1p      = nParameterIndex;
                            expr_P1p.Dictionary_P1p = this.Dictionary_NumberAndValue_Parameter;

                            result.List_Expression_Child.Add(
                                expr_P1p,
                                log_Reports
                                );

                            // 続行。
                        }
                        catch (Exception)
                        {
                            // 数字でないようなら。

                            // 今回の判定は失敗したものとして、残りの長さ全て
                            int nRestLen = sTxtTmpl.Length - nPreCur;

                            result.AppendTextNode(
                                sTxtTmpl.Substring(nPreCur, nRestLen),
                                parent_Cnf,
                                log_Reports
                                );


                            nCur = sTxtTmpl.Length;//終了(最後の文字の次へカーソルを出す)
                        }
                    }
                    else
                    {
                        // 閉じ%がなければ。

                        // 今回の判定は失敗したものとして、残りの長さ全て
                        int nRestLen = sTxtTmpl.Length - nPreCur;

                        result.AppendTextNode(
                            sTxtTmpl.Substring(nPreCur, nRestLen),
                            parent_Cnf,
                            log_Reports
                            );

                        nCur = sTxtTmpl.Length;//終了(最後の文字の次へカーソルを出す)
                    }
                }
                else
                {
                    // 開き%がなければ。

                    // 残りの長さ全て
                    int nRestLen = sTxtTmpl.Length - nCur;

                    result.AppendTextNode(
                        sTxtTmpl.Substring(nCur, nRestLen),
                        parent_Cnf,
                        log_Reports
                        );

                    nCur = sTxtTmpl.Length;//終了(最後の文字の次へカーソルを出す)
                }
            }


            //
            //
            log_Method.EndMethod(log_Reports);
            return(result);
        }
コード例 #22
0
        //────────────────────────────────────────

        /// <summary>
        /// 使えません。
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="sExpectedValue"></param>
        /// <param name="request"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public List <Expr_String> SelectDirectchildByNodename(
            string expectedNodeName, bool isRemove, EnumHitcount request, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

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

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

                if (result.Count != 1)
                {
                    goto gt_errorNotOne;
                }
            }
            else if (EnumHitcount.First_Exist_Or_Zero == request)
            {
                // ヒットすれば最初の1件だけ、ヒットしなければ0件の想定。

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


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

                StringBuilder sb = new StringBuilder();
                sb.Append("必ず、1件のみ取得する指定でしたが、[");
                sb.Append(result.Count);
                sb.Append("]件取得しました。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント

                r.Message = sb.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
コード例 #23
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// attr系要素の追加。
        ///
        /// 既に追加されている要素は、追加できない。
        /// </summary>
        public void Add(
            string key,
            string value,
            Conf_String cValue,
            bool isRequired,
            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.map.ContainsKey(key))
            {
                this.map.Add(key, value);
            }
            else
            {
                if (isRequired)
                {
                    // エラー
                    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(key);
                s.Append("]");
                s.Newline();

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

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #24
0
        //────────────────────────────────────────

        /// <summary>
        /// ノードを、リストのindexで指定して、取得します。
        /// 該当がなければヌルを返します。
        /// </summary>
        /// <param select="index">リストのインデックス</param>
        /// <param select="bRequired">該当するデータがない場合、エラー</param>
        /// <param select="log_Reports">警告メッセージ</param>
        /// <returns></returns>
        public Configurationtree_Node GetNodeByIndex(
            int nIndex,
            bool bRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            Configurationtree_Node gcav_FoundItem;

            if (0 <= nIndex && nIndex < this.list_Configurationtree_Node.Count)
            {
                gcav_FoundItem = this.list_Configurationtree_Node[nIndex];
            }
            else
            {
                gcav_FoundItem = null;

                if (bRequired)
                {
                    // エラーとして扱います。
                    goto gt_Error_BadIndex;
                }
            }

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

                StringBuilder sb = new StringBuilder();
                sb.Append("指定されたノードは存在しませんでした。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);
                sb.Append("リストのインデックス=[");
                sb.Append(nIndex);
                sb.Append("]");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント

                r.Message = sb.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(gcav_FoundItem);
        }
コード例 #25
0
        /// <summary>
        /// XML形式で書出し。
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="encoding"></param>
        /// <param name="doc"></param>
        /// <param name="log_Reports"></param>
        public bool Perform(
            string sFpath,
            Encoding encoding,
            XmlDocument doc,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform",log_Reports);

            bool bResult;

            try
            {

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

                // sample要素を列挙
                System.Xml.XmlNodeList nodeList = root.GetElementsByTagName("sample");

                // XMLの保存方法を設定します。
                System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(sFpath, encoding);
                writer.Formatting = System.Xml.Formatting.Indented;
                writer.Indentation = 4;

                try
                {
                    doc.Save(writer);

                    bResult = true;
                    goto gt_EndMethod;
                }
                catch (Exception ex)
                {
                    // エラー処理
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー0801087!", pg_Method);
                        r.Message = "[" + ex.GetType().Name + "]:" + ex.Message;
                        log_Reports.EndCreateReport();
                    }
                }
                finally
                {
                    writer.Close();
                }
            }
            catch (System.Xml.XmlException ex)
            {
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー1086!", pg_Method);
                    r.Message = ex.Message;
                    log_Reports.EndCreateReport();
                }
            }
            catch (System.IO.IOException ex)
            {
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー1085!", pg_Method);
                    r.Message = ex.Message;
                    log_Reports.EndCreateReport();
                }
            }
            catch (System.Exception ex)
            {
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー0801084!", pg_Method);
                    r.Message = "["+ex.GetType().Name+"]:"+ex.Message;
                    log_Reports.EndCreateReport();
                }
            }

            bResult = false;
            goto gt_EndMethod;

            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return bResult;
        }
コード例 #26
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);
        }
コード例 #27
0
        /// <summary>
        /// ヒットした件数がなかったとき、エラーになるか否か。
        /// </summary>
        /// <param name="hits"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public static bool IsError_IfNoHit(EnumHitcount hits, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Syntax.Name_Library, "Utility_Hitcount", "IsError_IfNoHit", log_Reports);

            bool result;

            switch (hits)
            {
            case EnumHitcount.Exists:
                result = true;    //エラーになる。
                break;

            case EnumHitcount.First_Exist:
                result = true;    //エラーになる。
                break;

            case EnumHitcount.First_Exist_Or_Zero:
                result = false;    //セーフ。
                break;

            case EnumHitcount.One:
                result = true;    //エラーになる。
                break;

            case EnumHitcount.One_Or_Zero:
                result = false;    //セーフ。
                break;

            case EnumHitcount.Unconstraint:
                result = false;    //セーフ。
                break;

            default:
                //エラー
                result = true;    //意味が変わるが、エラーにする。
                goto gt_Error_Default;
            }

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

                    Log_TextIndented t = new Log_TextIndentedImpl();
                    t.Append("Enum型の対応していない値[");
                    t.Append(hits.ToString());
                    t.Append("]");
                    t.Newline();

                    r.Message = t.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
コード例 #28
0
        //────────────────────────────────────────

        /// <summary>
        /// 例えば "data" と指定すれば、
        /// 直下の子要素の中で <data > といったノード名を持つものはヒットする。
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="sExpectedValue"></param>
        /// <param name="request"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public static List <Expression_Node_String> SelectItemByNodeName(
            List <Expression_Node_String> listExpression, string sName_ExpectedNode, bool bRemove, EnumHitcount request, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Syntax.Name_Library, "Expression_Node_StringImpl", "SelectItemByNodeName", log_Reports);

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


            for (int nI = 0; nI < listExpression.Count; nI++)
            {
                Expression_Node_String ec_Item = listExpression[nI];

                if (log_Reports.Successful)
                {
                    if (ec_Item.Cur_Configuration.Name == sName_ExpectedNode)
                    {
                        result.Add(ec_Item);

                        if (bRemove)
                        {
                            // 削除を要求します。
                            listExpression.RemoveAt(nI);
                            nI--;
                        }


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


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

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

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

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

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

                StringBuilder sb = new StringBuilder();
                sb.Append("必ず、1件以上ヒットする指定でしたが、[");
                sb.Append(result.Count);
                sb.Append("]件ヒットしました。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント

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

                StringBuilder sb = new StringBuilder();
                sb.Append("必ず、1件のみ取得する指定でしたが、[");
                sb.Append(result.Count);
                sb.Append("]件取得しました。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント

                r.Message = sb.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
コード例 #29
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// フォルダー絶対パスを指定すると、そのフォルダーパスを切り落とした文字列を返します。
        ///
        /// 違うフォルダーだった場合、失敗します。
        ///
        /// 先頭がディレクトリー区切り文字にならないようにして結果を返します。
        /// </summary>
        /// <param name="folerpath"></param>
        public void TryCutFolderpath(
            out string out_Filepath_New,
            Expr_Filepath folderpath,
            bool isRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            //まず、自分の絶対パス
            string my = this.Lv4Execute_OnImplement(EnumHitcount.Unconstraint, log_Reports);
            //if(log_Method.CanDebug(1))
            //{
            //    log_Method.WriteDebug_ToConsole("my=[" + my + "]");
            //}

            //指定されたフォルダーの絶対パス
            string you = folderpath.Lv4Execute_OnImplement(EnumHitcount.Unconstraint, log_Reports);

            //if (log_Method.CanDebug(1))
            //{
            //    log_Method.WriteDebug_ToConsole("you=[" + you + "]");
            //}

            //if (log_Method.CanDebug(1))
            //{
            //    log_Method.WriteDebug_ToConsole("my.StartsWith(you)=[" + my.StartsWith(you) + "]");
            //}

            if (my.StartsWith(you))
            {
                out_Filepath_New = my.Substring(you.Length);
                //if (log_Method.CanDebug(1))
                //{
                //    log_Method.WriteDebug_ToConsole("you.Length=[" + you.Length + "]");
                //    log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1 + "]");
                //    log_Method.WriteDebug_ToConsole("filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())=[" + filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) + "]");
                //    if (filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                //    {
                //        log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1.Substring(1) + "]");
                //    }
                //}

                // 先頭がディレクトリー区切り文字だった場合、それを切り捨てます。
                if (out_Filepath_New.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                {
                    out_Filepath_New = out_Filepath_New.Substring(1);
                }

                //Conf_Filepath filepath_Conf_New = new Conf_FilepathImpl(log_Method.Fullname, null);
                //filepath_Conf_New.I nitPath(filepath_New1, log_Reports);
                //out_Filepath_ExprNew = new Expression_Node_FilepathImpl(filepath_Conf_New);
            }
            else
            {
                //失敗
                out_Filepath_New = "";

                if (isRequired)
                {
                    // エラー。
                    goto gt_Error_Failure;
                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("ファイルパスの加工に失敗しました。\n");
                s.Append("[" + my + "]の頭から、フォルダー[" + you + "]を切りぬこうとしましたが、フォルダーが違いました。");


                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #30
0
        //────────────────────────────────────────

        /// <summary>
        /// 絶対パスを取得します。
        ///
        /// 未設定の場合は、空文字列を返します。
        ///
        /// ・ファイルパスとして利用できない文字や、予約語が含まれていると例外を投げます。
        /// ・絶対パスの文字列の長さが、ファイルシステムで使える制限を越えると例外を投げます。
        ///
        /// 設定されたパスが相対パスだった場合に、ベース・パスが設定されていなければ、
        /// 起動「.exe」のあったパスが頭に付く。
        /// </summary>
        /// <returns></returns>
        public override string Lv4Execute_OnImplement(
            EnumHitcount request,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            // 絶対パスにして返します。

            string sFpath;

            if (this.Conf is Conf_Filepath)
            {
                Conf_Filepath cf_Fpath = (Conf_Filepath)this.Conf;

                bool bCheckPathTooLong = false;

                if (log_Reports.Successful)
                {
                    sFpath = Util_Filepath.ToAbsolute(
                        this.Directory_Base,
                        cf_Fpath.GetHumaninput(), //this.SHumanInput相当
                        ref bCheckPathTooLong,    //ファイル名の長さチェックは、もう済んでいるものとして、行いません。
                        false,                    //ファイル名の長さが上限超過ならエラー
                        log_Reports,              //out sErrorMsg,
                        this.Conf
                        );
                }
                else
                {
                    sFpath = "";
                }
            }
            else
            {
                // エラー。
                sFpath = "";
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー901!", log_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append(Environment.NewLine);
                    s.Append("#GetSAbsoluteFilePath:型が違います。[" + this.Conf.GetType().Name + "]");

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

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(sFpath);
        }
コード例 #31
0
ファイル: CustomcontrolLabel.cs プロジェクト: muzudho/CSVExE
        //────────────────────────────────────────
        /// <summary>
        /// データソースから値を取得し、コントロールに取り込みます。
        /// 
        /// データソースが設定されていない場合は、フォームのクリアーになります。
        /// </summary>
        public void RefreshData(
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "RefreshData",log_Reports);
            //
            //

            List<Expression_Node_String> listExpr_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports);
            List<Expression_Node_String> listExpr_DataSource = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(listExpr_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_FROM, false, EnumHitcount.First_Exist, log_Reports);
            if (!log_Reports.Successful)
            {
                goto gt_EndMethod;
            }
            Expression_Node_String ec_DataSource = listExpr_DataSource[0];

            if (null == ec_DataSource)
            {
                // データソースが設定されていないとき
                //.WriteLine(this.GetType().Name + "#RefreshData: データソースが設定されていません。");

                this.Clear();
            }
            else
            {
                if (log_Reports.Successful)
                {

                    this.ControlCommon.BAutomaticinputting = true;

                    //
                    // 最初の1件。なければ空文字列。
                    //
                    Expression_Node_String ec_Str = ec_DataSource;
                    this.Text = ec_Str.Execute4_OnExpressionString(EnumHitcount.First_Exist_Or_Zero, log_Reports);

                    this.ControlCommon.BAutomaticinputting = false;
                }
            }

            goto gt_EndMethod;
            //
            //
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
コード例 #32
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);
        }
        //────────────────────────────────────────
        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);
            //
            //

            //string sIvtv = x_Cur.Attributes.GetNamedItem(AttrNames.S_ITEM_VALUE_TO_VARIABLE).Value;
            //string sIvtvTrim = "";
            //if (null == sIvtv)
            //{
            //    sIvtvTrim = "";
            //}
            //else
            //{
            //    sIvtvTrim = sIvtv.Trim();
            //}
            cur_Cf.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, "", log_Reports);// PmNames.Z_ITEM_VALUE_TO_VARIABLE sIvtv;

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #34
0
        /// <summary>
        /// 登録されている「%1%」、「%2%」といった記号の数字を一覧します。
        /// リストに「1」、「2」といった数字に置き換えて返します。
        /// </summary>
        /// <returns></returns>
        public List <int> ExistsP1pNumbers(
            Dictionary_Expression_Node_String ecDic_Attr,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            //
            //
            //
            //

            List <int> list = new List <int>();


            Dictionary <string, Expression_Node_String> .KeyCollection ecDic_Key = ecDic_Attr.Keys(log_Reports);

            foreach (string sKey in ecDic_Key)
            {
                //
                //
                //
                // p1p,p2p,p3p...といった名前かどうかを判定。
                //
                //
                //
                int nParamNameMatchedCount = 0;
                int nP1pNumber             = 0;
                {
                    //正規表現
                    System.Text.RegularExpressions.Regex regexp =
                        new System.Text.RegularExpressions.Regex(
                            @"p([0-9])+p",
                            //                            @"p[0-9]+p",
                            System.Text.RegularExpressions.RegexOptions.IgnoreCase
                            );

                    //文字列検索を1回する。
                    System.Text.RegularExpressions.Match match = regexp.Match(sKey);

                    while (match.Success)
                    {
                        nParamNameMatchedCount++;

                        bool parsedSuccessful = int.TryParse(match.Groups[1].Value, out nP1pNumber);

                        match = match.NextMatch();
                    }
                }

                if (1 == nParamNameMatchedCount)
                {
                    //
                    //
                    //
                    // p1p,p2p,p3p...といった名前。
                    //
                    //
                    //
                    list.Add(nP1pNumber);
                }
                else
                {
                }
            }


            //
            //
            log_Method.EndMethod(log_Reports);
            return(list);
        }
        //────────────────────────────────────────
        protected override void Parse_ChildNodes(
            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_ChildNodes",log_Reports);
            //

            XmlElement err_XADisplay = null;

            Usercontrol uct = null;
            if (log_Reports.Successful)
            {
                Configuration_Node cf_Control = cur_Cf.GetParentByNodename(
                    NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports);

                if (log_Reports.Successful)
                {
                    uct = Utility_XmlToConfigurationtree_NodeImpl.GetUsercontrol(
                        (Configurationtree_Node)cf_Control, memoryApplication, log_Reports);
                }
            }

            if (log_Reports.Successful)
            {
                if (uct is UsercontrolListbox)
                {
                    //
                    // リストボックスなら。
                    UsercontrolListbox uctLst = (UsercontrolListbox)uct;

                    //
                    // <a-select-record>、<a-display>要素
                    //
                    XmlNodeList child_XNl = cur_X.ChildNodes;

                    foreach (XmlNode x_childNode in child_XNl)
                    {
                        if (XmlNodeType.Element == x_childNode.NodeType)
                        {
                            XmlElement xChild = (XmlElement)x_childNode;
                            err_XADisplay = xChild;

                            string child_SName_Fnc = xChild.GetAttribute(PmNames.S_NAME.Name_Attribute);

                            //
                            //
                            if (NamesFnc.S_VLD_DISPLAY == child_SName_Fnc)//【変更 2012-07-19】
                            {

                                XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByFncName(child_SName_Fnc, log_Reports);
                                to.XmlToConfigurationtree(
                                    xChild,
                                    cur_Cf,
                                    memoryApplication,
                                    log_Reports
                                    );

                            }
                            else if (NamesFnc.S_VLD_SELECT_RECORD == child_SName_Fnc)
                            {
                                // Sf:Vld-SelectRecord;

                                XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByFncName(child_SName_Fnc, log_Reports);
                                to.XmlToConfigurationtree(
                                    xChild,
                                    cur_Cf,
                                    memoryApplication,
                                    log_Reports
                                    );

                            }
                            else
                            {
                                //
                                // エラー。
                                goto gt_Error_UndefinedChild11;
                            }

                        }
                    }
                }
            }

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

                StringBuilder s = new StringBuilder();
                s.Append("<f-list-box-validation>要素に、<a-display><a-select-record>要素以外の要素");
                s.Append(Environment.NewLine);
                s.Append("[");
                s.Append(err_XADisplay.Name);
                s.Append("]が含まれていました。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント

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

                StringBuilder s = new StringBuilder();
                s.Append("なんらかのエラー。");
                s.Append(Environment.NewLine);

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #36
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);
        }
コード例 #37
0
        //────────────────────────────────────────

        /// <summary>
        /// 例えば "data" と指定すれば、
        /// 直下の子要素の中で <data > といったノード名を持つものはヒットする。
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="sExpectedValue"></param>
        /// <param name="request"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public List <Expression_Node_String> SelectDirectchildByNodename(
            string sExpectedNodeName, bool bRemove, EnumHitcount request, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

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

            this.List_Expression_Child.ForEach(delegate(Expression_Node_String ec_Child, ref bool bRemove2, ref bool bBreak2)
            {
                if (log_Reports.Successful)
                {
                    if (ec_Child.Cur_Configuration.Name == sExpectedNodeName)
                    {
                        result.Add(ec_Child);

                        if (bRemove)
                        {
                            // 削除要求1があるとき、削除要求2を出します。
                            bRemove2 = true;
                        }


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

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

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

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

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

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

                StringBuilder sb = new StringBuilder();
                sb.Append("必ず、1件以上ヒットする指定でしたが、[");
                sb.Append(result.Count);
                sb.Append("]件ヒットしました。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント

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

                StringBuilder sb = new StringBuilder();
                sb.Append("必ず、1件のみ取得する指定でしたが、[");
                sb.Append(result.Count);
                sb.Append("]件取得しました。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント

                r.Message = sb.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
コード例 #38
0
        public override Expression_Node_Function NewInstance(
            Expression_Node_String parent_Expression, Configuration_Node cur_Conf,
            object/*MemoryApplication*/ owner_MemoryApplication, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Expression_Node_Function05Impl",log_Reports);
            //

            Expression_Node_Function f0 = new Expression_Node_Function05Impl(this.EnumEventhandler, this.List_NameArgumentInitializer, this.Functiontranslatoritem);
            f0.Parent_Expression = parent_Expression;
            f0.Cur_Configuration = cur_Conf;
            ((Expression_Node_FunctionAbstract)f0).Owner_MemoryApplication = (MemoryApplication)owner_MemoryApplication;
            //関数名初期値
            f0.SetAttribute(PmNames.S_NAME.Name_Pm, new Expression_Leaf_StringImpl(NAME_FUNCTION, null, cur_Conf), log_Reports);

            f0.SetAttribute(Expression_Node_Function05Impl.PM_NAME_TABLE_SOURCE, new Expression_Node_StringImpl(this, cur_Conf), log_Reports);
            f0.SetAttribute(Expression_Node_Function05Impl.PM_NAME_TABLE_DESTINATION, new Expression_Node_StringImpl(this, cur_Conf), log_Reports);

            //
            log_Method.EndMethod(log_Reports);
            return f0;
        }
コード例 #39
0
        //────────────────────────────────────────

        public virtual string Execute5_Main(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            //
            //

            StringBuilder sb_Result = new StringBuilder();

            List <Expression_Node_String> ecList_Child = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports);

            switch (this.enumHitcount)
            {
            case EnumHitcount.First_Exist:
            {
                //
                // 最初の1件のみ。存在しない場合エラー。
                //
                if (0 < ecList_Child.Count)
                {
                    Expression_Node_String ec_Child = ecList_Child[0];
                    string str1 = ec_Child.Execute4_OnExpressionString(this.enumHitcount, log_Reports);

                    sb_Result.Append(str1);
                }
                else
                {
                    //
                    // エラー
                    goto gt_Error_NotFoundOne;
                }
            }
            break;

            case EnumHitcount.First_Exist_Or_Zero:
            {
                //
                // 最初の1件のみ。存在しない場合、空文字列。
                //
                if (0 < ecList_Child.Count)
                {
                    Expression_Node_String ec_Child = ecList_Child[0];
                    string str1 = ec_Child.Execute4_OnExpressionString(this.enumHitcount, log_Reports);

                    sb_Result.Append(str1);
                }
                else
                {
                    //
                    // 存在しないので、空文字列。
                    //

                    // そのままスルー。
                }
            }
            break;

            case EnumHitcount.Unconstraint:
            {
                //
                // 制限なし
                //

                foreach (Expression_Node_String ec_Child in ecList_Child)
                {
                    string s1 = ec_Child.Execute4_OnExpressionString(this.enumHitcount, log_Reports);

                    sb_Result.Append(s1);
                }
            }
            break;

            default:
            {
                //
                // エラー
                goto gt_Error_UndefinedEnum;
            }
            }

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

                StringBuilder sb = new StringBuilder();
                sb.Append("必ず、最初の1件を取得する指定でしたが、1件も存在しませんでした。");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);

                // ヒント

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

                StringBuilder sb = new StringBuilder();
                sb.Append("this.requestItems.VolumeConstraintEnum=[");
                sb.Append(this.enumHitcount.ToString());
                sb.Append("]には、プログラム側でまだ未対応です。");

                // ヒント

                r.Message = sb_Result.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(sb_Result.ToString());
        }
コード例 #40
0
        /// <summary>
        /// グローバルリストの1行相当のデータの内容を解析します。
        /// </summary>
        /// <param name="line"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public MemoryGloballistLine Sub_ParseLine(string sLine, Log_Reports log_Reports, string parent_SNode)
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Sub_ParseLine",log_Reports);

            MemoryGloballistLineImpl moGlLine = new MemoryGloballistLineImpl();

            // 最初の「:」の位置
            int nColonIndex = sLine.IndexOf(':');

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

                    StringBuilder t = new StringBuilder();
                    t.Append("「:」が含まれていませんでした。");
                    t.Append(Environment.NewLine);
                    t.Append(Environment.NewLine);
                    t.Append("行内容=[");
                    t.Append(sLine);
                    t.Append("]");
                    t.Append(Environment.NewLine);
                    t.Append(Environment.NewLine);
                    t.Append("もしかすると:");
                    t.Append(Environment.NewLine);
                    t.Append("  ・単に「:」が含まれていない?");
                    t.Append(Environment.NewLine);
                    t.Append("  ・ファイルの文字エンコーディングの指定が間違っていて文字化けしており、正しく読めていない?");
                    t.Append(Environment.NewLine);
                    t.Append(Environment.NewLine);
                    t.Append("推定問題箇所=[");
                    t.Append(parent_SNode);
                    t.Append("]");
                    r.Message = t.ToString();
                    log_Reports.EndCreateReport();
                }
            }

            string sToken1;
            int nCommaIndex;
            if (log_Reports.Successful)
            {
                // 正常時

                // 第二引数は length
                sToken1 = sLine.Substring(0, nColonIndex);
                int nSecondIndex = nColonIndex + 1;
                moGlLine.Text = sLine.Substring(nSecondIndex, sLine.Length - nSecondIndex);

                // 「[I],1」といった書式の「,」の位置。
                nCommaIndex = sToken1.IndexOf(',');

                if (nCommaIndex < 0)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー872!", pg_Method);
                        r.Message = "行内容[" + sLine + "]の[" + sToken1 + "]部分に、「,」が含まれていませんでした。";
                        log_Reports.EndCreateReport();
                    }
                }
            }
            else
            {
                // エラー処理。

                sToken1 = "";
                nCommaIndex = -1;
            }

            if (log_Reports.Successful)
            {
                // 正常時

                moGlLine.Name_Type = sToken1.Substring(0, nCommaIndex);

                int nSecondIndex = nCommaIndex + 1;
                string sNumber = sToken1.Substring(nSecondIndex, sToken1.Length - nSecondIndex);

                int nGlLine;
                if (!int.TryParse(sNumber, out nGlLine))
                {
                    // エラー
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー878!", pg_Method);
                        r.Message = "変数番号[" + sNumber + "]を、int型の数値に変換できませんでした。";
                        log_Reports.EndCreateReport();
                    }
                }
                else
                {
                    moGlLine.Number = nGlLine;
                }
            }

            goto gt_EndMethod;

            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return moGlLine;
        }
コード例 #41
0
        //────────────────────────────────────────

        /// <summary>
        /// 警告が出ていれば、そのテキスト。
        /// </summary>
        /// <returns></returns>
        public string ToText(string sGroupTag)
        {
            Log_Method  log_Method             = new Log_MethodImpl(0);
            Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(log_Method);

            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "ToText", log_Reports_ThisMethod);

            Log_TextIndented s = new Log_TextIndentedImpl();



            s.Append("ログ出力:");
            s.Newline();

            int nErrorCount = 0;


            List <Log_RecordReports> listCopy = new List <Log_RecordReports>(this.list_Record);

            foreach (Log_RecordReports log_RecordReport in listCopy)//todo:bug:ここで リストが変更されているときに例外を出してしまう。
            {
                // グループ・タグが指定されていれば、
                // グループ・タグが一致するメッセージだけを出力します。

                if (log_RecordReport.EnumReport == EnumReport.Error)
                {
                    if ("" == sGroupTag || sGroupTag == log_RecordReport.Tag_Group)
                    {
                        s.Append("(No.");
                        s.Append(nErrorCount);
                        s.Append(") ");

                        // タイトル
                        s.Append(log_RecordReport.ErrorSymbol);

                        if ("" != log_RecordReport.Tag_Group)
                        {
                            // グループ・タグ
                            s.Append(log_RecordReport.Tag_Group);
                        }

                        s.Newline();
                        s.Newline();

                        if ("" != log_RecordReport.Logstack)
                        {
                            s.Append("エラー発生元データの推測ヒント:");
                            s.Append(log_RecordReport.Logstack);
                            s.Newline();
                            s.Newline();
                        }

                        s.Append(log_RecordReport.GetMessage(this));
                        s.Newline();
                        s.Newline();

                        if ("" != log_RecordReport.Logstack)
                        {
                            s.Append("プログラム実行経路推測ヒント:");
                            s.Append(this.Log_Callstack.ToString());
                            s.Newline();
                            s.Newline();
                        }

                        s.Newline();
                        s.Newline();

                        // エラーが発生したメソッド。
                        s.Append(log_RecordReport.FullnameMethod);

                        s.Newline();
                    }

                    // カウンターは、読み飛ばしたエラーもきちんとカウント。
                    nErrorCount++;
                }
            }

            {
                s.Append(Log_RecordReportsImpl.ToText_Separator());
            }

            {
                if ("" != this.Comment_EventCreationMe)
                {
                    s.Append("ロガーの作成に関するコメント:");
                    s.Append(this.Comment_EventCreationMe);
                    s.Newline();
                }
            }

            {
                if (null != this.log_Method_CreationMe)
                {
                    s.Append("ロガー生成場所:");
                    s.Append(this.Log_Method_CreationMe.Fullname);
                    s.Newline();
                }
                else
                {
                    s.Append("ロガー生成場所:ヌル");
                    s.Newline();
                }
            }

            {
                s.Append("このエラーメッセージを作っているロガー:");
                s.Append(log_Method.Fullname);
                s.Newline();
            }

            if (!Log_ReportsImpl.BDebugmode_Static)
            {
                s.Newline();
                s.Newline();
                s.Append("このデバッグ情報は、DebugModeフラグが立っていない状態でのものです。");
                s.Newline();
                s.Append("DDebuggerImpl.DebugModeフラグを立てると、今より詳細な情報が出力されるかもしれません。");
                s.Newline();
            }


            log_Method.EndMethod(log_Reports_ThisMethod);
            log_Reports_ThisMethod.EndLogging(log_Method);
            return(s.ToString());
        }
コード例 #42
0
        //────────────────────────────────────────
        public override void XmlToConfigurationtree(
            XmlElement cur_X,//<event>
            Configurationtree_Node parent_Cf,//<control>
            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 cur_Cf = this.CreateMyself(cur_X, parent_Cf, memoryApplication, log_Reports);

            //
            //
            //
            // 属性
            //
            //
            //
            this.Parse_SAttribute(cur_X, cur_Cf, memoryApplication, log_Reports);

            //
            //
            //
            // 子
            //
            //
            //
            XmlElement err_XAction;
            Exception err_Excp;
            if (log_Reports.Successful)
            {

                //
                //
                // actionノードを列挙
                //
                XmlNodeList child_XNl = cur_X.ChildNodes;
                foreach(XmlNode xChild in child_XNl)
                {

                    if (XmlNodeType.Element == xChild.NodeType)
                    {
                        XmlElement xAction = (XmlElement)xChild;

                        try
                        {
                            XmlToConfigurationtree_C15_Elm to = this.Dic_XmlToConfigurationtree[xChild.Name];
                            to.XmlToConfigurationtree(
                                xAction,
                                cur_Cf,
                                memoryApplication,
                                log_Reports
                                );
                        }
                        catch(KeyNotFoundException e)
                        {
                            err_XAction = xAction;
                            err_Excp = e;
                            goto gt_Error_NotFound;
                        }
                        catch (Exception e)
                        {
                            err_Excp = e;
                            goto gt_Error_Excp;
                        }
                    }

                }

            }

            //
            //
            //
            // 親へ連結
            //
            //
            //
            if (log_Reports.Successful)
            {
                parent_Cf.List_Child.Add(cur_Cf, log_Reports);
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFound:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_XAction.Name, log_Reports);//ノード名
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                memoryApplication.CreateErrorReport("Er:8023;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Excp:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                memoryApplication.CreateErrorReport("Er:8024;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #43
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);
        }
コード例 #44
0
        //────────────────────────────────────────
        /// <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;
        }
コード例 #45
0
        //────────────────────────────────────────

        /// <summary>
        /// 「ディレクトリー」と「入力値」の2つを入力すると、「絶対パス」を返します。
        ///
        /// ──────────
        ///
        /// 未設定の場合は、空文字列を返します。
        /// ※bug:フォルダーパスの場合も空文字列になる??
        ///
        /// ・ファイルパスとして利用できない文字や、予約語が含まれていると例外を投げます。
        /// ・絶対パスの文字列の長さが、ファイルシステムで使える制限を越えると例外を投げます。
        ///
        /// もし、設定されたパスが相対パスだった場合に、ベース・パスが設定されていなければ、
        /// 起動「.exe」のあったパスが頭に付く。
        /// </summary>
        /// <param name="baseDirectory"></param>
        /// <param name="humanInputText"></param>
        /// <param name="flagCheckPathTooLong">絶対パスの文字列の長さが、ファイルシステムで使える上限を超えていた場合に真、そうでない場合 偽にセットされます。</param>
        /// <param name="okPathTooLong">絶対パスの文字列の長さが、ファイルシステムで使える上限を超えていた場合に、「正常扱いにするなら」真、「エラー扱いにするなら」偽。</param>
        /// <param name="cur_Conf">デバッグ用情報。人間オペレーターが修正するべき箇所などの情報。</param>
        /// <returns></returns>
        public static string ToAbsolute(
            string directory_Base,
            string humaninput,
            ref bool isTooLong,
            bool isSafe_TooLong,
            Log_Reports log_Reports,
            Conf_String cur_Conf
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Syntax.Name_Library, "Util_Filepath", "ToAbsolute②", log_Reports);
            //
            //

            //
            // 修正履歴(2009-12-02)
            //
            // ・カレント・ディレクトリの移動を使ったコードを書いてはいけない。
            //   MS-DOSの名残り?
            //
            // ・起動「.exe」のディレクトリは Application.StartupPath で取得できる。
            //
            // ・備考:
            // System.IO.Directory.GetCurrentDirectory()は、
            // 「プロセスが開始されたディレクトリ」を返すので、
            // openFileDialogで開いたディレクトリを返すこともある。
            //
            // System.IO.Path.GetFullPath(path)も同じ。

            Exception err_Excp;

            string result_Filepath;//ファイルパス

            // フラグのクリアー。
            isTooLong = false;

            //
            // 人間がCSVファイルに記述しているファイル・パス。
            //
            // 「絶対パス」「相対パス」のどちらでも指定されます。
            //
            string filepath_Source = humaninput.Trim();

            if ("" == filepath_Source)
            {
                // 未設定の場合。
                result_Filepath = "";//ファイルパスとしては使えない文字列。
                goto gt_EndMethod;
            }

            // 「絶対パス」か、「相対パス」かを判断します。
            bool isRooted_Path = Util_Filepath.IsRooted(
                filepath_Source,
                log_Reports
                );

            if (!log_Reports.Successful)
            {
                // 既エラー。
                result_Filepath = "";//ファイルパスとしては使えない文字列。
                goto gt_EndMethod;
            }

            if (!isRooted_Path)
            {
                // 相対パスの場合

                // 「相対パス」に「ベース・ディレクトリー文字列」を連結して、「絶対パス」に変換します。

                if ("" != directory_Base)
                {
                    // 相対パスの相対元となるディレクトリーが設定されていれば。

                    if (!directory_Base.EndsWith(Path.DirectorySeparatorChar.ToString()))
                    {
                        filepath_Source = directory_Base + Path.DirectorySeparatorChar + filepath_Source;
                    }
                    else
                    {
                        filepath_Source = directory_Base + filepath_Source;
                    }
                }
                else
                {
                    // 起動「.exe」のあったパスを、相対の元となるディレクトリーとします。

                    if (!directory_Base.EndsWith(Path.DirectorySeparatorChar.ToString()))
                    {
                        filepath_Source = Application.StartupPath + Path.DirectorySeparatorChar + filepath_Source;
                    }
                    else
                    {
                        filepath_Source = Application.StartupPath + filepath_Source;
                    }
                }
            }

            // ここで、パスは 絶対パスに変換されています。

            try
            {
                // カレントディレクトリは使わない。

                // 絶対パスの場合、GetFullPathを通す必要はないが、
                // ファイルパスに使えない文字列を判定するために、
                // 例外を返すメソッドを使っています。
                result_Filepath = System.IO.Path.GetFullPath(filepath_Source);
            }
            catch (ArgumentException e)
            {
                // 指定のファイルパスに「*」など、ファイルパスとして使えない文字列が含まれていた場合など。

                result_Filepath = "";//ファイルパスとしては使えない文字列。

                err_Excp = e;
                goto gt_Error_ArgumentException;
            }
            catch (PathTooLongException e)
            {
                // ディレクトリーの文字数が、制限数を超えた場合などのエラー。

                result_Filepath = "";//ファイルパスとしては使えない文字列。

                if (isSafe_TooLong)
                {
                    // 正常処理扱いとします。
                }
                else
                {
                    // 異常扱いとします。

                    err_Excp = e;
                    goto gt_Error_PathTooLongException;
                }


                isTooLong = true;
            }
            catch (NotSupportedException e)
            {
                //パスのフォーマットが間違っているなどのエラー。
                result_Filepath = "";//ファイルパスとしては使えない文字列。
                err_Excp        = e;
                goto gt_Error_NotSupportedException;
            }
            catch (Exception e)
            {
                // それ以外のエラー。
                result_Filepath = "";//ファイルパスとしては使えない文字列。
                err_Excp        = e;
                goto gt_Error_Exception;
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(Environment.NewLine);
                s.Append("使えないファイルパスです。[");
                s.Append(filepath_Source);
                s.Append("] :");

                s.Append(err_Excp.Message);
                cur_Conf.ToText_Locationbreadcrumbs(s);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(Environment.NewLine);
                s.Append("エラー 入力パス=[" + filepath_Source + "]:(" + err_Excp.GetType().Name + ") ");

                s.Append(err_Excp.Message);
                cur_Conf.ToText_Locationbreadcrumbs(s);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(Environment.NewLine);
                s.Append("ファイルパスが間違っているかもしれません。");
                s.Newline();
                s.AppendI(1, "入力パス=[" + filepath_Source + "]");
                s.Newline();

                // ヒント
                s.Append(r.Message_SException(err_Excp));
                cur_Conf.ToText_Locationbreadcrumbs(s);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(Environment.NewLine);
                s.Append("エラー 入力パス=[" + filepath_Source + "]");
                s.Newline();

                // ヒント
                s.Append(r.Message_SException(err_Excp));
                cur_Conf.ToText_Locationbreadcrumbs(s);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result_Filepath);
        }
コード例 #46
0
ファイル: CustomcontrolLabel.cs プロジェクト: muzudho/CSVExE
        //────────────────────────────────────────
        public void UsercontrolToMemory(
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "UsercontrolToMemory",log_Reports);
            //
            //

            if (null == this.ControlCommon.Expression_Control)
            {
                // このコントロールに対応づくテーブル等の設定がなく、ただの空箱の場合。
                // Visual Studio のビジュアルエディターで直接置いただけの時は、ここに来ます。

                // 何もせず終了。
                goto gt_EndMethod;
            }

            List<Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports);
            List<Expression_Node_String> ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports);
            if (!log_Reports.Successful)
            {
                goto gt_EndMethod;
            }
            Expression_Node_String ec_DataTarget = ecList_DataTarget[0];

            if (null == ec_DataTarget)
            {
                // エラー:     データターゲットが未設定のとき
                goto gt_Error_Datatarget;
            }
            else
            {
                //
                // データターゲットが設定されているとき
                //

                //
                // 未実装 TODO: 実装すること。
                //
                {
                    Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                    tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名

                    this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:537;", tmpl, log_Reports);
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_Datatarget:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名

                this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:504;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
コード例 #47
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="e_Result">検索結果。</param>
        /// <param name="name"></param>
        /// <param name="bRequired"></param>
        /// <param name="hits"></param>
        /// <param name="log_Reports"></param>
        /// <returns>検索結果が1件以上あれば真。</returns>
        public bool TrySelect(
            out Expression_Node_String out_Result_Expr,
            string name,
            EnumHitcount hits,
            Log_Reports log_Reports//bug:ヌルのことがある?
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            bool isHit;

            if (this.dicExpression_Item.ContainsKey(name))
            {
                // ヒット。
                out_Result_Expr = this.dicExpression_Item[name];
                isHit           = true;
            }
            else
            {
                // 一致なし。
                isHit = false;

                if (Utility_Hitcount.IsError_IfNoHit(hits, log_Reports))
                {
                    //エラーにする。
                    out_Result_Expr = null;
                    goto gt_Error_NotFoundOne;
                }
                else
                {
                    // 該当しないキーを指定され、値を取得できなかったが、エラー報告しない。
                    Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl("!ハードコーディング_NStringDictionaryImpl#Get", null);
                    out_Result_Expr = new Expression_Leaf_StringImpl(null, parent_Conf);
                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("指定された名前[");
                s.Append(name);
                s.Append("]は、“EDic(連想配列)”の中にありませんでした。");
                s.Newline();

                s.Append("┌────────┐キー一覧(個数=[");
                s.Append(this.dicExpression_Item.Count);
                s.Append("])");
                s.Newline();
                foreach (string sKey in this.dicExpression_Item.Keys)
                {
                    s.Append("[");
                    s.Append(sKey);
                    s.Append("]");
                    s.Newline();
                }
                s.Append("└────────┘");
                s.Newline();

                // ヒント

                if (null != this.Owner_Conf)
                {
                    s.Append("◆オーナー情報1");
                    s.Newline();
                    this.Owner_Conf.ToText_Content(s);
                }

                if (0 < this.dicExpression_Item.Count)
                {
                    foreach (Expression_Node_String e_Item in this.dicExpression_Item.Values)
                    {
                        Expression_Node_String e_Parent = e_Item.Parent_Expression;
                        if (null != e_Parent)//親要素が設定されていないことがある。
                        {
                            // 最初の1個。
                            s.Append("◆最初の要素の親の情報。");
                            s.Newline();
                            e_Parent.ToText_Snapshot(s);
                        }
                        break;
                    }
                }

                //
                // オーナーの情報。
                if (null != this.owner_Conf)//オーナー要素が設定されていないことがある。
                {
                    s.Newline();
                    s.Newline();
                    s.Append("◆オーナー情報2。");
                    s.Newline();
                    this.owner_Conf.ToText_Locationbreadcrumbs(s);
                }


                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(isHit);
        }
コード例 #48
0
        public bool TrySelect(
            out string out_Result,
            string name,
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            bool isResult;
            Expression_Node_String string_Expr;

            bool isSuccessful = this.TrySelect(out string_Expr, name, hits, log_Reports);

            if (isSuccessful)
            {
                out_Result = string_Expr.Execute4_OnExpressionString(hits, log_Reports);
                isResult   = true;
            }
            else
            {
                out_Result = "";
                isResult   = false;
            }

            //switch (hits)
            //{
            //    case EnumHitcount.One:
            //        {
            //            if (!isResult)
            //            {
            //                //エラー
            //                goto gt_Error_NotFoundOne;
            //            }
            //        }
            //        break;
            //    //todo:他の制約も。
            //}

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

            //        StringBuilder s = new StringBuilder();
            //        s.Append("必ず、1件を取得する指定でしたが、1件も存在しませんでした。キー=[");
            //        s.Append(name);
            //        s.Append("]");

            //        // ヒント

            //        r.Message = s.ToString();
            //        log_Reports.EndCreateReport();
            //    }
            //    goto gt_EndMethod;
            ////────────────────────────────────────────
            //    #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(isResult);
        }
コード例 #49
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e_Result">検索結果。</param>
        /// <param name="name_Attribute"></param>
        /// <param name="bRequired"></param>
        /// <param name="hits"></param>
        /// <param name="log_Reports"></param>
        /// <returns>検索結果が1件以上あれば真。</returns>
        public bool TrySelect_ExpressionFilepath(
            out Expression_Node_Filepath out_Fliepath_Expr,
            string name_Attribute,
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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


            string value;
            bool   isResult = this.TrySelect(out value, name_Attribute, hits, log_Reports);


            Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);

            filepath_Conf.InitPath(value, log_Reports);

            out_Fliepath_Expr = new Expression_Node_FilepathImpl(filepath_Conf);

            //switch (hits)
            //{
            //    case EnumHitcount.One:
            //        {
            //            if (!isResult)
            //            {
            //                //エラー
            //                goto gt_Error_NotFoundOne;
            //            }
            //        }
            //        break;
            //    //todo:他の制約も。
            //}

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

            //        StringBuilder s = new StringBuilder();
            //        s.Append("必ず、1件を取得する指定でしたが、1件も存在しませんでした。キー=[");
            //        s.Append(name_Attribute);
            //        s.Append("]");

            //        // ヒント

            //        r.Message = s.ToString();
            //        log_Reports.EndCreateReport();
            //    }
            //    goto gt_EndMethod;
            ////────────────────────────────────────────
            //    #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(isResult);
        }
コード例 #50
0
ファイル: CustomcontrolWindow.cs プロジェクト: muzudho/CSVExE
        //────────────────────────────────────────
        public void Destruct(
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "Destruct(20)",log_Reports);
            //
            //

            this.ClearAllEventhandlers(log_Reports);

            //
            // 破棄フラグを立てます。
            //
            this.ControlCommon.BDestructed = true;

            this.Clear();

            //
            //
            //
            //
            pg_Method.EndMethod(log_Reports);
        }
コード例 #51
0
        //────────────────────────────────────────

        /// <summary>
        /// ノード名を指定して、直近の親ノードを取得したい。
        /// </summary>
        /// <param name="name"></param>
        /// <param name="isRequired">偽を指定した時は、不一致の時ヌルを返す。</param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public virtual Conf_String GetParentByName(
            string name, 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, "GetParentByNodename", log_Reports);
            //
            //
            Conf_String result;

            Conf_String err_cParent;

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

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

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

                result = null;
            }

            if (!(result is Conf_String))
            {
                //エラー
                goto gt_Error_AnotherClass;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFoundParent:
            if (log_Reports.CanCreateReport)
            {
                if (isRequired)
                {
                    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(name);
                    s.Append("]");
                    s.Newline();

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

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

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

                    r.Message = s.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_AnotherClass:
            if (log_Reports.CanCreateReport)
            {
                if (isRequired)
                {
                    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(result.GetType().Name);
                    s.Append("]");
                    s.Newline();

                    // ヒント
                    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(result);
        }