//────────────────────────────────────────
        protected override Configurationtree_Node CreateMyself(
            XmlElement cur_X, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports)
        {
            Configurationtree_Node cur_Cf;
            cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_F_LISTBOX_VALIDATION, parent_Cf);

            return cur_Cf;
        }
Exemple #2
0
        //────────────────────────────────────────
        /// <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;
        }
        //────────────────────────────────────────
        /// <summary>
        /// コンストラクター。
        /// </summary>
        public Request_ReadsTableImpl()
        {
            this.name_PutToTable = "";
            this.use = "";

            {
                Configurationtree_Node s_ParentNode = new Configurationtree_NodeImpl("!ハードコーディング_Request_TableReadsImpl#<init>", null);
                Configurationtree_NodeFilepath s_fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L02_1", s_ParentNode);
                this.expression_Filepath = new Expression_Node_FilepathImpl(s_fpath);
            }
        }
        //────────────────────────────────────────
        /// <summary>
        /// 実行。
        /// 
        /// 全てのコントロールの、指定のイベントを実行します。
        /// 
        /// アプリケーション起動時に、"OnLoad"を全て実行するなど。
        /// 
        /// 別の関数から呼び出されます。
        /// </summary>
        /// <param name="oEventName"></param>
        /// <param name="oEventName"></param>
        /// <param name="log_Reports"></param>
        public void Execute1_AllUsercontrols(
            List<string> sFcNameList,
            object sender,
            XenonName o_Name_Event,
            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, "Execute1_AllUsercontrols", log_Reports);
            //
            //
            Configurationtree_Node cf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null);

            foreach (string sName_Usercontrol in sFcNameList)
            {
                if ("" == sName_Usercontrol)
                {
                    // 空行。飛ばす。
                    goto end_row;
                }

                Expression_Leaf_StringImpl ec_FcName = new Expression_Leaf_StringImpl(null, cf_ThisMethod);
                ec_FcName.SetString( sName_Usercontrol, log_Reports);

                List<Usercontrol> list_UcFc = owner_MemoryApplication.MemoryForms.GetUsercontrolsByName(ec_FcName, true, log_Reports);
                if (list_UcFc.Count < 1)
                {
                    // 正常。
                    // 特に設定をすることのないコントロールは、XMLファイルが用意されていない。
                    // 無視する。
                }
                else
                {
                    Usercontrol ucFc = list_UcFc[0];

                    this.Execute1_UsercontrolImpl(
                        sender,
                        ucFc,
                        o_Name_Event,
                        owner_MemoryApplication,
                        log_Reports
                        );
                }

            end_row:
                ;
            }

            //
            //
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        protected override Configurationtree_Node CreateMyself(
            XmlElement cur_X,
            Configurationtree_Node parent_Cf,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Configurationtree_Node cf_Cur;
            cf_Cur = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf);

            return cf_Cur;
        }
Exemple #6
0
        //────────────────────────────────────────
        /// <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);
        }
Exemple #7
0
        //────────────────────────────────────────
        private void Form1_Load(object sender, EventArgs e)
        {
            //
            //
            //
            //(1)デバッグモード ※Log_MethodImpl#BeginMethod(...)をする前に必要。
            //
            //
            //
            Log_ReportsImpl.BDebugmode_Static = true;
            Log_Reports pg_Logging_ThisMethod;

            //
            //
            //
            //(2)メソッド開始
            //
            //
            //
            Log_Method pg_Method = new Log_MethodImpl(0);
            // デバッグモード静的設定の後で。
            pg_Method.BeginMethod(Info_CSVEditorImpl.Name_Library, this, "Form1_Load", out pg_Logging_ThisMethod);
            //

            Expression_Node_String parent_Expression_Null = null;
            Configurationtree_Node cur_Conf = new Configurationtree_NodeImpl(pg_Method.Fullname, null);

            //
            //
            //
            //(3)CSVエディター・モデル(必要に応じて拡張)用意
            //
            //
            //
            this.memoryCsvEditor = new MemoryApplicationImpl();
            this.MemoryCsvEditor.InitializeBeforeUse(
                new Mainwnd_FormWrappingImpl(this),
                new ConfigurationtreeToFunction_ListImpl(parent_Expression_Null, cur_Conf, this.MemoryCsvEditor, pg_Logging_ThisMethod),
                new Form_ToolwindowImpl(),
                new MemoryAatoolxmlDialogImpl(this.MemoryCsvEditor),
                new UsercontrolStyleSetterImpl(),
                new UsercontrolCreator1Impl(),
                new XToMemory_FormImpl()
                );

            Form1.RegisterFunctions(pg_Logging_ThisMethod);

            //
            //
            //
            //(4)アプリケーション・モデル作成後に E_Sf_BootCsvEditorImpl(必要に応じて拡張)実行。
            //
            //
            //
            if (pg_Logging_ThisMethod.Successful)
            {

                Expression_Node_Function expr_Func = Collection_Function.NewFunction2(
                        Expression_Node_Function_BootCsvEditorExImpl.NAME_FUNCTION,
                        null,
                        cur_Conf,
                        this.MemoryCsvEditor,
                        pg_Logging_ThisMethod
                        );
                //expr_Func.InitializeBeforeUse(this.MoCsvEditor);

                // 実行
                expr_Func.Execute4_OnOEa(sender, e);
            }

            //
            //
            //
            //(5)エラーログ出力
            //
            //
            //
            if (!pg_Logging_ThisMethod.Successful)
            {
                // 異常時

                this.MemoryCsvEditor.MemoryLogwriter.WriteErrorLog(
                    this.MemoryCsvEditor,
                    pg_Logging_ThisMethod,
                    pg_Method.Fullname
                    );
            }

            //
            //
            //
            //(6)メソッド、ロギング終了
            //
            //
            //
            pg_Method.EndMethod(pg_Logging_ThisMethod);
            pg_Logging_ThisMethod.EndLogging(pg_Method);
        }
        //────────────────────────────────────────
        private void Load_Form2_(Log_Reports pg_Logging)
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_Toolwindow.Name_Library, this, "Form1_Load",pg_Logging);

            StringBuilder sb = new StringBuilder();

            MemoryAatoolxmlDialog moAatoolxmlDialog;
            if (null != this.Owner_MemoryApplication)
            {
                moAatoolxmlDialog = this.Owner_MemoryApplication.MemoryForms.MemoryAatoolxmlDialog;
            }
            else
            {
                // ダミーを作成。
                pg_Method.WriteInfo_ToConsole("ダミー・MemoryAatoolxmlDialogを作成。");
                moAatoolxmlDialog = new MemoryAatoolxmlDialogImpl(this.Owner_MemoryApplication);
            }

            moAatoolxmlDialog.MemoryAatoolxml = new MemoryAatoolxmlImpl(this.Owner_MemoryApplication);

            Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl("!ハードコーディング_" + this.GetType().Name + "#Form1_Load", null);

            // ツール設定ファイルへのパスは固定とします。
            Expression_Node_Filepath ec_Fpath_toolcnf;
            {
                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09TcDlg_3", parent_Conf);
                cf_Fpath.InitPath(
                    ValuesAttr.S_FPATHR_AATOOLXML,
                    pg_Logging);
                if (!pg_Logging.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                ec_Fpath_toolcnf = new Expression_Node_FilepathImpl(cf_Fpath);
            }

            //
            //
            //
            //「ツール設定ファイル」読取り
            //
            //
            //
            moAatoolxmlDialog.MemoryAatoolxml.LoadFile(ec_Fpath_toolcnf, pg_Logging);
            if (!pg_Logging.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            {
                UsercontrolListbox uctLst = (UsercontrolListbox)this.UctlstNameProject;
                uctLst.Clear();
                foreach (string sName_Project in moAatoolxmlDialog.MemoryAatoolxml.Dictionary_Editor.Dictionary_Item.Keys)
                {
                    uctLst.Items.Add(sName_Project);
                }

                if ("" == moAatoolxmlDialog.Name_SelectedEditor)
                {
                    // 選択プロジェクト名が指定されていなければ。

                    if (0 < uctLst.Items.Count)
                    {
                        // 先頭の要素を選択します。
                        uctLst.ControlCommon.BAutomaticinputting = true;
                        uctLst.SelectedIndex = 0;
                        uctLst.ControlCommon.BAutomaticinputting = false;
                    }
                    else
                    {
                        // 非選択にします。
                        uctLst.ControlCommon.BAutomaticinputting = true;
                        uctLst.SelectedIndex = -1;
                        uctLst.ControlCommon.BAutomaticinputting = false;
                    }
                }
                else
                {
                    // 選択プロジェクト名が指定されていれば。

                    int selectedIndex = uctLst.Items.IndexOf(moAatoolxmlDialog.Name_SelectedEditor);

                    uctLst.ControlCommon.BAutomaticinputting = true;
                    uctLst.SelectedIndex = selectedIndex;
                    uctLst.ControlCommon.BAutomaticinputting = false;
                }
            }

            sb.Append("[◆コマンドライン引数]");
            sb.Append(Environment.NewLine);

            // コマンドライン引数を取得します。
            string[] args = System.Environment.GetCommandLineArgs();

            //コマンドライン引数の表示
            int n = 1;
            foreach (string sArg in args)
            {
                sb.Append("【");
                sb.Append(n);
                sb.Append("】");
                sb.Append(sArg);
                sb.Append(Environment.NewLine);
            }

            this.pctxtInformation.Text = sb.ToString();

            Expression_Node_String parent_Expression_Null = null;

            //  ■
            //■  ■ 「変数書出ボタン」のイベント設定
            //  ■
            {
                Expression_Node_Function expr_Func = Collection_Function.NewFunction2( Expression_Node_Function45Impl.NAME_FUNCTION,
                    parent_Expression_Null, parent_Conf, this.Owner_MemoryApplication, pg_Logging);
                expr_Func.SetAttribute(Expression_Node_Function28Impl.PM_MESSAGE, new Expression_Leaf_StringImpl("変数出力試し", null, parent_Conf), pg_Logging);
            }

            //  ■
            //■  ■ 「フォームCSV書出ボタン」のイベント設定
            //  ■
            {
                Expression_Node_Function expr_Func = Collection_Function.NewFunction2(Expression_Node_Function46Impl.NAME_FUNCTION,
                        parent_Expression_Null, parent_Conf, this.Owner_MemoryApplication, pg_Logging);
                expr_Func.SetAttribute(Expression_Node_Function28Impl.PM_MESSAGE, new Expression_Leaf_StringImpl("フォームCSV出力試し", null, parent_Conf), pg_Logging);

                this.uctButton2.UsercontroleventhandlerClick += new EventHandler(expr_Func.Execute4_OnOEa);
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
        }
        //────────────────────────────────────────
        /// <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 (log_Reports.CanStopwatch)
            {
                string sFncName0;
                this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行";
                log_Method.Log_Stopwatch.Begin();
            }
            //
            //

            if (this.EnumEventhandler == EnumEventhandler.O_Kea)
            {
                Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null);

                Keys keys = this.Functionparameterset.KeyEventArgs.KeyCode;

                //
                // Form1のKeyPreview属性を true にしておく必要があります。
                //

                switch (keys)
                {
                    case Keys.F8:

                        //
                        // 「ツール設定ウィンドウ」を開きます。
                        //
                        //OWrittenPlace oWrittenPlace = new OWrittenPlaceImpl(this.OWrittenPlace.WrittenPlace + "!ハードコーディング_NAction21#(10)");

                        Expression_Node_Function expr_Func = Collection_Function.NewFunction2(
                                Expression_Node_Function11Impl.NAME_FUNCTION,
                                this,
                                this.Cur_Configuration,
                                this.Owner_MemoryApplication, log_Reports);

                        Configuration_Node cf_Event;
                        {
                            cf_Event = this.Cur_Configuration.GetParentByNodename(
                                NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports);
                        }

                        expr_Func.Execute4_OnLr(
                            this.Functionparameterset.Sender,
                            log_Reports
                            );

                        //essageBox.Show("[F8]キーを押しました。", "△情報103!");
                        break;
                }
            }

            //
            //
            log_Method.EndMethod(log_Reports);
            return "";
        }
        //────────────────────────────────────────
        public string GetSFilepath_UsercontrolconfigAbsolute(
            Expression_Node_Filepath ec_Fpath_Fcnf,
            Expression_Node_Filepath ec_Fopath_Forms,
            Log_Reports log_Reports
            )
        {
            string sFpatha_Fcnf;

            //
            // forms フォルダー
            //
            string sFopatha_Forms = ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                sFpatha_Fcnf = "";
                goto gt_EndMethod;
            }

            //
            // Fcnf 絶対ファイルパス
            //
            if (log_Reports.Successful)
            {
                // 正常時

                Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("formsフォルダーパス+コンポーネント設定ファイルパス", null);

                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L08_1", parent_Cf);
                cf_Fpath.InitPath(
                    sFopatha_Forms,
                    ec_Fpath_Fcnf.Humaninput,
                    log_Reports
                    );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    sFpatha_Fcnf = "";
                    goto gt_EndMethod;
                }

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

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            return sFpatha_Fcnf;
        }
        //────────────────────────────────────────
        /// <summary>
        /// プロジェクト読取り時の定形アクション実行。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="st_PrevProjectElm_OrNull"></param>
        /// <param name="bProjectValid"></param>
        /// <param name="log_Reports"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            //()メソッド開始
            Log_Method log_Method = new Log_MethodImpl(1);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports);

            //
            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole("「プロジェクト選択時」用のイベントハンドラーを実行します。");
            }

            //()タスク_デスクリプション
            {
                string sFncName0;
                this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                if (this.Functionparameterset.Sender is Customcontrol)
                {
                    Customcontrol ccFc = (Customcontrol)this.Functionparameterset.Sender;
                    string sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                    log_Reports.Comment_EventCreationMe += "/追加:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。";
                }
                else
                {
                    log_Reports.Comment_EventCreationMe += "/追加:[" + sFncName0 + "]アクションを実行。";
                }
            }

            Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null);

            if (this.EnumEventhandler == EnumEventhandler.Editor_B_Lr)
            {
                //(4)独自モデルの取得
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(4)独自モデルの取得");
                }
                //
                this.On_P04_ReadNewModel(log_Reports);

                //(5)エディター名。ツール設定ファイルに記載されている方。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(5)エディター名。ツール設定ファイルに記載されている方。");
                }

                // 表示用の名称。
                string sName_SelectingEditor;
                if (this.Functionparameterset.SelectedProjectElement_Configurationtree == null)
                {
                    //
                    // 切り替えるプロジェクトが判明していない場合は、空文字列。
                    //
                    sName_SelectingEditor = "";
                }
                else
                {
                    //
                    // todo: エディター設定ファイルの方のエディター名を入れても意味ないのでは?
                    //
                    sName_SelectingEditor = ((MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree).Name;
                }

                //(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用)
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用)");
                }
                // todo:イベントハンドラーを外してから、フォームを外すこと。リストボックスが誤挙動を起こしている。
                this.On_P06_ClearProject(this.Functionparameterset.Sender, log_Reports);

                //(7)「Aa_Editor.xml」読取。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(7)「Aa_Editor.xml」読取。");
                }
                //
                if (!this.Functionparameterset.IsProjectValid || this.Functionparameterset.SelectedProjectElement_Configurationtree == null)
                {
                    MemoryAatoolxml_Editor moAatoolxml_PrevEditorElm_OrNull = null;

                    //
                    //
                    //
                    // デフォルト・プロジェクト名が指定されていない場合、
                    // ツール設定ファイルの最初に記述されているプロジェクトを選択します。
                    //
                    //
                    //
                    if (log_Reports.Successful)
                    {
                        if ("" == sName_SelectingEditor)
                        {
                            //
                            // デフォルト・エディター名が未指定の場合。
                            //
                            MemoryAatoolxml_Editor moAatoolxml_DefaultEditor = this.Owner_MemoryApplication.MemoryAatoolxml.GetDefaultEditor(true, log_Reports);
                            if (!log_Reports.Successful)
                            {
                                // 既エラー。
                                goto gt_EndMethod;
                            }

                            // ↓これ要る?
                            sName_SelectingEditor = moAatoolxml_DefaultEditor.Name;
                        }
                    }

                    this.On_P07_SelectDefaultProject(ref sName_SelectingEditor, ref moAatoolxml_PrevEditorElm_OrNull, this.Functionparameterset.IsProjectValid, log_Reports);

                    this.Functionparameterset.SelectedProjectElement_Configurationtree = moAatoolxml_PrevEditorElm_OrNull;

                    //
                    //
                    //
                    //「プロジェクトを開いた時の初期化」イベントハンドラーで使うために、ここで設定します。
                    //
                    //
                    //
                    this.Functionparameterset.SelectedProjectElement_Configurationtree = this.Owner_MemoryApplication.MemoryAatoolxml.GetEditorByName(sName_SelectingEditor, true, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }

                // ↓追加
                if (null == this.Functionparameterset.SelectedProjectElement_Configurationtree)
                {
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, sName_SelectingEditor, log_Reports);//エディター名

                        this.Owner_MemoryApplication.CreateErrorReport("Er:110003;", tmpl, log_Reports);
                    }
                }
                // ↑追加

                //(13a)エディター・フォルダー。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(13a)エディター・フォルダーパス類推。");
                }
                //
                //
                //
                Expression_Node_Filepath ec_Fopath_Editor;
                if (log_Reports.Successful)
                {
                    MemoryAatoolxml_Editor moAatoolxml_SelectedEditor = (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree;
                    ec_Fopath_Editor = moAatoolxml_SelectedEditor.GetFilepathByFsetvarname(
                        NamesVar.S_SP_EDITOR,
                        this.Owner_MemoryApplication.MemoryVariables,
                        true,
                        log_Reports
                        );
                }
                else
                {
                    ec_Fopath_Editor = null;
                }

                //(13b)「Aa_Editor.xml」読取。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(13b)「Aa_Editor.xml」ファイルパス類推。");
                }
                //
                Expression_Node_Filepath ec_Fpath_AaEditorXml;
                if (log_Reports.Successful)
                {

                    //
                    // ツール設定ファイルで指定された値から、自動類推で設定されているはず。
                    //
                    Configurationtree_NodeFilepath cf_Fpath_EditorXml = new Configurationtree_NodeFilepathImpl(
                        "ツール設定ファイル[" + Application.StartupPath + System.IO.Path.DirectorySeparatorChar + ValuesAttr.S_FPATHR_AATOOLXML + "]の中の[" + sName_SelectingEditor + "]エディターへの指定から自動類推",
                        null);

                    // フォルダーパス + \Aa_Editor.xml
                    string sFpatha_Aaeditorxml = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML;

                    // プロジェクト起動時に。
                    cf_Fpath_EditorXml.InitPath(
                        sFpatha_Aaeditorxml,
                        log_Reports
                        );
                    ec_Fpath_AaEditorXml = new Expression_Node_FilepathImpl(cf_Fpath_EditorXml);
                }
                else
                {
                    ec_Fpath_AaEditorXml = null;
                }

                //(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M。この時点で「Sp:Engine;」といったシステム変数は自動類推が終わっている必要があります。");
                }
                //
                MemoryAaeditorxml_Editor moAaeditorxml_Editor = null;
                if (log_Reports.Successful)
                {
                    this.On_P08_SpToVar_(
                        out moAaeditorxml_Editor,
                        ec_Fpath_AaEditorXml,
                        ec_Fopath_Editor,
                        (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                        log_Reports
                        );
                }

                //
                //
                //
                // ここで「Aa_Files.csv」を読み込みたい。
                //
                //
                //

                if (log_Reports.Successful)
                {
                    //(9)変数ファイル読取
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("(9)変数ファイル読取");
                    }
                    //
                    this.Owner_MemoryApplication.MemoryVariables.LoadVariables(
                        Application.StartupPath,
                        log_Reports
                        );
                }

                if (log_Reports.Successful)
                {
                    //(10)プログラマー用・デバッグモードのON/OFF。
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("(10)プログラマー用・デバッグモードのON/OFF。");
                    }
                    //
                    //mainWndの作成より先に設定する必要がある。ステータスバーを出す、出さないについて。
                    {
                        Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent);
                        ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_PROGRAMMER, log_Reports);
                        string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports);
                        if (ValuesAttr.S_ON == sValue)
                        {
                            Log_ReportsImpl.BDebugmode_Static = true;
                        }
                        else if (ValuesAttr.S_OFF == sValue)
                        {
                            Log_ReportsImpl.BDebugmode_Static = false;
                        }
                        else if (ValuesAttr.S_EMPTY == sValue)
                        {
                            // 無視
                        }
                        else
                        {
                            // TODO:エラー
                        }
                    }
                }

                if (log_Reports.Successful)
                {
                    //(11)画面レイアウト・デバッグモードのON/OFF。
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("(11)フォーム・デバッグモードのON/OFF。");
                    }
                    //
                    Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent);
                    ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_FORM, log_Reports);
                    string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports);
                    if (ValuesAttr.S_ON == sValue)
                    {
                        Log_ReportsImpl.BDebugmode_Form = true;
                    }
                    else if (ValuesAttr.S_OFF == sValue)
                    {
                        Log_ReportsImpl.BDebugmode_Form = false;
                    }
                    else if (ValuesAttr.S_EMPTY == sValue)
                    {
                        // 無視
                    }
                    else
                    {
                        // TODO:エラー
                    }
                }

                //(14)「Aa_Files.csv」読取。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(14)「Aa_Files.csv」読取。");
                }
                //
                List<Expression_Node_Filepath> ecList_Fpath_BackupRequest;
                {
                    if (log_Reports.Successful)
                    {
                        // 正常時

                        Expression_Node_Function function_Expr = Collection_Function.NewFunction2(
                                Expression_Node_Function22Impl.NAME_FUNCTION, this, this.Cur_Configuration,
                                this.Owner_MemoryApplication, log_Reports);

                        // 実行
                        function_Expr.Execute4_OnLr(this.Functionparameterset.Sender, log_Reports);

                        // 実行後
                        ecList_Fpath_BackupRequest = ((Expression_Node_Function22Impl)function_Expr).List_Expression_Filepath_BackupRequest_Out;
                    }
                    else
                    {
                        //
                        // エラー
                        //

                        ecList_Fpath_BackupRequest = null;
                    }
                }

                //(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】");
                }
                //
                if (log_Reports.Successful)
                {
                    // タイプデータ値。
                    Expression_Leaf_StringImpl ec_NameVariable = new Expression_Leaf_StringImpl(this, new Configurationtree_NodeImpl("!ハードコーディング",null));
                    ec_NameVariable.SetString(ValuesTypeData.S_CODE_FUNCTIONS, log_Reports);

                    List<MemoryCodefileinfo> listInfo = null;
                    if (log_Reports.Successful)
                    {
                        listInfo = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_NameVariable, true, log_Reports);
                    }

                    if (log_Reports.Successful)
                    {
                        foreach (MemoryCodefileinfo scriptfile in listInfo)
                        {
                            if (log_Reports.Successful)
                            {
                                this.Owner_MemoryApplication.MemoryFunctions.LoadFile(
                                    scriptfile.Expression_Filepath,
                                    log_Reports);

                            }
                            else
                            {
                                break;
                            }
                        }
                    }

                }

                //(16)『スタイルシート設定ファイル』読取
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(16)『スタイルシート設定ファイル』読取");
                }
                //
                if (log_Reports.Successful)
                {
                    Expression_Node_Function expr_Func = Collection_Function.NewFunction2(
                        Expression_Node_Function19Impl.NAME_FUNCTION, this, this.Cur_Configuration,
                        this.Owner_MemoryApplication, log_Reports);

                    Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(this, conf_ThisMethod);
                    ec_Str.AppendTextNode(NamesVar.S_ST_STYLESHEET, this.Cur_Configuration, log_Reports);

                    expr_Func.SetAttribute(Expression_Node_Function19Impl.PM_NAME_TABLE_STYLESHEET, ec_Str, log_Reports);

                    expr_Func.Execute4_OnLr(
                        this.Functionparameterset.Sender,
                        log_Reports
                        );
                }

                //(17a)「バックアップを取る」前にしておく独自実装をするタイミング。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(17a)「バックアップを取る」前にしておく独自実装をするタイミング。");
                }
                //
                this.On_P17a_PreviousBackup(
                    this.Functionparameterset.Sender,
                    moAaeditorxml_Editor,
                    ec_Fpath_AaEditorXml,
                    ec_Fopath_Editor,
                    (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                    log_Reports);

                //(17b)今日の分のバックアップを取ります。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(17b)今日の分のバックアップを取ります。");
                }
                //
                this.On_P17b_DateBackup(ecList_Fpath_BackupRequest, this.Functionparameterset.Sender, log_Reports);

                //(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。");
                }
                //
                this.On_P17c_PreviousOpenWindow(
                    this.Functionparameterset.Sender,
                    moAaeditorxml_Editor,
                    ec_Fpath_AaEditorXml,
                    ec_Fopath_Editor,
                    (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                    log_Reports);

                //(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。");
                }
                //
                {

                    Expression_Node_Function expr_Func = Collection_Function.NewFunction2(
                            Expression_Node_Function30Impl.NAME_FUNCTION, this, this.Cur_Configuration,
                            this.Owner_MemoryApplication, log_Reports);

                    {
                        //Expression_Node_Function30Impl f1 =

                        {
                            Expression_Node_StringImpl ec_FormStart;
                            {
                                Expression_FvarImpl ec_Fvar = new Expression_FvarImpl(this, this.Cur_Configuration, this.Owner_MemoryApplication);
                                ec_Fvar.AppendTextNode(NamesVar.S_SS_FORM_START, this.Cur_Configuration, log_Reports);

                                ec_FormStart = new Expression_Node_StringImpl(this, this.Cur_Configuration);
                                ec_FormStart.List_Expression_Child.Add(ec_Fvar, log_Reports);
                            }
                            ((Expression_Node_Function30Impl)expr_Func).SetAttribute(Expression_Node_Function30Impl.PM_NAME_FORM, ec_FormStart, log_Reports);
                        }

                        ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_1 = this.In_Subroutine_Function30_1_OrNull;
                        ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_2 = this.In_Subroutine_Function30_2_OrNull;
                        ((Expression_Node_Function30Impl)expr_Func).SetAttribute(
                            Expression_Node_Function30Impl.PM_NAME_TOGETHER,
                            new Expression_Leaf_StringImpl(NamesStg.S_STG_BEGIN_APPLICATION, null, conf_ThisMethod), log_Reports);
                    }

                    expr_Func.Execute4_OnLr(
                        this.Functionparameterset.Sender,
                        log_Reports
                        );
                }

                //(19)最後に
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(19)最後に");
                }
                //
                this.On_P19_AtLast(
                    this.Functionparameterset.Sender,
                    (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                    this.Functionparameterset.IsProjectValid,
                    log_Reports);

                //
                // 「S」と「E」を出力したい。
                if (false)
                {
                    // 「S」全てのコントロールと、ユーザー定義関数について。

                    log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのコントロールについて。");
                    this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        fcUc.ControlCommon.Expression_Control.Cur_Configuration.ToText_Content(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                    log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのユーザー定義関数について。");
                    this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        ec_CommonFunction.Cur_Configuration.ToText_Content(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                    // 「E」全てのコントロールと、ユーザー定義関数について。

                    log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのコントロールについて。");
                    this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        fcUc.ControlCommon.Expression_Control.ToText_Snapshot(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                    log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのユーザー定義関数について。");
                    this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        ec_CommonFunction.ToText_Snapshot(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                }
                log_Method.WriteInfo_ToConsole("◆起動終了");

                goto gt_EndMethod;
            //
            gt_EndMethod:
                log_Method.EndMethod(log_Reports);
            }

            return "";
        }
        //────────────────────────────────────────
        protected override Configurationtree_Node CreateMyself(
            XmlElement cur_X,
            Configurationtree_Node parent_Cf,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1);
            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "CreateMyself",log_Reports);

            if (log_Method.CanDebug(1))
            {
            }

            //
            //

            Configurationtree_Node cur_Cf = null;

            //
            // name属性は必須。
            //
            string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute);
            if ("" == sName_Fnc)
            {
                goto gt_Error_UndefinedFncNameAttr;
            }

            //
            //

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

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

                Log_TextIndented s = new Log_TextIndentedImpl();

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

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

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return cur_Cf;
        }
Exemple #13
0
        //────────────────────────────────────────
        /// <summary>
        /// ファイル読み込み。
        /// </summary>
        /// <param name="ec_Fpath_Aatoolxml"></param>
        public void LoadFile(
            Expression_Node_Filepath ec_Fpath_Aatoolxml,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile",log_Reports);
            //

            Exception err_Excp;

            string sFpatha_Aatoolxml = "";
            if (log_Reports.Successful)
            {
                //
                // 『ツール設定』をクリアー。
                //
                this.Clear(this.Owner_MemoryApplication);

                sFpatha_Aatoolxml = ec_Fpath_Aatoolxml.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint,
                    log_Reports
                    );//絶対ファイルパス
            }

            if (log_Reports.Successful)
            {
                XmlDocument xDoc = new XmlDocument();

                try
                {

                    // 正常時

                    xDoc.Load(sFpatha_Aatoolxml);

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

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

                    if (log_Reports.Successful)
                    {
                        // デフォルト・エディター名
                        this.Name_DefaultEditor = xRoot.GetAttribute(PmNames.S_DEFAULT_EDITOR.Name_Attribute);

                        // エディター要素を列挙
                        System.Xml.XmlNodeList xNl_Editor = xRoot.GetElementsByTagName(NamesNode.S_EDITOR);

                        foreach (XmlNode x_EditorNode in xNl_Editor)
                        {
                            if (XmlNodeType.Element == x_EditorNode.NodeType)
                            {
                                //
                                // エディター要素
                                //
                                MemoryAatoolxml_Editor aatool_Editor = new MemoryAatoolxml_EditorImpl(this.cur_Configuration);

                                //
                                // エディター要素
                                //
                                XmlElement xEditor = (XmlElement)x_EditorNode;

                                // ツール設定ファイルに記載されている、エディター名
                                try
                                {
                                    aatool_Editor.Name = xEditor.GetAttribute(PmNames.S_NAME.Name_Attribute);

                                    this.Dictionary_Editor.Dictionary_Item.Add(aatool_Editor.Name, aatool_Editor);
                                }
                                catch (ArgumentException ex)
                                {
                                    err_Excp = ex;
                                    goto gt_Error_DuplicatedEditorName;
                                }

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

                                for (int nIndex_Fsetvar = 0; nIndex_Fsetvar < xNl_Fsetvar.Count; nIndex_Fsetvar++)
                                {
                                    XmlNode xNode_Fsetvar = xNl_Fsetvar.Item(nIndex_Fsetvar);

                                    if (XmlNodeType.Element == xNode_Fsetvar.NodeType)
                                    {
                                        //<f-set-var>要素
                                        Configurationtree_Node cf_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, ec_Fpath_Aatoolxml.Cur_Configuration);

                                        //<f-set-var>要素
                                        XmlElement xFsetvar = (XmlElement)xNode_Fsetvar;

                                        string sNamevar = xFsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute);
                                        string sFolder = xFsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute);
                                        string sValue = xFsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute);
                                        string sDescription = xFsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute);

                                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports);
                                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports);
                                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports);
                                        cf_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports);

                                        aatool_Editor.Dictionary_Fsetvar_Configurationtree.List_Child.Add(cf_Fsetvar, log_Reports);
                                    }
                                }
                            }
                        }
                    }

                }
                catch (System.IO.FileNotFoundException ex)
                {
                    err_Excp = ex;
                    goto gt_Error_NothingFile;
                }
                catch (System.Exception ex)
                {
                    err_Excp = ex;
                    goto gt_Error_Exception;
                }
            }

            if (log_Reports.Successful)
            {
                this.cur_Configuration = ec_Fpath_Aatoolxml.Cur_Configuration;
            }

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

                StringBuilder s = new StringBuilder();
                s.Append("『ツール設定ファイル』(tool config)読み取り中に、何らかのエラーが発生しました。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("もしかして?: <" + NamesNode.S_EDITOR + ">要素の" + PmNames.S_NAME.Name_Attribute + "属性が重複している?");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // 例外メッセージ
                s.Append(r.Message_SException(err_Excp));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NothingFile:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, ValuesAttr.S_FPATHR_AATOOLXML,log_Reports);
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp),log_Reports);

                this.Owner_MemoryApplication.CreateErrorReport( "Er:1;", tmpl, log_Reports );
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Exception:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー203!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("『ツール設定ファイル』(tool config)読み取り中に、何らかのエラーが発生しました。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("もしかして?: XMLのencoding指定が間違っている?この読取プログラムの期待するエンコードでないかも?");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                //
                // 例外メッセージ
                s.Append(r.Message_SException(err_Excp));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
Exemple #14
0
        //────────────────────────────────────────
        /// <summary>
        /// エラーログを出力します。(エラーが発生したときに呼び出してください)
        /// </summary>
        /// <param oVariableName="output_d_Logging"></param>
        /// <param name="runningHintName">このメソッドが呼び出された場所が分かるようなヒント。</param>
        public void WriteErrorLog(
            MemoryApplication moApplication,
            Log_Reports log_ReportsBuffer_Output,
            string sRunningHintName
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            // メタ。
            Log_Reports log_Reports_Meta = new Log_ReportsImpl(log_Method);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "WriteErrorLog",log_Reports_Meta);

            //

            //
            // 書き出すテキスト
            //
            string sOutput;
            {
                sOutput = log_ReportsBuffer_Output.ToText();
            }

            //
            // 書き出し先ファイルへのパス
            //
            Expression_Node_Filepath ec_Fpath;
            if (log_Reports_Meta.Successful)
            {
                XenonName o_Name_Variable = new XenonNameImpl(NamesVar.S_SP_LOGS, new Configurationtree_NodeImpl("!ハードコーディング_MoOpyopyoImpl#WriteLog", null));

                // 変数名。
                Expression_Leaf_StringImpl ec_Atom = new Expression_Leaf_StringImpl(null, o_Name_Variable.Cur_Configuration);
                ec_Atom.SetString(
                    o_Name_Variable.SValue,
                    log_Reports_Meta
                );

                // ファイルパス。
                log_Reports_Meta.Log_Callstack.Push(log_Method, "③");
                ec_Fpath = moApplication.MemoryVariables.GetExpressionfilepathByVariablename(
                    ec_Atom,
                    true,
                    log_Reports_Meta
                    );
                log_Reports_Meta.Log_Callstack.Pop(log_Method, "③");
            }
            else
            {
                ec_Fpath = null;
            }

            //
            // ファイルの書き出し
            //
            string err_SFpatha;
            {
                string sFpatha;

                if (log_Reports_Meta.Successful)
                {
                    // フォルダーへの絶対パス
                    string sFopatha_Logs = ec_Fpath.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint, log_Reports_Meta);
                    if (!log_Reports_Meta.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    Expression_Node_Filepath ec_Fpath2;
                    {
                        Configurationtree_Node parent_Cf = new Configurationtree_NodeImpl("!ハードコーディング_MoOpyopyoImpl#WriteLog", null);

                        Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_6", parent_Cf);
                        cf_Fpath.InitPath(
                            sFopatha_Logs,
                            "error-log.txt",
                            log_Reports_Meta
                            );
                        if (!log_Reports_Meta.Successful)
                        {
                            // 既エラー。
                            goto gt_EndMethod;
                        }

                        ec_Fpath2 = new Expression_Node_FilepathImpl(cf_Fpath);
                    }

                    sFpatha = ec_Fpath2.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint, log_Reports_Meta);
                }
                else
                {
                    sFpatha = "<エラー>";
                }

                if (log_Reports_Meta.Successful)
                {

                    try
                    {
                        System.IO.File.WriteAllText(sFpatha, sOutput, Global.ENCODING_LOG);

                        //#正常な、エラー出力
                        StringBuilder s0 = new StringBuilder();
                        s0.Append("エラーが発生しました!");
                        s0.Append(Environment.NewLine);
                        s0.Append(Environment.NewLine);
                        s0.Append("アプリケーションは正常に動作していない可能性があります。");
                        s0.Append(Environment.NewLine);
                        s0.Append(Environment.NewLine);
                        s0.Append("エラーログを書き出しました。");
                        s0.Append(Environment.NewLine);
                        s0.Append("[");
                        s0.Append(sFpatha);
                        s0.Append("]");
                        s0.Append(Environment.NewLine);
                        s0.Append(Environment.NewLine);
                        s0.Append("このアプリケーションの開発者にエラーログをお知らせください。");

                        MessageBox.Show(
                            s0.ToString(),
                            "▲エラーが発生しました! " + Info_MiddleImpl.Name_Library + ":" + this.GetType().Name + "#WriteErrorLog");
                    }
                    catch (Exception)
                    {
                        err_SFpatha = sFpatha;
                        goto gt_Error_CanNotWriteErrorLog;
                    }
                }
                else
                {
                    // メタのロガーが、エラーを検知。
                    goto gt_Error_MetaNotSuccessful;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_CanNotWriteErrorLog:
            {
                StringBuilder s0 = new StringBuilder();

                s0.Append("▲312!エラーが発生しましたが、エラーログを出力できませんでした。(");
                s0.Append(Info_MiddleImpl.Name_Library);
                s0.Append(") ファイルパス=[");
                s0.Append(err_SFpatha);
                s0.Append("]");

                MessageBox.Show(sOutput, s0.ToString());
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_MetaNotSuccessful:
            {
                Log_TextIndented s0 = new Log_TextIndentedImpl();
                s0.Append("エラーが発生しましたが、エラーログを出力できませんでした。");
                s0.Newline();
                s0.Newline();

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

                s0.Append(" ・設定ファイルの「エラーログの書出し先」を読み込む前に、エラーが出てしまった?");
                s0.Newline();
                s0.Append(" ・「ログファイル書き出し先」は指定されていますか?");
                s0.Newline();
                s0.Newline();

                s0.Append("実行箇所ヒント:");
                s0.Newline();
                s0.Append(" ・");
                s0.Append(sRunningHintName);
                s0.Newline();
                s0.Newline();

                MessageBox.Show(
                    s0.ToString(), //sOutput,
                    "▲エラー!【Er:101;】(" + log_Method.Fullname + ")");
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports_Meta);
            return;
        }
Exemple #15
0
        //────────────────────────────────────────
        public void XTo(
            out KeyconfigImpl out_Keycnf,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            Log_Reports log_Reports_Load = new Log_ReportsImpl(pg_Method);
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "XToO",log_Reports_Load);
            //
            //

            out_Keycnf = new KeyconfigImpl();

            CsvTo_Table_HumaninputImpl csvTo = new CsvTo_Table_HumaninputImpl();
            Request_ReadsTable oRequest_TableReads = new Request_ReadsTableImpl();
            {
                Configurationtree_NodeImpl cf_ConfigStack = new Configurationtree_NodeImpl(Info_Operating.Name_Library + ":" + this.GetType().Name + "#<init>:",null);
                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_1", cf_ConfigStack);

                cf_Fpath.InitPath(
                    "Editor-config/GAME_PAD/Key-config.csv",
                    log_Reports
                    );
                Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                oRequest_TableReads.Expression_Filepath = ec_Fpath;

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

            Format_Table_Humaninput o_TableFormat = new Format_Table_HumaninputImpl();
            out_Keycnf.O_Table_Keycnf = csvTo.Read(
                oRequest_TableReads,
                o_TableFormat,
                true,
                log_Reports
                );

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

            //
            // テーブルを上から1行ずつ読んでいきます。
            //
            foreach (DataRow dataRow in out_Keycnf.O_Table_Keycnf.DataTable.Rows)
            {
                //NO	ID	Expl	PLAYER	BEFORE	AFTER

                // プレイヤー番号
                int nPlayer;
                {
                    Int_HumaninputImpl o_Player = (Int_HumaninputImpl)dataRow["PLAYER"];
                    if (Int_HumaninputImpl.TryParse(
                        o_Player,
                        out nPlayer,
                        EnumOperationIfErrorvalue.Error,
                        0,
                        log_Reports
                        ))
                    {
                    }

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

                // BEFORE
                EnumGamepadkeyIx enumGmkeyArray;
                {
                    string sBefore;
                    string sDebug1 = "";
                    string sDebug2 = "";
                    String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["BEFORE"];

                    if (String_HumaninputImpl.TryParse(
                        o_Before,
                        out sBefore,
                        sDebug1,
                        sDebug2,
                        pg_Method,
                        log_Reports
                        ))
                    {
                    }

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

                    switch (sBefore)
                    {
                        case "Up":
                            enumGmkeyArray = EnumGamepadkeyIx.Up;
                            break;
                        case "Right":
                            enumGmkeyArray = EnumGamepadkeyIx.Right;
                            break;
                        case "Down":
                            enumGmkeyArray = EnumGamepadkeyIx.Down;
                            break;
                        case "Left":
                            enumGmkeyArray = EnumGamepadkeyIx.Left;
                            break;
                        case "0":
                            enumGmkeyArray = EnumGamepadkeyIx.B0;
                            break;
                        case "1":
                            enumGmkeyArray = EnumGamepadkeyIx.B1;
                            break;
                        case "2":
                            enumGmkeyArray = EnumGamepadkeyIx.B2;
                            break;
                        case "3":
                            enumGmkeyArray = EnumGamepadkeyIx.B3;
                            break;
                        case "4":
                            enumGmkeyArray = EnumGamepadkeyIx.B4;
                            break;
                        case "5":
                            enumGmkeyArray = EnumGamepadkeyIx.B5;
                            break;
                        case "6":
                            enumGmkeyArray = EnumGamepadkeyIx.B6;
                            break;
                        case "7":
                            enumGmkeyArray = EnumGamepadkeyIx.B7;
                            break;
                        default:
                            // エラー
                            enumGmkeyArray = EnumGamepadkeyIx.B0;
                            break;
                    }
                }

                // AFTER
                EnumGamepadkeyBit gmkeyPushEnum;
                {
                    string sAfter;
                    string sDebug1 = "";
                    string sDebug2 = "";
                    String_HumaninputImpl o_Before = (String_HumaninputImpl)dataRow["AFTER"];

                    if (String_HumaninputImpl.TryParse(
                        o_Before,
                        out sAfter,
                        sDebug1,
                        sDebug2,
                        pg_Method,
                        log_Reports
                        ))
                    {
                    }

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

                    switch (sAfter)
                    {
                        case "Up":
                            gmkeyPushEnum = EnumGamepadkeyBit.Up;
                            break;
                        case "Right":
                            gmkeyPushEnum = EnumGamepadkeyBit.Right;
                            break;
                        case "Down":
                            gmkeyPushEnum = EnumGamepadkeyBit.Down;
                            break;
                        case "Left":
                            gmkeyPushEnum = EnumGamepadkeyBit.Left;
                            break;
                        case "A":
                            gmkeyPushEnum = EnumGamepadkeyBit.A;
                            break;
                        case "B":
                            gmkeyPushEnum = EnumGamepadkeyBit.B;
                            break;
                        case "X":
                            gmkeyPushEnum = EnumGamepadkeyBit.X;
                            break;
                        case "Y":
                            gmkeyPushEnum = EnumGamepadkeyBit.Y;
                            break;
                        case "L":
                            gmkeyPushEnum = EnumGamepadkeyBit.L;
                            break;
                        case "R":
                            gmkeyPushEnum = EnumGamepadkeyBit.R;
                            break;
                        case "Select":
                            gmkeyPushEnum = EnumGamepadkeyBit.Select;
                            break;
                        case "Start":
                            gmkeyPushEnum = EnumGamepadkeyBit.Start;
                            break;
                        default:
                            // エラー
                            gmkeyPushEnum = EnumGamepadkeyBit.A;
                            break;
                    }
                }

                //
                // 記憶
                //
                KeyconfigPadImpl keycnfPad;
                if (out_Keycnf.Dic_KeyCnf.ContainsKey(nPlayer))
                {
                    keycnfPad = out_Keycnf.Dic_KeyCnf[nPlayer];
                }
                else
                {
                    keycnfPad = new KeyconfigPadImpl();
                }

                keycnfPad.KeyconfigArray[(int)enumGmkeyArray] = gmkeyPushEnum;

                out_Keycnf.Dic_KeyCnf[nPlayer] = keycnfPad;
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports_Load);
            log_Reports_Load.EndLogging(pg_Method);
            return;
        }
        //────────────────────────────────────────
        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;
        }
Exemple #17
0
        //────────────────────────────────────────
        /// <summary>
        /// 『コントロール設定ファイル(F)』を読み取ります。
        /// 
        /// X→S、S→E、S→A。
        /// </summary>
        public void LoadFile(
            RecordUserformconfig record_Uf,
            Expression_Node_Filepath folderpath_Forms_Expr,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile",log_Reports);
            //
            //

            // 手入力の Fcnf ファイルパス
            Configurationtree_NodeFilepath filepath_Control_Conf;
            record_Uf.TryGetFilepath_Configurationtree(out filepath_Control_Conf, NamesFld.S_FILE, false, this.Owner_MemoryApplication, log_Reports);
            string filepathHi_Uf = filepath_Control_Conf.GetHumaninput();

            string name_Control;
            record_Uf.TryGetString(out name_Control, NamesFld.S_NAME, true, "", this.Owner_MemoryApplication, log_Reports);

            // FILE フィールド(ファイルパス)が未指定なら、処理せず。
            if (log_Reports.Successful)
            {
                if ("" == filepathHi_Uf)
                {
                    goto gt_EndMethod;
                }
            }

            // (F) 絶対ファイルパス
            string filepathabs_Uf;
            {
                Utility_XmlToConfigurationtree_Usercontrolconfig to = new Utility_XmlToConfigurationtree_Usercontrolconfig();

                Expression_Node_FilepathImpl fpath_Expr = new Expression_Node_FilepathImpl(filepath_Control_Conf);

                filepathabs_Uf = to.GetSFilepath_UsercontrolconfigAbsolute(
                    fpath_Expr,//sl_record.Cf_File,
                    folderpath_Forms_Expr,
                    log_Reports
                    );
            }

            //
            // Fcnf ファイルパス
            Expression_Node_Filepath filepath_Uf_Expr;
            {
                Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl(log_Method.Fullname + ".LoadFcnfFile record[" + filepath_Control_Conf.GetHumaninput() + "]", null);

                Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_3", parent_Conf);
                filepath_Conf.InitPath(filepathHi_Uf, filepathabs_Uf, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                filepath_Uf_Expr = new Expression_Node_FilepathImpl(filepath_Conf);
            }

            if ("" == filepathabs_Uf)
            {
                // コンポーネント設定ファイルへのパスが指定されていなければ、処理しません。
                goto gt_Error_Fpath;
            }

            Configurationtree_Node Usercontrolconfig_Conf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_CONTROLS, filepath_Uf_Expr.Cur_Configuration);

            //
            // X → S
            if (log_Reports.Successful)
            {
                XmlToConfigurationtree_C11_Config to = new XmlToConfigurationtree_C11_ConfigImpl();
                to.XmlToConfigurationtree(
                    name_Control,
                    filepathHi_Uf,
                    filepathabs_Uf,
                    Usercontrolconfig_Conf,
                    folderpath_Forms_Expr,
                    owner_MemoryApplication,
                    log_Reports
                    );
            }

            //
            // (F) X → E
            this.XToEc_Usercontrolconfig(
                Usercontrolconfig_Conf,
                record_Uf,
                folderpath_Forms_Expr,
                log_Reports
                );

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_Fpath:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("△情報53!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("コンポーネント設定ファイルへのパスが指定されていないので、");
                s.Newline();
                s.Newline();
                s.Append("処理しません。");
                s.Newline();
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        /// <summary>
        /// <f-set-var>読み込み。
        /// </summary>
        /// <param name="oProjectConfigFilePath"></param>
        public void LoadFile(
            Expression_Node_Filepath ec_Fopath_Editor,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile1",log_Reports);
            //
            //

            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole("「エディター設定ファイル」を読み込みます。システム変数の自動類推も行います。");
            }

            // 「エディター・フォルダー」パス
            string sFopath_Editor = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

            Configurationtree_Node cf_Auto = null;
            if (log_Reports.Successful)
            {
                //
                // 「エディター・フォルダー」から、「Engine」「Forms」「Logs」のフォルダーパスを類推します。
                // これは「エディター設定ファイル」で上書き可能です。日本語フォルダー名に置き換えることもできます。
                //

                cf_Auto = new Configurationtree_NodeImpl("!ハードコーディング自動補完", null);//todo:親ノード
            }

            string sFpatha_AaEditorXml = "";
            if (log_Reports.Successful)
            {
                //
                // @Editor.xml へのファイルパス。
                //
                // 「エディター・フォルダー」パス → 「@Editor.xml ファイルパス」へ変換。
                sFpatha_AaEditorXml = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML;
            }

            //
            // 変数の読取りを開始します。
            //
            Exception err_Exception;
            if (log_Reports.Successful)
            {
                XmlDocument xDoc = new XmlDocument();

                try
                {

                    // 正常時

                    xDoc.Load(sFpatha_AaEditorXml);

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

                    // スクリプトファイルのバージョンチェック。(エディター設定ファイル)
                    ValuesAttr.Test_Codefileversion(
                        xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute),
                        log_Reports,
                        new Configurationtree_NodeImpl(sFpatha_AaEditorXml, null),
                        NamesNode.S_CODEFILE_EDITOR
                        );

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

                    for (int nIndex_Fsetvar = 0; nIndex_Fsetvar < xNl_Fsetvar.Count; nIndex_Fsetvar++)
                    {
                        XmlNode xNode_Fsetvar = xNl_Fsetvar.Item(nIndex_Fsetvar);

                        if (XmlNodeType.Element == xNode_Fsetvar.NodeType)
                        {
                            // <f-set-var>要素
                            XmlElement x_Fsetvar = (XmlElement)xNode_Fsetvar;
                            Configurationtree_NodeImpl s_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR, null);//todo:親ノード

                            string sNamevar = x_Fsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute);
                            string sFolder = x_Fsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute);
                            string sValue = x_Fsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute);
                            string sDescription = x_Fsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute);

                            s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_NAME_VAR.Name_Pm, sNamevar, log_Reports);
                            s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sFolder, log_Reports);
                            s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sValue, log_Reports);
                            s_Fsetvar.Dictionary_Attribute.Set(PmNames.S_DESCRIPTION.Name_Pm, sDescription, log_Reports);

                            this.MemoryAaeditorxml_Editor.Dictionary_Fsetvar_Configurationtree.List_Child.Add(s_Fsetvar, log_Reports);
                        }
                    }

                }
                catch (System.IO.DirectoryNotFoundException ex)
                {
                    // エラー
                    err_Exception = ex;
                    goto gt_Error_DirectoryNotFound;
                }
                catch (System.Exception ex)
                {
                    // エラー
                    err_Exception = ex;
                    goto gt_Error_Exception;
                }

                //
                // 変数の読取りは終わった。
                //
            }

            //
            // @Editor.xml へのファイルパス。
            //
            if (log_Reports.Successful)
            {
                // 「エディター・フォルダー」パス → 「@Editor.xml ファイルパス」へ変換。
                string sFpath_EditorXml = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML;

                this.cur_Configurationtree = new Configurationtree_NodeImpl("(L09Mid読取)", ec_Fopath_Editor.Cur_Configuration);
            }

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

                StringBuilder s = new StringBuilder();
                s.Append("指定されたファイルパスを読み取れませんでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("『エディター設定ファイル』読み取り中。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("もしかして?: ファイルパスを確認してください。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                //
                // ヒント
                s.Append(err_Exception.Message);

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

                StringBuilder s = new StringBuilder();
                s.Append("『エディター設定ファイル』読み取り中に、何らかのエラーが発生しました。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("もしかして?: XMLのencoding指定が間違っている?この読取プログラムの期待するエンコードでないかも?");
                s.Append(Environment.NewLine);
                s.Append("もしかして?: それ以外の理由?");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                //
                // ヒント
                s.Append(err_Exception.Message);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
        /// <summary>
        /// セレクト文を作成します。
        /// </summary>
        /// <param name="out_bOneCellSelectCondition"></param>
        /// <param name="selectSt"></param>
        /// <param name="out_bExists_Awhr"></param>
        /// <param name="s_Fcell"></param>
        /// <param name="log_Reports"></param>
        private void E_Execute_P1_CleateSelect(
            out bool bOneCellSelectCondition_Out,//「フィールド名 = 値」の形のみ true。 エラー時もfalse。
            out Selectstatement selectSt,
            out bool bExists_Awhr_Out,//@whereの有無を返します。エラー時はfalse。
            Configuration_Node cf_Fcell,//「S■f-cell」。
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "E_Execute_P1_CleateSelect",log_Reports);
            //
            //

            //
            // 空っぽのセレクト文。
            //
            bExists_Awhr_Out = false;
            bOneCellSelectCondition_Out = false;
            selectSt = new SelectstatementImpl(this, cf_Fcell);
            Expression_Node_StringImpl ec_Awhr_Src = null;//子「E■where」

            //
            // (1)select=”☆”
            //    抽出する列名のリスト。
            //
            Expression_Node_String ec_Aselect = null;//ソース情報利用のE
            if (log_Reports.Successful)
            {
                this.TrySelectAttribute(out ec_Aselect, PmNames.S_SELECT.Name_Pm, EnumHitcount.One, log_Reports);
            }

            if (log_Reports.Successful)
            {
                selectSt.List_SName_SelectField = new CsvTo_ListImpl().Read(ec_Aselect.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
            }

            //
            // (2)into 属性
            //
            if (log_Reports.Successful)
            {
                Expression_Node_String ec_Into;//ソース情報利用のE
                bool bHit = this.TrySelectAttribute(out ec_Into, "into", EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit)
                {
                    selectSt.Expression_Into = ec_Into;
                }
            }

            //
            // (3)「E■@where」。無いものもある。
            //
            if (log_Reports.Successful)
            {
                Expression_Node_String ec_Awhr1_Src;
                this.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak)
                {
                    string sValue;
                    e_Child.TrySelectAttribute(out sValue, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);

                    if (NamesNode.S_FNC == e_Child.Cur_Configuration.Name &&
                        NamesFnc.S_WHERE == sValue)
                    {
                        ec_Awhr1_Src = e_Child;// Expression_Node_StringImpl である必要がある。E_String_AtomImplではダメ。

                        if (ec_Awhr1_Src is Expression_Node_StringImpl)
                        {
                            ec_Awhr_Src = (Expression_Node_StringImpl)ec_Awhr1_Src;
                        }
                        else
                        {
                            // エラー。
                            goto gt_Error_AtomWhr2;
                        }

                        bBreak = true;
                    }

                    goto gt_EndMethod2;

                // エラー。
                gt_Error_AtomWhr2:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();

                        Expression_Leaf_StringImpl ec_Leaf = (Expression_Leaf_StringImpl)ec_Awhr1_Src;
                        tmpl.SetParameter(1, ec_Leaf.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数

                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6015;", tmpl, log_Reports);
                    }
                    goto gt_EndMethod2;

                    //
                gt_EndMethod2:
                    ;
                });

                if (null != ec_Awhr_Src)
                {
                    // 子「E■where」あり。
                    bExists_Awhr_Out = true;
                }
                else
                {
                    // 正常。無いこともあります。
                    bExists_Awhr_Out = false;
                    Configurationtree_Node cf_Node = new Configurationtree_NodeImpl(this + ":Where属性該当なし", null);
                    ec_Awhr_Src = new Expression_Node_StringImpl(this, cf_Node);
                }
            }
            else
            {
                // エラーがあるのでさっさと抜ける。
                bOneCellSelectCondition_Out = false;
                bExists_Awhr_Out = false;
                goto gt_EndMethod;
            }

            //
            // (3)required=”★”
            //    レコードが1件以上ヒットすることが必須か。"true","TRUE"等。
            //
            if (log_Reports.Successful)
            {
                // <f-cell required=”☆”>を使う。

                //
                // <f-cell>は required属性を持たないはず。
                // <fnc name=”Sf:where;”>のrequired引数が登録される?
                //
                //

                string sRequired;
                bool bHit = this.TrySelectAttribute(out sRequired, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit)
                {
                    selectSt.Required = sRequired;
                }
                else
                {
                    //
                    // <f-cell>が required属性を持っていないとき。
                    //
                    //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていないとき。");

                    //
                    // where属性で「E■where」(fnc)を持っているはず。(無条件のときは持っていない)
                    //
                    Expression_Node_String ec_Whr;//属性利用
                    bool bHit2 = this.TrySelectAttribute(out ec_Whr, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                    if (bHit2)
                    {
                        bool bHit3 = ec_Whr.TrySelectAttribute(out sRequired, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                        if (bHit3)
                        {
                            selectSt.Required = sRequired;
                            //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得した。[" + selectSt.Required + "]");
                        }
                        else
                        {
                            // whereのrequired設定が未指定。

                            // #エラー
                            System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得しようとしたが、whereのrequiredは未設定だった。[" + selectSt.Required + "]");
                        }
                    }
                    else
                    {
                        //
                        // <f-cell>が、where属性を持っていない。 【正常】
                        //

                        //// required設定が未指定。

                        //// #エラー
                        //System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得しようとしたが、whereは未設定だった。[" + selectSt.Required + "]");

                        //if (bDbg1)
                        //{
                        //    System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect:┌────────┐this.E_AttrDic.Count=[" + this.E_AttrDic.Count + "]");
                        //    this.E_AttrDic.Each_E_Nodes(delegate(string sName, Expression_Node_String e_Child, ref bool bBreak)
                        //    {
                        //        System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: [" + sName + "]=[" + e_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                        //    });
                        //    System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect:└────────┘");
                        //}
                    }
                }
            }

            //
            // (4)テーブル名。"Ut:モンスター表"等。
            //
            if (log_Reports.Successful)
            {
                // <f-cell from=”☆”>を使う。
                Expression_Node_String ec_From;//ソース情報利用
                bool bHit = this.TrySelectAttribute(out ec_From, PmNames.S_FROM.Name_Pm, EnumHitcount.One, log_Reports);
                if (bHit)
                {
                    selectSt.Expression_From = ec_From;
                }

                // テーブル名は必須。
                if ("" == selectSt.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                {
                    //
                    // エラー。
                    //dst_Rs = null;
                    goto gt_Error_EmptyTableName;
                }
            }

            //
            // 「E■f-cell」は、子要素を持たない。
            //
            // 「E■f-cell」には、次の属性がある。
            // (1)「E■@where」
            //
            //
            // 「E■@where」は、次の子要素のリストがある。
            // ・「E■fnc name=”Sf:rec-cond;”」
            //

            //
            // f-cellの子要素の数は、where要素1つ、または 0 が正しい。
            //
            if (log_Reports.Successful)
            {
                // 子要素。
                List<Expression_Node_String> ecList = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports);
                //if (0 < e_List.Count)
                if (1 < ecList.Count)
                {
                    goto gt_Error_ExistsFcellChild;
                }
            }

            //
            // (2)探したいキー値の有無。"1000"等。
            if (log_Reports.Successful)
            {

                // key属性(@where)、record-set-load-from属性のどちらかが書かれているはず。

                if (
                    bExists_Awhr_Out ||
                    "" != selectSt.Expression_Where_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim()
                    )
                {
                    //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_PP1_FcellToSelectSt: 「E■a-where keyField=”☆”」は無かったが、「子E■rec-cond」要素はあった場合。");

                    // 次へ進む。
                }
                else
                {
                    // エラー。key値(@where)も、record-set-load-from属性もない。
                    goto gt_Error_EmptyKey;
                }
            }

            //
            // <f-cell>が、keyField=”★”属性("ID"などの値)を持つのは、R4-100版で廃止されました。
            //

            //
            // (5)あれば、「E■@where」の解析。(2012-02-07)
            //
            if (log_Reports.Successful)
            {
                if (bExists_Awhr_Out)
                {
                    // 「E■@where」条件が付いているとき。

                    // 「E■@where」の logic属性を取得しておく。
                    {
                        string sLogic;
                        bool bHit = ec_Awhr_Src.TrySelectAttribute(out sLogic, PmNames.S_LOGIC.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                        if (bHit)
                        {
                            selectSt.EnumWherelogic = Utility_Table.LogicStringToEnum(sLogic);
                            //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: where要素のlogic属性もきちんと読み取り。[" + sAwhrLogic + "]");
                        }
                    }

                    this.Execute_ParseChildRecordconditionList(
                        selectSt.List_Recordcondition,
                        ec_Awhr_Src,
                        log_Reports
                        );
                }
                else
                {
                    // 「E■@where」条件が無い場合。

                    // #警告。正常。
                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: 条件がないタイプ(whereを持たない)です。親ノード=" + this.Cur_Configuration.Parent);
                }
            }

            //
            // 「E■@where」は、2種類に判別。
            // (1)「E■rec-cond」が1つだけ入っている形式
            // (2)「E■rec-cond」が1つ以上入っている形式
            //
            if (log_Reports.Successful)
            {
                if (0 == selectSt.List_Recordcondition.Count())
                {
                    //
                    // 0個なら、無条件。
                    //
                }
                else if (1 == selectSt.List_Recordcondition.Count())
                {
                    //
                    // 「フィールド値=値」の形の条件式かどうかを調べます。
                    //

                    // ・<rec-cond>が1つ
                    Recordcondition firstReccond = selectSt.List_Recordcondition[0];
                    if (null == firstReccond)
                    {
                        // #エラー? TODO:エラー?
                        System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: rec-condリストにヌルが入っていた。エラー?");

                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // ・その<rec-cond>は logic属性を持たない。
                    if (EnumLogic.None != firstReccond.EnumLogic)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // field属性には1つのフィールド名が書かれている。(selectではないので、そうでなければエラー)
                    List<string> sList_FieldName = new CsvTo_ListImpl().Read(firstReccond.Name_Field);
                    if (1 != sList_FieldName.Count)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // valueを持つ。
                    if ("" == firstReccond.Value.Trim())
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    //「=」で結ばれている条件のもの。
                    if (EnumOpe.Eq != firstReccond.EnumOpe)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // 適合。「フィールド名=値」の形の条件式。セル1つが選ばれる。
                    bOneCellSelectCondition_Out = true;
                }
                else
                {
                    // 条件ハズレ。
                }
            }

            end_conditionSpec:

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_ExistsFcellChild:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.Cur_Configuration.Name, log_Reports);//設定ノード名

                List<Expression_Node_String> e_List = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports);
                tmpl.SetParameter(2, e_List.Count.ToString(), log_Reports);//子要素の数

                Log_TextIndented s = new Log_TextIndentedImpl();
                foreach (Expression_Node_String ec_Child in e_List)
                {
                    s.Append("Expr[" + ec_Child.Cur_Configuration.Name + "]");
                    s.Newline();
                }
                tmpl.SetParameter(3, s.ToString(), log_Reports);//要素のリスト

                tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6016;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyKey:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, bExists_Awhr_Out.ToString(), log_Reports);//Where句の有無
                tmpl.SetParameter(2, selectSt.Expression_Where_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(), log_Reports);//RecordSetLoadFrom属性
                tmpl.SetParameter(3, this.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数

                Log_TextIndented s1 = new Log_TextIndentedImpl();
                this.Dictionary_Expression_Attribute.ForEach(delegate(string sName3, Expression_Node_String e_Attr3, ref bool bBreak)
                {
                    s1.Append("Attribute[" + sName3 + "]=Expr[" + e_Attr3.Cur_Configuration.Name + "] 値=[" + e_Attr3.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    s1.Newline();
                });
                tmpl.SetParameter(4, s1.ToString(), log_Reports);//属性リスト

                tmpl.SetParameter(5, this.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//子要素の数

                Log_TextIndented s2 = new Log_TextIndentedImpl();
                this.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak)
                {
                    s2.Append("子 [" + e_Child.Cur_Configuration.Name + "]=[" + e_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    s2.Newline();
                });
                tmpl.SetParameter(6, s2.ToString(), log_Reports);//子要素リスト

                tmpl.SetParameter(7, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6017;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyTableName:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cf_Fcell), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6018;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Exemple #20
0
        //────────────────────────────────────────
        /// <summary>
        /// UsercontrolPerformerImpl#Perform_FcImpl で使用。
        /// UsercontrolPerformerImpl#Perform で使用。
        /// 
        /// cf_Eventは、ucFc.ControlCommon.Configurationtree_Control.SDic_Event から取っている。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="event_Conf"></param>
        /// <param name="moWorkbench"></param>
        /// <param name="log_Reports"></param>
        public void Execute2_Event(
            object sender,
            Configurationtree_Node event_Conf,
            MemoryApplication owner_MemoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute2_Event", log_Reports);

            Configurationtree_Node cf_ThisMethod = new Configurationtree_NodeImpl("<" + log_Method.Fullname + ":>", null);

            if (log_Reports.CanStopwatch)
            {

                // コメント作成
                {
                    StringBuilder sb = new StringBuilder();

                    string sName_Control;
                    {
                        Configuration_Node owner_Configurationtree_Control = event_Conf.GetParentByNodename(
                            NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports);
                        ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Control, false, log_Reports);
                    }

                    string sEventName;
                    {
                        event_Conf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, false, log_Reports);
                    }

                    int nActionCount;
                    {
                        nActionCount = event_Conf.List_Child.Count;
                    }

                    sb.Append(Info_Functions.Name_Library);
                    sb.Append(":");
                    sb.Append(this.GetType().Name);
                    sb.Append("#ToString: イベント計測 ");
                    sb.Append(" FC[");
                    sb.Append(sName_Control);
                    sb.Append("].EV[");
                    sb.Append(sEventName);
                    sb.Append("]");

                    if (0 < nActionCount)
                    {
                        sb.Append("アクション数=[");
                        sb.Append(nActionCount);
                        sb.Append("]");
                    }

                    log_Method.Log_Stopwatch.Message = sb.ToString();
                    log_Method.Log_Stopwatch.Begin();

                }

            }

            // ステータスバーに表示する文字列。
            {
                if (sender is Customcontrol)
                {
                    Customcontrol ccFc = (Customcontrol)sender;

                    if (null == ccFc.ControlCommon.Owner_MemoryApplication)
                    {
                        log_Method.WriteDebug_ToConsole("null==ccFc.ControlCommon.Owner_MemoryApplication がヌルでした。");
                    }
                    else
                    {
                        ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolNameBegin(log_Reports);

                        string sName_Usercontrol = sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                        ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolName(sName_Usercontrol, log_Reports);
                    }

                }
            }

            event_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Action, ref bool bBreak)
            {
                Executer3_FunctionImpl exe2 = new Executer3_FunctionImpl();

                // イベントハンドラーの作成
                Expression_Node_Function expr_Func = exe2.ConfigurationtreeToFunction(
                    s_Action,
                    owner_MemoryApplication,
                    log_Reports
                    );

                // システム定義関数の実行
                exe2.Execute3_Function(
                    expr_Func,
                    sender,
                    owner_MemoryApplication,
                    log_Reports
                    );

                // 他の待機スレッドに、実行順番を譲る。
                //TODO: System.Threading.Thread.Sleep(0);

                //if (Log_ReportsImpl.BDebugmode_Static)
                //{
                //    //.WriteLine(this.GetType().Name + "#:\n│\n│\n│\n│");
                //}
            });

            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        protected void Execute6_Sub(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports);

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

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

            //
            // 変数は、登録されている名前の変数は存在し、登録されていない名前の変数は(自動作成されたもの以外は)存在しない。
            //
            // 元となるテーブルを見ながら、変数オブジェクトの内容を調べていく。
            //
            //

            Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname, null);

            // 変数ログを吐く。
            {
                StringBuilder sb = new StringBuilder();

                //1行目
                sb.Append(NamesFld.S_NO);
                sb.Append(",");
                sb.Append(NamesFld.S_ID);
                sb.Append(",");
                sb.Append(NamesFld.S_EXPL);
                sb.Append(",");
                sb.Append(NamesFld.S_NAME);
                sb.Append(",");
                sb.Append(NamesFld.S_FOLDER);
                sb.Append(",");
                sb.Append(NamesFld.S_VALUE);
                sb.Append(",");
                sb.Append(NamesFld.S_END);
                sb.Append(Environment.NewLine);

                //2行目
                sb.Append(NamesTypedb.S_INT);//NO
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//ID
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//Expl
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//NAME
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//FOLDER
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//VALUE
                sb.Append(",");
                sb.Append(NamesFld.S_END);//END
                sb.Append(Environment.NewLine);

                //3行目
                sb.Append("-1,");//NO
                sb.Append("使わない,");//ID
                sb.Append("解説,");//Expl
                sb.Append("変数名,");//NAME
                sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,");//FOLDER
                sb.Append("初期値,");//VALUE
                sb.Append(NamesFld.S_END);//END
                sb.Append(Environment.NewLine);

                int nAuto = 0;
                this.Owner_MemoryApplication.MemoryVariables.EachVariable(delegate(string sKey, Expression_Node_String ec_String, ref bool bBreak)
                {
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("[" + sKey + "]=[" + ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    }

                    sb.Append(nAuto);//NO
                    sb.Append(",");
                    //ID 使わない
                    sb.Append(",");
                    //Expl 消えてしまう
                    sb.Append(",");
                    sb.Append(sKey);//NAME
                    sb.Append(",");
                    //FOLDER TODO:逆算が必要
                    sb.Append(",");
                    sb.Append(ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));//VALUE
                    sb.Append(",");
                    sb.Append(NamesFld.S_END);//END
                    sb.Append(Environment.NewLine);

                    nAuto++;
                });

                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole(sb.ToString());
                }

                //ログ出力
                {
                    Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports);

                    string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOG_VARIABLES;

                    if (log_Reports.Successful)
                    {
                        CsvWriterImpl writer = new CsvWriterImpl();
                        writer.Write(
                            sb.ToString(),
                            sFpatha_LogVariables,
                            true
                            );
                    }
                }
            }

            //変数CSVを吐き出したい。(登録されている順序を保って)
            {
                // 変数ファイルの読取り
                Table_Humaninput o_Table_Variables;
                this.Owner_MemoryApplication.MemoryVariables.TryGetTable_Variables(
                    out o_Table_Variables,
                    Application.StartupPath,
                    log_Reports
                    );

                if (null != o_Table_Variables)
                {
                    StringBuilder sb = new StringBuilder();

                    //1行目
                    sb.Append(NamesFld.S_NO);
                    sb.Append(",");
                    sb.Append(NamesFld.S_ID);
                    sb.Append(",");
                    sb.Append(NamesFld.S_EXPL);
                    sb.Append(",");
                    sb.Append(NamesFld.S_NAME);
                    sb.Append(",");
                    sb.Append(NamesFld.S_FOLDER);
                    sb.Append(",");
                    sb.Append(NamesFld.S_VALUE);
                    sb.Append(",");
                    sb.Append(NamesFld.S_END);
                    sb.Append(Environment.NewLine);

                    //2行目
                    sb.Append(NamesTypedb.S_INT);//NO
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_INT);//ID
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//Expl
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//NAME
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//FOLDER
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//VALUE
                    sb.Append(",");
                    sb.Append(NamesFld.S_END);//END
                    sb.Append(Environment.NewLine);

                    //3行目
                    sb.Append("-1,");//NO
                    sb.Append("使わない,");//ID
                    sb.Append("解説,");//Expl
                    sb.Append("変数名,");//NAME
                    sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,");//FOLDER
                    sb.Append("初期値,");//VALUE
                    sb.Append(NamesFld.S_END);//END
                    sb.Append(Environment.NewLine);

                    int nAuto = 0;
                    foreach (DataRow row in o_Table_Variables.DataTable.Rows)
                    {

                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NO))
                        {
                            int nValue;
                            Int_HumaninputImpl.TryParse(row[NamesFld.S_NO], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports);
                            sb.Append(nValue);
                            sb.Append(",");
                        }

                        // IDは空欄が正しいが、int型なので空欄にできないので 0 を入れる。
                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_ID))
                        {
                            int nValue;
                            Int_HumaninputImpl.TryParse(row[NamesFld.S_ID], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports);
                            sb.Append(nValue);
                            sb.Append(",");
                        }

                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_EXPL))
                        {
                            string sValue;
                            String_HumaninputImpl.TryParse(row[NamesFld.S_EXPL], out sValue, "", "", log_Method, log_Reports);
                            sb.Append(sValue);
                            sb.Append(",");
                        }

                        string sName_Var = "";
                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NAME))
                        {
                            string sValue;
                            String_HumaninputImpl.TryParse(row[NamesFld.S_NAME], out sValue, "", "", log_Method, log_Reports);
                            sb.Append(sValue);
                            sb.Append(",");

                            sName_Var = sValue;
                        }

                        // 現在の変数の内容
                        string sValue_Var = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports);

                        //現在の変数の内容を検索
                        if (NamesVar.Test_Filepath(sName_Var))
                        {
                            Expression_Node_Filepath ec_Fpath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports);
                            // 絶対パスとは限らない。フォルダーを指していることもある。
                            string sFpath = ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                            //フォルダー列値を取得。
                            string sNamevar_Folder_Src;
                            if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_FOLDER))
                            {
                                String_HumaninputImpl.TryParse(row[NamesFld.S_FOLDER], out sNamevar_Folder_Src, "", "", log_Method, log_Reports);

                                //フォルダーパス
                                Expression_Node_Filepath ec_Folder = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sNamevar_Folder_Src,null,cur_Cf), false, log_Reports);
                                if (null != ec_Folder)
                                {
                                    // FOLDER列に入力があれば。

                                    string sFpath_Folder = ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                                    if (sValue_Var.StartsWith(sFpath_Folder))
                                    {
                                        // FOLDER列値をそのままキープ。
                                        sb.Append(sNamevar_Folder_Src);

                                        // 値のフォルダー部分を削る。
                                        sValue_Var = sValue_Var.Substring(sFpath_Folder.Length);

                                        // 先頭が ディレクトリー区切り文字なら削る。
                                        if (sValue_Var.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                                        {
                                            sValue_Var = sValue_Var.Substring(System.IO.Path.DirectorySeparatorChar.ToString().Length);
                                        }
                                    }
                                    else
                                    {
                                        // FOLDER列値はそのまま使えない。
                                    }
                                }

                                sb.Append(",");
                            }

                            if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE))
                            {
                                //string sValue;
                                //String_HumaninputImpl.TryParse(row[NamesFld.S_VALUE], out sValue, "", "", log_Method, log_Reports);
                                //sb.Append(sValue);
                                //sb.Append(",");

                                // 現在の変数の値(の削った残り)を入れる。
                                sb.Append(sValue_Var);
                                sb.Append(",");
                            }
                        }
                        else// if (NamesVar.Test_String(sName_Var))
                        {

                            // FOLDER列値は無し。
                            sb.Append(",");

                            if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE))
                            {
                                // 現在の変数の値を入れる。
                                sb.Append(sValue_Var);
                                sb.Append(",");
                            }
                        }

                        sb.Append(NamesFld.S_END);
                        sb.Append(Environment.NewLine);

                        nAuto++;
                    }

                    //ファイル書出し
                    {
                        Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports);

                        string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_SAVE_VARIABLES;

                        if (log_Reports.Successful)
                        {
                            CsvWriterImpl writer = new CsvWriterImpl();
                            writer.Write(
                                sb.ToString(),
                                sFpatha_LogVariables,
                                true
                                );
                        }
                    }
                }
            }

            //
            // メッセージボックスの表示。
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(this.GetType().Name);
                sb.Append("#Execute6_Sub:");
                sb.Append(Environment.NewLine);
                string sArgMessage;
                this.TrySelectAttribute(out sArgMessage, Expression_Node_Function45Impl.PM_MESSAGE, EnumHitcount.One_Or_Zero, log_Reports);

                sb.Append(sArgMessage);

                MessageBox.Show(sb.ToString(), "変数をCSVファイルに書き出したい。");
            }

            log_Method.EndMethod(log_Reports);
        }
Exemple #22
0
        //────────────────────────────────────────
        /// <summary>
        /// 変数を設定します。
        /// </summary>
        public void SetVariable(
            XenonName o_Name_Variable,
            Expression_Node_String ec_Value,
            bool bRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetVariable",log_Reports);
            //
            //

            if (
                o_Name_Variable.SValue.StartsWith(NamesVar.S_SP_) ||
                o_Name_Variable.SValue.StartsWith(NamesVar.S_UP_)
                )
            {
                string sFilePath = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_" + this.GetType().Name + "#SetVariable", null);

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

                Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);

                this.SetFilepathValue(
                    o_Name_Variable.SValue,
                    ec_Fpath,
                    bRequired,
                    log_Reports
                    );
            }
            else if (
                // 新仕様
                o_Name_Variable.SValue.StartsWith(NamesVar.S_SS_) ||
                o_Name_Variable.SValue.StartsWith(NamesVar.S_US_)
                )
            {
                string str1 = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                this.SetStringValue(
                    o_Name_Variable,
                    str1,
                    bRequired,
                    log_Reports
                    );
            }
            else
            {
            }

            //
            //
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        protected void Execute6_Sub(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports);

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

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

            //
            // 変数は、登録されている名前の変数は存在し、登録されていない名前の変数は(自動作成されたもの以外は)存在しない。
            //
            // 元となるテーブルを見ながら、変数オブジェクトの内容を調べていく。
            //
            //

            Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname, null);

            // 変数ログを吐く。
            {
                StringBuilder sb = new StringBuilder();

                //1行目
                sb.Append(NamesFld.S_NO);//NO
                sb.Append(",");
                sb.Append(NamesFld.S_ID);//ID
                sb.Append(",");
                sb.Append(NamesFld.S_TREE);//TREE
                sb.Append(",");
                sb.Append(NamesFld.S_EXPL);//Expl
                sb.Append(",");
                sb.Append(NamesFld.S_FILE);//FILE
                sb.Append(",");
                sb.Append(NamesFld.S_NAME);//NAME
                sb.Append(",");
                sb.Append(NamesFld.S_TYPE);//TYPE
                sb.Append(",");
                sb.Append(NamesFld.S_TEXT);//TEXT
                sb.Append(",");
                sb.Append(NamesFld.S_FONT_SIZE_PT);//FONT_SIZE_PT
                sb.Append(",");
                sb.Append(NamesFld.S_X_LT);//X_LT
                sb.Append(",");
                sb.Append(NamesFld.S_Y_LT);//Y_LT
                sb.Append(",");
                sb.Append(NamesFld.S_WIDTH);//WIDTH
                sb.Append(",");
                sb.Append(NamesFld.S_HEIGHT);//HEIGHT
                sb.Append(",");
                sb.Append(NamesFld.S_ENABLED);//ENABLED
                sb.Append(",");
                sb.Append(NamesFld.S_VISIBLE);//VISIBLE
                sb.Append(",");
                sb.Append(NamesFld.S_READ_ONLY);//READ_ONLY
                sb.Append(",");
                sb.Append(NamesFld.S_WORD_WRAP);//WORD_WRAP
                sb.Append(",");
                sb.Append(NamesFld.S_NEW_LINE);//NEW_LINE
                sb.Append(",");
                sb.Append(NamesFld.S_SCROLL_BARS);//SCROLL_BARS
                sb.Append(",");
                sb.Append(NamesFld.S_CHK_VALUE_TYPE);//CHK_VALUE_TYPE
                sb.Append(",");
                sb.Append(NamesFld.S_PIC_ZOOM);//PIC_ZOOM
                sb.Append(",");
                sb.Append(NamesFld.S_TAB_INDEX);//TAB_INDEX
                sb.Append(",");
                sb.Append(NamesFld.S_BACK_COLOR);//BACK_COLOR
                sb.Append(",");
                //ここまで基本テーブル。
                sb.Append(NamesFld.S_ITEM_HEIGHT_PX);//ITEM_HEIGHT_PX
                sb.Append(",");
                sb.Append(NamesFld.S_ITEM_DISPLAY_FORMAT);//ITEM_DISPLAY_FORMAT
                sb.Append(",");
                sb.Append(NamesFld.S_LIST_VALUE_FIELD);//LIST_VALUE_FIELD
                sb.Append(",");
                sb.Append(NamesFld.S_END);
                sb.Append(Environment.NewLine);

                //2行目
                sb.Append(NamesTypedb.S_INT);//NO
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//ID
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//TREE
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//Expl
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//FILE
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//NAME
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//TYPE
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//TEXT
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//FONT_SIZE_PT
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//X_LT
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//Y_LT
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//WIDTH
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//HEIGHT
                sb.Append(",");
                sb.Append(NamesTypedb.S_BOOL);//ENABLED
                sb.Append(",");
                sb.Append(NamesTypedb.S_BOOL);//VISIBLE
                sb.Append(",");
                sb.Append(NamesTypedb.S_BOOL);//READ_ONLY
                sb.Append(",");
                sb.Append(NamesTypedb.S_BOOL);//WORD_WRAP
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//NEW_LINE
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//SCROLL_BARS
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//CHK_VALUE_TYPE
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//PIC_ZOOM
                sb.Append(",");
                sb.Append(NamesTypedb.S_INT);//TAB_INDEX
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//BACK_COLOR
                sb.Append(",");
                //ここまで基本テーブル。
                sb.Append(NamesTypedb.S_INT);//ITEM_HEIGHT_PX
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//ITEM_DISPLAY_FORMAT
                sb.Append(",");
                sb.Append(NamesTypedb.S_STRING);//LIST_VALUE_FIELD
                sb.Append(",");
                sb.Append(NamesFld.S_END);
                sb.Append(Environment.NewLine);

                //3行目
                sb.Append("-1,");//NO
                sb.Append("使わない,");//ID
                sb.Append("ネスト関係,");//TREE
                sb.Append("解説,");//Expl
                sb.Append("コントロール設定ファイルパス,");//FILE
                sb.Append("コントロール固有名,");//NAME
                sb.Append("コントロールの型,");//TYPE
                sb.Append("初期値,");//TEXT
                sb.Append("フォントサイズ(pt),");//FONT_SIZE_PT
                sb.Append("左上角の座標X,");//X_LT
                sb.Append("左上角の座標Y,");//Y_LT
                sb.Append("横幅ピクセル,");//WIDTH
                sb.Append("縦幅ピクセル,");//HEIGHT
                sb.Append("活性化,");//ENABLED
                sb.Append("可視,");//VISIBLE
                sb.Append("テキストボックス等を読み取り専用にするなら真。,");//READ_ONLY
                sb.Append("テキストエリアで行を自動的に折り返すなら真。,");//WORD_WRAP
                sb.Append("(テキストエリア)改行記号。,");//NEW_LINE
                sb.Append("テキストエリア等で利用。None,Horizontal,Vertical,Bothの4つ。使わないなら空欄。,");//SCROLL_BARS
                sb.Append("チェックボックスの値の型。(空欄:false,true。ZERO_ONE:0,1),");//CHK_VALUE_TYPE
                sb.Append("(未実装)画像の倍角サイズ。2000で2倍。,");//PIC_ZOOM
                sb.Append("タブ・インデックス,");//TAB_INDEX
                sb.Append("背景色,");//BACK_COLOR
                //ここまで基本テーブル。
                sb.Append("リストボックスの項目の高さ(ピクセル),");//ITEM_HEIGHT_PX
                sb.Append("リストボックスの各項目の表示書式,");//ITEM_DISPLAY_FORMAT
                sb.Append("(開発中)リストボックスの値が入っている、レコードのフィールド名。,");//LIST_VALUE_FIELD
                sb.Append(NamesFld.S_END);
                sb.Append(Environment.NewLine);

                int nAuto = 0;
                this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol uct_Child, ref bool bRemove, ref bool bBreak)
                {
                    //uct_Child.ControlCommon.Configurationtree_Control.Dictionary_Attribute.

                    sb.Append(nAuto);//NO
                    sb.Append(",");
                    //ID は使わない。
                    sb.Append(",");
                    sb.Append(NamesFld.S_TREE);//TREE
                    sb.Append(",");
                    sb.Append(NamesFld.S_EXPL);//Expl
                    sb.Append(",");
                    sb.Append(NamesFld.S_FILE);//FILE
                    sb.Append(",");
                    sb.Append(uct_Child.ControlCommon.Configurationtree_Control.Name);//NAME
                    sb.Append(",");
                    sb.Append(NamesFld.S_TYPE);//TYPE
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolText);//TEXT
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolFontsizept);//FONT_SIZE_PT
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolXlt);//X_LT
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolYlt);//Y_LT
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolWidth);//WIDTH
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolHeight);//HEIGHT
                    sb.Append(",");
                    if (uct_Child.UsercontrolEnabled)
                    {
                        sb.Append(uct_Child.UsercontrolEnabled);//ENABLED
                    }
                    sb.Append(",");
                    if (uct_Child.UsercontrolVisible)
                    {
                        sb.Append(uct_Child.UsercontrolVisible);//VISIBLE
                    }
                    sb.Append(",");
                    if (uct_Child.UsercontrolReadonly)
                    {
                        sb.Append(uct_Child.UsercontrolReadonly);//READ_ONLY
                    }
                    sb.Append(",");
                    if (uct_Child.UsercontrolWordwrap)
                    {
                        sb.Append(uct_Child.UsercontrolWordwrap);//WORD_WRAP
                    }
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolNewline);//NEW_LINE
                    sb.Append(",");
                    switch (uct_Child.UsercontrolScrollbars)
                    {
                        case ScrollBars.Both:
                            sb.Append(ValuesAttr.S_BOTH);
                            break;
                        case ScrollBars.Horizontal:
                            sb.Append(ValuesAttr.S_HORIZONTAL);
                            break;
                        case ScrollBars.Vertical:
                            sb.Append(ValuesAttr.S_VERTICAL);
                            break;
                        default:
                            //TODO:「無視」と、「無し」は、分けたい。
                            //sb.Append(ValuesAttr.S_NONE);
                            break;
                    }
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolChkvaluetype);//CHK_VALUE_TYPE
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolPiczoom);//PIC_ZOOM
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolTabindex);//TAB_INDEX
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolBackcolor);//BACK_COLOR
                    sb.Append(",");
                    //ここまで基本テーブル。
                    sb.Append(uct_Child.UsercontrolItemheightpx);//ITEM_HEIGHT_PX
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolItemdisplayformat);//ITEM_DISPLAY_FORMAT
                    sb.Append(",");
                    sb.Append(uct_Child.UsercontrolListvaluefield/*"NO"*/);//TODO:LIST_VALUE_FIELD
                    sb.Append(",");
                    sb.Append(NamesFld.S_END);
                    sb.Append(Environment.NewLine);

                    nAuto++;
                });

                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole(sb.ToString());
                }

                //ログ出力
                {
                    Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports);

                    string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOG_FORM;

                    if (log_Reports.Successful)
                    {
                        CsvWriterImpl writer = new CsvWriterImpl();
                        writer.Write(
                            sb.ToString(),
                            sFpatha_LogVariables,
                            true
                            );
                    }
                }
            }

            //変数CSVを吐き出したい。(登録されている順序を保って)
            {
                // 変数ファイルの読取り
                Table_Humaninput o_Table_Variables;
                this.Owner_MemoryApplication.MemoryVariables.TryGetTable_Variables(
                    out o_Table_Variables,
                    Application.StartupPath,
                    log_Reports
                    );

                if (null != o_Table_Variables)
                {
                    StringBuilder sb = new StringBuilder();

                    //1行目
                    sb.Append(NamesFld.S_NO);//NO
                    sb.Append(",");
                    sb.Append(NamesFld.S_ID);//ID
                    sb.Append(",");
                    sb.Append(NamesFld.S_TREE);//TREE
                    sb.Append(",");
                    sb.Append(NamesFld.S_EXPL);//Expl
                    sb.Append(",");
                    sb.Append(NamesFld.S_NAME);
                    sb.Append(",");
                    sb.Append(NamesFld.S_FOLDER);
                    sb.Append(",");
                    sb.Append(NamesFld.S_VALUE);
                    sb.Append(",");
                    sb.Append(NamesFld.S_END);
                    sb.Append(Environment.NewLine);

                    //2行目
                    sb.Append(NamesTypedb.S_INT);//NO
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_INT);//ID
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//Expl
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//NAME
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//FOLDER
                    sb.Append(",");
                    sb.Append(NamesTypedb.S_STRING);//VALUE
                    sb.Append(",");
                    sb.Append(NamesFld.S_END);//END
                    sb.Append(Environment.NewLine);

                    //3行目
                    sb.Append("-1,");//NO
                    sb.Append("使わない,");//ID
                    sb.Append("解説,");//Expl
                    sb.Append("変数名,");//NAME
                    sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,");//FOLDER
                    sb.Append("初期値,");//VALUE
                    sb.Append(NamesFld.S_END);//END
                    sb.Append(Environment.NewLine);

                    int nAuto = 0;
                    foreach (DataRow row in o_Table_Variables.DataTable.Rows)
                    {

                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NO))
                        {
                            int nValue;
                            Int_HumaninputImpl.TryParse(row[NamesFld.S_NO], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports);
                            sb.Append(nValue);
                            sb.Append(",");
                        }

                        // IDは空欄が正しいが、int型なので空欄にできないので 0 を入れる。
                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_ID))
                        {
                            int nValue;
                            Int_HumaninputImpl.TryParse(row[NamesFld.S_ID], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports);
                            sb.Append(nValue);
                            sb.Append(",");
                        }

                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_EXPL))
                        {
                            string sValue;
                            String_HumaninputImpl.TryParse(row[NamesFld.S_EXPL], out sValue, "", "", log_Method, log_Reports);
                            sb.Append(sValue);
                            sb.Append(",");
                        }

                        string sName_Var = "";
                        if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NAME))
                        {
                            string sValue;
                            String_HumaninputImpl.TryParse(row[NamesFld.S_NAME], out sValue, "", "", log_Method, log_Reports);
                            sb.Append(sValue);
                            sb.Append(",");

                            sName_Var = sValue;
                        }

                        // 現在の変数の内容
                        string sValue_Var = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports);

                        //現在の変数の内容を検索
                        if (NamesVar.Test_Filepath(sName_Var))
                        {
                            Expression_Node_Filepath ec_Fpath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports);
                            // 絶対パスとは限らない。フォルダーを指していることもある。
                            string sFpath = ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                            //フォルダー列値を取得。
                            string sNamevar_Folder_Src;
                            if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_FOLDER))
                            {
                                String_HumaninputImpl.TryParse(row[NamesFld.S_FOLDER], out sNamevar_Folder_Src, "", "", log_Method, log_Reports);

                                //フォルダーパス
                                Expression_Node_Filepath ec_Folder = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sNamevar_Folder_Src,null,cur_Cf), false, log_Reports);
                                if (null != ec_Folder)
                                {
                                    // FOLDER列に入力があれば。

                                    string sFpath_Folder = ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                                    if (sValue_Var.StartsWith(sFpath_Folder))
                                    {
                                        // FOLDER列値をそのままキープ。
                                        sb.Append(sNamevar_Folder_Src);

                                        // 値のフォルダー部分を削る。
                                        sValue_Var = sValue_Var.Substring(sFpath_Folder.Length);

                                        // 先頭が ディレクトリー区切り文字なら削る。
                                        if (sValue_Var.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                                        {
                                            sValue_Var = sValue_Var.Substring(System.IO.Path.DirectorySeparatorChar.ToString().Length);
                                        }
                                    }
                                    else
                                    {
                                        // FOLDER列値はそのまま使えない。
                                    }
                                }

                                sb.Append(",");
                            }

                            if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE))
                            {
                                //string sValue;
                                //String_HumaninputImpl.TryParse(row[NamesFld.S_VALUE], out sValue, "", "", log_Method, log_Reports);
                                //sb.Append(sValue);
                                //sb.Append(",");

                                // 現在の変数の値(の削った残り)を入れる。
                                sb.Append(sValue_Var);
                                sb.Append(",");
                            }
                        }
                        else// if (NamesVar.Test_String(sName_Var))
                        {

                            // FOLDER列値は無し。
                            sb.Append(",");

                            if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE))
                            {
                                // 現在の変数の値を入れる。
                                sb.Append(sValue_Var);
                                sb.Append(",");
                            }
                        }

                        sb.Append(NamesFld.S_END);
                        sb.Append(Environment.NewLine);

                        nAuto++;
                    }

                    //ファイル書出し
                    {
                        Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports);

                        string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_SAVE_FORM;

                        if (log_Reports.Successful)
                        {
                            CsvWriterImpl writer = new CsvWriterImpl();
                            writer.Write(
                                sb.ToString(),
                                sFpatha_LogVariables,
                                true
                                );
                        }
                    }
                }
            }

            //
            // メッセージボックスの表示。
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(this.GetType().Name);
                sb.Append("#Execute6_Sub:");
                sb.Append(Environment.NewLine);
                string sArgMessage;
                this.TrySelectAttribute(out sArgMessage, Expression_Node_Function46Impl.PM_MESSAGE, EnumHitcount.One_Or_Zero, log_Reports);

                sb.Append(sArgMessage);

                MessageBox.Show(sb.ToString(), "変数をCSVファイルに書き出したい。");
            }

            log_Method.EndMethod(log_Reports);
        }
Exemple #24
0
        //────────────────────────────────────────
        /// <summary>
        /// 実行します。
        /// </summary>
        /// <param name="filePathList">保存するファイルの相対パスの一覧。「起動アプリケーション・ファイル(.exe)からの相対パス」として設定してあること。</param>
        /// <param name="oDateBackupBaseDirectory"></param>
        /// <param name="d_Thread"></param>
        public void Perform(
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform",log_Reports);

            //
            //
            //
            //

            Exception err_Excp;
            string err_SFpatha_Source;
            string err_SFpatha_Dst;

            if (null == this.Expression_Filepath_Backuphome)
            {
                // エラー
                goto gt_Error_BkFolder;//todo:バックアップを無視する。
            }

            //
            // バックアップ・ディレクトリーの絶対パス
            //
            // 例:「editor-backup」
            //
            string sFpatha_BkHome = this.Expression_Filepath_Backuphome.Execute4_OnExpressionString(
                EnumHitcount.Unconstraint,
                log_Reports
                );
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            //.WriteLine(this.GetType().Name + "#Perform: バックアップディレクトリーの絶対パス=[" + backupAbsFilePath + "]" );

            // 日付フォルダー名(FOlder Name)
            string sDateFon = DatebackupImpl.CreateDateFolderName(this.Name_Sub);

            Configurationtree_Node s_ParentNode = new Configurationtree_NodeImpl("!ハードコーディング_DataBackup#Perform", null);
            // バックアップ・フォルダー下の日付ファイル名

            // 日付フォルダーパス(「…略…\20091201」など)
            string sFopatha_date;
            {
                Expression_Node_Filepath ec_Dir;
                {
                    Configurationtree_NodeFilepath cf_dir = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_3", s_ParentNode);
                    cf_dir.InitPath(sFpatha_BkHome, sDateFon,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    ec_Dir = new Expression_Node_FilepathImpl(cf_dir);
                }

                if (!log_Reports.Successful)// 異常時はスキップ
                {
                    goto gt_EndMethod;
                }

                sFopatha_date = ec_Dir.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint,
                    log_Reports
                    );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }

            // temp日付フォルダーパス(「…略…\temp20091201」など)
            string sFopatha_dateTemp;
            {
                Expression_Node_Filepath ec_Dir;
                {
                    Configurationtree_NodeFilepath s_dir = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_4", s_ParentNode);
                    s_dir.InitPath(sFpatha_BkHome, "temp" + sDateFon,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    ec_Dir = new Expression_Node_FilepathImpl(s_dir);
                }

                if (!log_Reports.Successful)// 異常時はスキップ
                {
                    goto gt_EndMethod;
                }

                sFopatha_dateTemp = ec_Dir.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint,
                    log_Reports
                );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }
            //.WriteLine(this.GetType().Name + "#Perform: absDateDirTemp=[" + absDateDirTemp + "]");

            if (!log_Reports.Successful)// 異常時はスキップ
            {
                goto gt_EndMethod;
            }

            // 今日の日付のフォルダーの有無を確認します。
            if (Directory.Exists(sFopatha_date))
            {
                // ある場合
                // バックアップは取りません。

                // 注意書きを出力してみる。
                //.WriteLine(this.GetType().Name + "#Perform: バックアップを取りません。バックアップ・フォルダーに、既に今日の日付フォルダーがあるので。[" + absDateDir + "]");

                // スキップ
                goto gt_EndMethod;
            }

            //
            // まず、今日の日付のテンポラリーファイル(「temp20091201」など)が存在すれば、削除します。
            //
            if (Directory.Exists(sFopatha_dateTemp))
            {
                // ある場合

                // 該当する「tempXXXXXXXX」フォルダーを削除します。
                // フォルダーの中身も破棄します。
                Directory.Delete(sFopatha_dateTemp, true);
            }

            //
            // 今日の日付のテンポラリー・ディレクトリーを作成します。
            //
            //
            Directory.CreateDirectory(sFopatha_dateTemp);
            // 作っておかないと、自作のクラスの中で「存在しないファイルパス・エラー」という事前チェックが誤発動してしまいます。

            // バックアップを取ります。
            foreach (Expression_Node_Filepath ec_Fpath_WrittenPlace in list_Expression_Filepath_Request)
            {
                //.WriteLine(this.GetType().Name + "#Perform: バックアップを取りたいファイルのパス sourceFilePath.HumanInputText=[" + oWrittenPlaceFilePath.HumanInputText + "]");

                // 保存先
                Expression_Node_Filepath ec_Fpath_Dst;
                {
                    Configurationtree_NodeFilepath cf_fpath_Destination = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_5", s_ParentNode);
                    cf_fpath_Destination.InitPath(
                        sFopatha_dateTemp,
                        ec_Fpath_WrittenPlace.Humaninput,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    ec_Fpath_Dst = new Expression_Node_FilepathImpl(cf_fpath_Destination);
                }

                if (!log_Reports.Successful)// 異常時はスキップ
                {
                    goto gt_EndMethod;
                }

                string sFpatha_Source = ec_Fpath_WrittenPlace.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint,
                    log_Reports
                );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                // 人間オペレーターが記述しているファイルパス。
                // 「相対パス」か「絶対パス」のどちらか。
                string sFpath_HumanInput = ec_Fpath_Dst.Humaninput;

                //
                // 絶対パスで指定されたファイルを、バックアップに保存する方法
                //
                // 例: 例えば、「C:\」を「C@\」に置換し、日付フォルダーの下に保存します。
                //
                // 注意:「C:」より長い文字列と置換すると、文字列の長さ制限に引っかかることがあります。
                //

                // 「絶対パス」か、「相対パス」かを判断します。
                bool bPathRooted = Utility_Configurationtree_Filepath.IsRooted_Path(sFpath_HumanInput,
                    log_Reports
                    );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                if (!log_Reports.Successful)// 異常時はスキップ
                {
                    goto gt_EndMethod;
                }

                // 絶対パスへの対応。
                if (bPathRooted)
                {
                    // 絶対パスであれば、「C:\」といった文字列が先頭に来ることが予想されます。
                    // 文字「:」が 2文字目 だけに存在することを想定して、
                    // 「:」を「@」に置換します。
                    //
                    // 「絶対パスのようなもの」を、バックアップ日付フォルダーの下に作る想定です。
                    // ファイル名が長くなりすぎるので、この後、ファイル名を縮める処理になることが多い。
                    //
                    //.WriteLine(this.GetType().Name + "#Perform: バックアップを取りたいファイルのパス名 humanInputFilePathStr=[" + humanInputFilePathStr + "]");
                    string sNewRelHPath3 = sFpath_HumanInput.Replace(":", "@");
                    //.WriteLine(this.GetType().Name + "#Perform: コロン記号を置換した後のファイルパス名 newRelHPathStr3=[" + newRelHPathStr3 + "]");

                    // 絶対パスでバックアップ対象ファイルが指定されていた場合

                    //
                    // 「C:\banana」は、「C@\banana」に置換
                    //

                    // 設定のし直し。
                    // 出力ファイルの絶対パスが長すぎると真。
                    bool isTooLong_Path = Utility_Configurationtree_Filepath.IsTooLong_Path(
                        sNewRelHPath3,
                        log_Reports,
                        s_ParentNode
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    if (!log_Reports.Successful)// 異常時はスキップ
                    {
                        goto gt_EndMethod;
                    }

                    if (isTooLong_Path)
                    {

                        // 強引に短縮。
                        sNewRelHPath3 = DatebackupImpl.ReplaceToJammingFilePath(
                            sNewRelHPath3,
                            this.NSubstitutionFileNumber,
                            this.GetType().Name + "#Perform:"
                            );
                        this.NSubstitutionFileNumber++;
                        //.WriteLine(this.GetType().Name + "#Perform: 短くした保存先ファイルパス名 newRelHPathStr3=[" + newRelHPathStr3 + "]");

                        // それでも、出力ファイルの絶対パスが長すぎると、後ろのプログラムで例外を投げます。
                    }

                    // (2010-02-24 ※修正)
                    // 保存先ファイルパスをセット。
                    ec_Fpath_Dst.SetHumaninput(
                        sNewRelHPath3,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }
                // 絶対パスへの対応終了

                if (!log_Reports.Successful)// 異常時はスキップ
                {
                    goto gt_EndMethod;
                }

                // もう一回、絶対パスの取得し直し
                string sFpatha_Dst = ec_Fpath_Dst.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint,
                    log_Reports
                    );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                // ファイルのコピーで作成します。
                //.WriteLine(this.GetType().Name + "#Perform: [" + sourceAbsFilePath + "]を");
                //.WriteLine(this.GetType().Name + "#Perform: [" + absDstPathStr + "]にコピーします。");
                try
                {
                    string sDestinationParent = Path.GetDirectoryName(sFpatha_Dst);
                    if (!Directory.Exists(sDestinationParent))
                    {
                        // 指定のファイルの、ディレクトリーが存在しなかった場合。

                        // ディレクトリーを作成します。
                        Directory.CreateDirectory(sDestinationParent);
                    }

                }
                catch (Exception e)
                {
                    // エラー
                    err_Excp = e;
                    goto gt_Error_MissIo;
                }

                try
                {
                    // todo: 同名のファイルがあれば、「aaa(1).txt」「aaa(2).txt」といった風に番号を付けていきたい。

                    // ファイルのコピー
                    System.IO.File.Copy(sFpatha_Source, sFpatha_Dst, false);
                }
                catch (Exception e)
                {
                    // エラー
                    err_Excp = e;
                    err_SFpatha_Source = sFpatha_Source;
                    err_SFpatha_Dst = sFpatha_Dst;
                    goto gt_Error_MissCopy;
                }
            }

            if (!log_Reports.Successful)
            {
                // 異常時はスキップ
                goto gt_EndMethod;
            }

            try
            {

                // テンポラリーフォルダーを、正規の名前にリネームします。
                Directory.Move(sFopatha_dateTemp, sFopatha_date);

            }
            catch (Exception e)
            {
                // エラー
                err_Excp = e;
                goto gt_Error_MissMove;
            }

            // 「バックアップ日付フォルダー」が11個以上あるとき、
            // 日付が新しいものを(指定)個残して 他の日付フォルダーを破棄します。

            this.DeleteOldBackup(
                sFpatha_BkHome,
                sName_Sub,
                log_Reports
                );
            // 異常時は、「temp20091202」といった、処理を中断したゴミ・ファイルが残ることがあります。

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("バックアップ・フォルダーが指定されていません。");

                // ヒント

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("エラー:");
                //
                // ヒント
                s.Append(r.Message_SException(err_Excp));
                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_MissCopy:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle( "▲エラー65506!", pg_Method);

                StringBuilder t = new StringBuilder();
                t.Append("ファイルのコピーに失敗。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append("[");
                t.Append(err_SFpatha_Source);
                t.Append("]");
                t.Append("を");
                t.Append(Environment.NewLine);

                t.Append("[");
                t.Append(err_SFpatha_Dst);
                t.Append("]");
                t.Append("へコピーしようとしたとき。");
                t.Append(Environment.NewLine);

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

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

                Log_TextIndentedImpl t = new Log_TextIndentedImpl();
                t.Append("ファイルのリネーム(Move)に失敗。");
                //
                // ヒント
                t.Append(r.Message_SException(err_Excp));
                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Exemple #25
0
        //────────────────────────────────────────
        /// <summary>
        /// 「変数設定ファイル」のテーブルを読み取り、変数を登録します。
        /// </summary>
        /// <param oVariableName="varOTable"></param>
        /// <param oVariableName="log_Reports"></param>
        public void Load(
            Table_Humaninput o_Table_Var,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "Load",log_Reports);
            //

            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole("「変数登録ファイル」を Load します。");
            }

            //
            //
            //
            //

            if (null == o_Table_Var)
            {
                goto gt_Error_NullTable;
            }

            if (null != this.parent_Variablesconfig_Configurationtree)
            {
                goto gt_Error_DoubleLoad;
            }

            string err_SFolder;
            string err_SName;
            if (log_Reports.Successful)
            {
                this.parent_Variablesconfig_Configurationtree = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_CONFIG, o_Table_Var.Expression_Filepath_ConfigStack.Cur_Configuration);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                foreach (DataRow dataRow in o_Table_Var.DataTable.Rows)
                {
                    string sStringValue;// = "";

                    // ソース情報として使うだけ。
                    Configurationtree_Node cf_VarRecord1 = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_RECORD, parent_Variablesconfig_Configurationtree);

                    // 注意: dataRow[]の連想配列は大文字・小文字を区別しないのが欠点。

                    //NAME列
                    {
                        string sFldName = NamesFld.S_NAME;//フィールド名。
                        if (o_Table_Var.ContainsField(sFldName,true,log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                dataRow[sFldName],
                                out sStringValue,
                                o_Table_Var.Name,
                                sFldName,
                                log_Method,
                                log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

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

                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sStringValue, log_Reports);
                        }
                    }

                    // FOLDER列 (オプション)
                    {
                        string sFldName = NamesFld.S_FOLDER;
                        if (o_Table_Var.ContainsField(sFldName, false, log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                dataRow[sFldName],
                                out sStringValue,
                                o_Table_Var.Name,
                                sFldName,
                                log_Method,
                                log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

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

                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列=[" + sStringValue + "]");
                            //}
                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sStringValue, log_Reports);
                        }
                        else
                        {
                            //なければ無視。
                        }
                    }

                    // VALUE列
                    {
                        string sFldName = NamesFld.S_VALUE;//フィールド名。
                        if (o_Table_Var.ContainsField(sFldName, true, log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                dataRow[sFldName],
                                out sStringValue,
                                o_Table_Var.Name,
                                sFldName,
                                log_Method,
                                log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

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

                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sStringValue, log_Reports);
                        }
                    }

                    //
                    // 変数を登録。
                    //
                    if (log_Reports.Successful)
                    {
                        //NAME列
                        string sName;
                        cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName, true, log_Reports);

                        //FOLDER列 (オプション)
                        string sFolder;
                        bool bExistsFolder = cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_FOLDER, out sFolder, false, log_Reports);

                        string sValue;
                        cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue,
                            false, //空文字列でも可。
                            log_Reports);

                        if (NamesVar.Test_Filepath(sName))
                        {
                            //ファイルパス変数の場合。
                            Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("変数[" + sName + "]", this.parent_Variablesconfig_Configurationtree);
                            cf_Fpath.InitPath(
                                sValue,
                                log_Reports
                                );
                            if ("" != sFolder)
                            {
                                //if (log_Method.CanDebug(1))
                                //{
                                //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定あり=[" + sFolder + "]");
                                //}

                                Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sFolder, null, this.parent_Variablesconfig_Configurationtree);
                                Expression_Node_Filepath ec_Fopath_Folder = this.GetExpressionfilepathByVariablename(
                                    ec_Namevar_Folder,
                                    true,
                                    log_Reports
                                    );
                                cf_Fpath.SetDirectory_Base(ec_Fopath_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                            }
                            //else
                            //{
                            //    if (log_Method.CanDebug(1))
                            //    {
                            //        log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定なし");
                            //    }
                            //}

                            Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);

                            this.PutFilepath(
                                sName,
                                ec_Fpath,
                                true,
                                log_Reports
                                );

                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス変数=[" + sName + "] 値=[" + ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                            //}
                        }
                        else
                        {
                            //ファイルパス以外の変数の場合。
                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス以外の変数=[" + sName + "]");
                            //}

                            if (bExistsFolder && "" != sFolder)
                            {
                                //ファイルパス変数以外の変数で、FOLDER列値を指定しているのはエラーです。
                                //※FOLDER列が存在する場合だけエラーチェックします。FOLDER列値がない場合は、sFolderには"null"が入っているので無視します。

                                err_SName = sName;
                                err_SFolder = sFolder;
                                goto gt_Error_InputFolder;
                            }

                            this.PutString(
                                sName,
                                sValue,
                                log_Reports
                                );
                        }

                    }

                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("[");
                s.Append(err_SName);
                s.Append("]変数に、");
                s.Append(PmNames.S_FOLDER.Name_Attribute);
                s.Append( "列値を指定しているのはエラーです。");
                s.Newline();
                s.Append( PmNames.S_FOLDER.Name_Attribute );
                s.Append("列値は、ファイルパス変数にしか書いてはいけません。");
                s.Newline();
                s.Append("ファイルパス変数は、「");
                s.Append(NamesVar.S_SP_);
                s.Append("」、「");
                s.Append(NamesVar.S_UP_);
                s.Append("」で始まる名前の変数です。");
                s.Newline();
                s.Newline();

                s.AppendI(1, PmNames.S_FOLDER.Name_Attribute);
                if (null == err_SFolder)
                {
                    s.Append("=ヌル。");
                }
                else
                {
                    s.Append("=[");
                    s.Append(err_SFolder);
                    s.Append("]");
                }
                s.Newline();
                s.Newline();

                // ヒント

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

                StringBuilder t = new StringBuilder();
                t.Append("指定されたテーブルは、ヌルでした。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

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

                StringBuilder t = new StringBuilder();
                t.Append("既に「変数設定ファイル」はロードされているのに、");
                t.Append(Environment.NewLine);
                t.Append("また 「変数設定ファイル」をロードしようとしました。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 項目の文字列。
        /// </summary>
        /// <param name="e"></param>
        /// <param name="cctLst"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public override string P1_GetItemString(
            int nCurIx,//DrawItemEventArgs e,//e.Index
            CustomcontrolListbox cctLst,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "P1_GetItemLabel",log_Reports);
            //
            //

            string sDisplayText;

            // ↓2012-01-20 追加
            if (nCurIx < cctLst.List_SText_Display.Count)
            {
                sDisplayText = cctLst.List_SText_Display[nCurIx];
                if (null != sDisplayText)
                {
                    goto gt_EndMethod;
                }
            }

            //
            // 項目の数だけ呼び出される。
            // 処理はできるだけ軽く。

            if (null == this.Expression_ItemLabel)
            {
                sDisplayText = "(" + Info_MiddleImpl.Name_Library + "#P1_GetItemString:リストボックスに<a-item-label>が指定されていません)";
                goto gt_EndMethod;
            }

            //
            // dataRowViewが入っている。
            DataRowView dataRowView = (DataRowView)cctLst.Items[nCurIx];
            //
            //
            // ID値を取得し、キー値とする。
            int nKey;
            Int_HumaninputImpl.TryParse(// ※仮。
                dataRowView.Row["ID"],
                out nKey,
                EnumOperationIfErrorvalue.Error,
                -1,
                log_Reports
                );
            if (!log_Reports.Successful)
            {
                // エラー
                sDisplayText = "(エラー発生中)";
                goto gt_EndMethod;
            }

            if (log_Reports.Successful)
            {
                string sKey = nKey.ToString(); // ※仮。

                //
                // value-variable-name="" 属性
                if (null == this.Expression_ValueVariableName)
                {
                    //
                    // エラー。
                    sDisplayText = "(変数名取得失敗)";
                    goto gt_Error_NullValueVariableName;
                }
                else
                {
                    //
                    // 変数名取得。

                    StringBuilder sbHint = new StringBuilder();
                    sbHint.Append(Info_MiddleImpl.Name_Library);
                    sbHint.Append(":");
                    sbHint.Append(this.GetType().Name);
                    Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl(sbHint.ToString(), null);

                    string sVariableName = this.Expression_ValueVariableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                    XenonNameImpl o_Name_Variable = new XenonNameImpl(sVariableName, parent_Configurationtree_Node);

                    //ystem.Console.WriteLine(this.GetType().Name + "#P1_GetItemLabel: sVariableName=[" + sVariableName + "] sValue=[" + sValue + "]");

                    //
                    // ループカウンター変数に、キー値を上書き。
                    this.Owner_MemoryApplication.MemoryVariables.SetStringValue(
                        o_Name_Variable,
                        sKey,
                        true,
                        log_Reports
                        );
                }

                //
                // 表示文字列。
                sDisplayText = this.Expression_ItemLabel.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
            }
            else
            {
                sDisplayText = "(エラー発生中)";
                goto gt_EndMethod;
            }

            if (!log_Reports.Successful)
            {
                sDisplayText = "(エラー発生中)";
                goto gt_EndMethod;
            }

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

                StringBuilder t = new StringBuilder();
                t.Append("<view>の<f-listbox-for-items>に、");
                t.Append(Environment.NewLine);
                t.Append("value-variable-name=””属性がありませんでした。");

                t.Append(Environment.NewLine);
                t.Append("コントロール名=[");
                t.Append(cctLst.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                t.Append("]");

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

            // ↓2012-01-20 追加
            while (cctLst.List_SText_Display.Count <= nCurIx)
            {
                cctLst.List_SText_Display.Add(null);
            }
            cctLst.List_SText_Display[nCurIx] = sDisplayText;

            log_Method.EndMethod(log_Reports);
            return sDisplayText;
        }
Exemple #27
0
        //────────────────────────────────────────
        /// <summary>
        /// このアプリケーションが担当する「バックアップ日付フォルダー」が
        /// (指定)個以上あるとき、
        /// 日付が新しいものを(指定)個残して
        /// このアプリケーションが担当する他の「バックアップ日付フォルダー」を破棄します。
        /// </summary>
        private void DeleteOldBackup(
            string sFilepathabsolute_Backuphome,
            string sName_Sub,
            Log_Reports log_Reports
            )
        {
            // バックアップ・フォルダー直下のフォルダーの絶対パス
            string[] sFpatha_FolderArray = Directory.GetDirectories(sFilepathabsolute_Backuphome);

            // 日付フォルダーの名前のリストを作成します。
            List<string> sList_Name_MyDateFolder = new List<string>();
            foreach (string sFpatha_Folder in sFpatha_FolderArray)
            {
                // 区切り文字の次。
                char[] separatorChars = new char[] { '\\', '/' };
                int nFolderNameIndex = sFpatha_Folder.LastIndexOfAny(separatorChars) + 1;

                // 絶対パスから、最下層の「フォルダー名」だけを切り抜き。
                string sFolderName = sFpatha_Folder.Substring(nFolderNameIndex, sFpatha_Folder.Length - nFolderNameIndex);
                //allFolderNames.Add(folderName);

                try
                {

                    // 次の2つは、担当する日付フォルダーとして扱います。
                    // ・ファイル名が8桁の数字
                    // ・ファイル名の先頭8桁が数字で、アンダースコアが続く。
                    // ・フォルダー・オーナー名が、このアプリケーションのものと一致する。
                    int nDammyDateNumber = 0;
                    string sFolderOwnerName = "";
                    bool bDateFolder = DatebackupImpl.IsDateFolderName(
                        sFolderName, ref nDammyDateNumber, ref sFolderOwnerName);

                    // フォルダー名の書式と、オーナー判定
                    if (bDateFolder && sFolderOwnerName == sName_Sub)
                    {
                        sList_Name_MyDateFolder.Add(sFolderName);
                    }

                }
                catch (Exception)
                {
                    // 無視して続行
                }
            }

            // 日付フォルダー名の日付の逆順(数字の降順)にソート。同値は順が不安定。
            sList_Name_MyDateFolder.Sort(
                delegate(string sName_Folder1, string sName_Folder2)
                {

                    int nDateNumber1 = 0;
                    int nDateNumber2 = 0;
                    string sDammyFolderOwnerName = "";

                    // 日付フォルダーでない場合は、dateNumberN に-1が入ります。
                    bool bDate1 = DatebackupImpl.IsDateFolderName(sName_Folder1, ref nDateNumber1, ref sDammyFolderOwnerName);
                    bool bDate2 = DatebackupImpl.IsDateFolderName(sName_Folder2, ref nDateNumber2, ref sDammyFolderOwnerName);

                    return nDateNumber2 - nDateNumber1;
                }
            );

            // 日付の数字が大きい先頭から(指定数)件以外を、
            // 削除するフォルダー名のリストに追加します。
            List<string> sList_Name_DeleteeFolder = new List<string>();
            int nCount = 0;
            foreach (string sName_DateFolder in sList_Name_MyDateFolder)
            {
                if (nCount < this.Keptbackups)
                {
                    // (指定)件の間は無視。
                }
                else
                {
                    // (指定)件を超過した分は、削除リストに追加。

                    sList_Name_DeleteeFolder.Add(sName_DateFolder.ToString());
                }

                nCount++;
            }
            sList_Name_MyDateFolder = null;//使用終了

            foreach (string sName_DeleteeFolder in sList_Name_DeleteeFolder)
            {
                // 指定のフォルダーを削除

                // 絶対パスの作成

                Expression_Node_Filepath ec_Fpath;
                {
                    Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_DataBackup#DeleteOldBackup", null);
                    Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_6", parent_Configurationtree_Node);
                    cf_Fpath.InitPath(
                        sFilepathabsolute_Backuphome,
                        sName_DeleteeFolder,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                }

                string sFopath_Deletee;
                if (log_Reports.Successful)
                {
                    // 正常時
                    sFopath_Deletee = ec_Fpath.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sFopath_Deletee = "";
                }

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

                    Directory.Delete(sFopath_Deletee, true);
                }

            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            return;
        }
        //────────────────────────────────────────
        /// <summary>
        /// 例えば、次の2つの物を与えると、
        /// ●ID=10、EXPL=赤、と入っている行。
        /// ●「%1%:%2%|ID|EXPL」という文字列。
        /// 
        /// すると、次の文字列が返ってくる。
        /// ●「10:EXPL」
        /// 
        /// %1%はID、%2%はEXPLに当たる。
        /// </summary>
        /// <param name="sFormat"></param>
        /// <param name="dataRowView"></param>
        /// <param name="xenonTable"></param>
        /// <param name="sErrorMsg"></param>
        /// <returns></returns>
        public string Perform(
            string sFormat,
            DataRowView dataRowView,
            Table_Humaninput xenonTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, this, "Perform",log_Reports);

            string result;

            if ( null==xenonTable)
            {
                // エラー
                // テーブルが未指定の場合

                goto gt_Error_NullTable;
            }

            CsvTo_DataTableImpl reader = new CsvTo_DataTableImpl();
            reader.CharSeparator = '|';
            DataTable scriptParameters = reader.Read(
                sFormat
                );

            if (scriptParameters.Rows.Count<1)
            {
                // 警告
                // 項目の表示書式が指定されていない場合
                //
                result = "(【Er:301;】表示書式未指定、レイアウト設定で)";

                // エラーにはしない。
                if (log_Method.CanWarning())
                {
                    log_Method.WriteWarning_ToConsole("(【Er:301;】表示書式未指定、レイアウト設定で)");
                }

                goto gt_EndMethod;
            }

            DataRow dataRow = scriptParameters.Rows[0];

            object[] recordFields = dataRow.ItemArray;// ItemArrayは1回の呼び出しが重い。

            Builder_TexttemplateP1pImpl formatString = new Builder_TexttemplateP1pImpl();
            formatString.Text = recordFields[0].ToString();//例:"%1%:%2%"
            //.Console.WriteLine(this.GetType().Name + "#CreateText: recordFields[0].ToString()=[" + recordFields[0].ToString() + "]");

            FieldToParameters fieldToParameters = new FieldToParameters();
            Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_RecordFormatStringImpl#CreateText",null);
            // フィールド名のリストが続く。
            for (int nIndex = 1; nIndex < recordFields.Length; nIndex++)
            {
                //.Console.WriteLine(this.GetType().Name + "#CreateText: index=[" + index + "] recordFields[index].ToString()=[" + recordFields[index].ToString() + "]");

                string sFieldName = recordFields[nIndex].ToString();
                fieldToParameters.AddField(
                    sFieldName,
                    xenonTable,
                    log_Reports
                    );

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

            fieldToParameters.Perform(ref formatString, dataRowView, xenonTable, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                result = "(エラー)";
                goto gt_EndMethod;
            }

            result = formatString.Perform(log_Reports);

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullTable:
            result = "(テーブルが未指定です)";
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー131!", log_Method);
                r.Message = "(エラー。テーブルが未指定です)";
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result;
        }
Exemple #29
0
        //────────────────────────────────────────
        /// <summary>
        /// エディター設定ファイルの絶対パス
        /// </summary>
        /// <returns></returns>
        private string GetFilepathabsolute_Editor(
            MemoryAatoolxml_Editor moAatoolxml_SelectedEditorElm,
            Log_Reports pg_Logging
            )
        {
            string sFpath_EditorXml = "";

            moAatoolxml_SelectedEditorElm.Dictionary_Fsetvar_Configurationtree.List_Child.ForEach(delegate(Configurationtree_Node s_Fsetvar, ref bool bBreak)
            {
                string sNamevar1;
                s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_NAME_VAR, out sNamevar1, true, pg_Logging);

                if (sNamevar1 == NamesVar.S_SP_EDITOR)
                {
                    string sValue;
                    s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, pg_Logging);

                    sFpath_EditorXml = sValue + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML;
                }

            });

            // エディター設定ファイル パスの有効/無効を調べます。
            string sFpatha;
            Expression_Node_Filepath e_Fpath_prj;
            {
                Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_" + this.GetType().Name + "#GetProjectAbsFilePath", null);

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

                e_Fpath_prj = new Expression_Node_FilepathImpl(cf_Fpath);
            }

            sFpatha = e_Fpath_prj.Execute4_OnExpressionString(
                EnumHitcount.Unconstraint, pg_Logging);
            if (!pg_Logging.Successful)
            {
                // 既エラー。
                sFpatha = "";
                goto gt_EndMethod;
            }

            //.WriteLine(this.GetType().Name + "#GetProjectAbsFilePath: absFilePath=[" + absFilePath + "]");

            //
            //
            //
            //
            gt_EndMethod:
            return sFpatha;
        }
        public MemoryGloballistconfig Perform(
            string sFpath_Glcnf,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0);
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform",log_Reports);

            // グローバルリスト・コンフィグ設定ファイルの内容。
            MemoryGloballistconfig moGlcnf = new MemoryGloballistconfigImpl();

            Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("グローバルリスト設定",null);

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

            Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
            string sFpatha_Xml = ec_Fpath.Execute4_OnExpressionString(
                EnumHitcount.Unconstraint, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

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

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

                try
                {
                    // ファイルの読込み
                    doc.Load(sFpatha_Xml);
                }
                catch (System.ArgumentException ex)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー0800206!", pg_Method);

                        StringBuilder t = new StringBuilder();
                        t.Append("『SRSグローバルリスト』設定ファイルを読込もうとしたら、エラーが発生しました。");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("ファイル=[");
                        t.Append(sFpath_Glcnf);
                        t.Append("]");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("もしかすると:");
                        t.Append(Environment.NewLine);
                        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();
                    }
                }
                catch (System.Exception ex)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー0800205!", pg_Method);

                        StringBuilder t = new StringBuilder();
                        t.Append("『SRSグローバルリスト』設定ファイルの読込中にエラーが発生しました。");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("ファイル=[");
                        t.Append(sFpath_Glcnf);
                        t.Append("]");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("もしかすると:");
                        t.Append(Environment.NewLine);
                        t.Append(" ・読込む設定ファイルを間違えている? それは『SRSグローバルリスト 設定ファイル』で合っていますか?");
                        t.Append(Environment.NewLine);
                        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();
                    }
                }
            }

            if (log_Reports.Successful)
            {
                // 正常時
                try
                {
                    // ルート要素を取得
                    System.Xml.XmlElement root = doc.DocumentElement;

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

                    for (int nTypeIndex = 0; nTypeIndex < typeNL.Count; nTypeIndex++)
                    {
                        XmlNode x_TypeNode = typeNL.Item(nTypeIndex);

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

                            if (XmlNodeType.Element == x_TypeNode.NodeType)
                            {
                                //
                                // type要素
                                //
                                XmlElement x_TypeElm = (XmlElement)x_TypeNode;

                                string sType = x_TypeElm.Attributes.GetNamedItem(SrsAttrName.S_NAME).Value;

                                GloballistconfigTypesectionImpl typeSection = new GloballistconfigTypesectionImpl();
                                typeSection.Name_Type = sType;

                                moGlcnf.TypesectionList.List_Item.Add(typeSection);
                            }
                        }
                    }

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

                    for (int nHumanIndex = 0; nHumanIndex < x_HumanNL.Count; nHumanIndex++)
                    {
                        XmlNode x_HumanNode = x_HumanNL.Item(nHumanIndex);

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

                            if (XmlNodeType.Element == x_HumanNode.NodeType)
                            {
                                //
                                // human要素
                                //
                                XmlElement x_HumanElm = (XmlElement)x_HumanNode;

                                GloballistconfigHuman human = new GloballistconfigHumanImpl();
                                human.Name = x_HumanElm.Attributes.GetNamedItem(SrsAttrName.S_NAME).Value;

                                moGlcnf.Dictionary_Human.Add(human.Name, human);

                                // variable要素を列挙
                                System.Xml.XmlNodeList x_VariableNL = x_HumanElm.GetElementsByTagName("variable");

                                for (int n_VariableIndex = 0; n_VariableIndex < x_VariableNL.Count; n_VariableIndex++)
                                {
                                    XmlNode x_VariableNode = x_VariableNL.Item(n_VariableIndex);

                                    if (XmlNodeType.Element == x_VariableNode.NodeType)
                                    {
                                        //
                                        // variable要素
                                        //
                                        XmlElement x_VariableElm = (XmlElement)x_VariableNode;

                                        GloballistconfigVariable variable = new GloballistconfigVariableImpl();
                                        variable.Name_Type = x_VariableElm.Attributes.GetNamedItem("type").Value;

                                        // 変数の連想配列に、項目を追加
                                        if (human.Dictionary_Variable.ContainsKey(variable.Name_Type))
                                        {
                                            // エラー
                                            if (log_Reports.CanCreateReport)
                                            {
                                                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                                                r.SetTitle("▲エラー1002!", pg_Method);
                                                r.Message = "指定された変数の型["+variable.Name_Type+"]が、重複されて記述されています。";
                                                log_Reports.EndCreateReport();
                                            }
                                        }
                                        else
                                        {
                                            human.Dictionary_Variable.Add(variable.Name_Type, variable);

                                            // number要素を列挙
                                            System.Xml.XmlNodeList numberNL = x_VariableElm.GetElementsByTagName("number");

                                            for (int numberIndex = 0; numberIndex < numberNL.Count; numberIndex++)
                                            {
                                                XmlNode numberNode = numberNL.Item(numberIndex);

                                                if (XmlNodeType.Element == numberNode.NodeType)
                                                {
                                                    //
                                                    // number要素
                                                    //
                                                    XmlElement numberElm = (XmlElement)numberNode;

                                                    GloballistconfigNumber numberObj = new GloballistconfigNumberImpl();
                                                    numberObj.Text_Range = numberElm.Attributes.GetNamedItem("range").Value;

                                                    Int_HumaninputImpl oPriority = new Int_HumaninputImpl("!ハードコーディング_LoaderOfGlobalListConfigXml");
                                                    oPriority.Text = numberElm.Attributes.GetNamedItem("priority").Value;
                                                    numberObj.Priority = oPriority;

                                                    // 変数の連想配列に、変数番号オブジェクトを追加
                                                    variable.Dictionary_Number.Add(numberObj.Text_Range, numberObj);
                                                }
                                            }
                                        }

                                    }
                                }

                            }
                        }
                    }

                }
                catch (System.IO.IOException ex)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー080103!", pg_Method);
                        r.Message = "『SRSグローバルリスト』設定ファイルが見つかりません。:" + ex.Message;
                        log_Reports.EndCreateReport();
                    }
                }
                catch (System.Exception ex)
                {
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー0800204!", pg_Method);

                        StringBuilder t = new StringBuilder();
                        t.Append("『SRSグローバルリスト』設定ファイルの読込中にエラーが発生しました。");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("ファイル=[");
                        t.Append(sFpath_Glcnf);
                        t.Append("]");
                        t.Append(Environment.NewLine);
                        t.Append(Environment.NewLine);
                        t.Append("もしかすると:");
                        t.Append(Environment.NewLine);
                        t.Append(" ・読込む設定ファイルを間違えている? それは『SRSグローバルリスト 設定ファイル』で合っていますか?");
                        t.Append(Environment.NewLine);
                        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();
                    }
                }
            }

            //
            //
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return moGlcnf;
        }
Exemple #31
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);
        }
Exemple #32
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);
        }