Ejemplo n.º 1
0
        public void End(Log_Reports log_reports)
        {
            if (this.IsRunning)
            {
                Log_Method log_Method = new Log_MethodImpl(0);
                log_Method.BeginMethod(Info_Syntax.Name_Library, this, "End", log_reports);

                this.MilliSeconds_End = stopwatch.ElapsedMilliseconds;


                StringBuilder sb = new StringBuilder();

                sb.Append(Info_Syntax.Name_Library);
                sb.Append(":");
                sb.Append(this.GetType().Name);
                sb.Append("#End: 計測 ");
                sb.Append(this.ToString());
                sb.Append(Environment.NewLine);

                log_Method.WriteInfo_ToConsole(sb.ToString());
                log_Method.EndMethod(log_reports);
            }
        }
Ejemplo n.º 2
0
        //────────────────────────────────────────
        /// <summary>
        /// 妥当性判定のグローバル設定ファイルの読取り。
        /// </summary>
        /// <param name="sFpatha">絶対ファイルパス</param>
        /// <param name="log_Reports"></param>
        public void LoadFile(
            string sFpatha,
            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);
            //
            //

            this.xToConfigurationtree_V.XmlToConfigurationtree(
                sFpatha,
                owner_MemoryApplication,
                log_Reports
                );

            Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl();
            pg_ParsingLog.BEnabled = false;
            this.givechapterandverseToExpression_V.Translate(
                owner_MemoryApplication,
                pg_ParsingLog,
                log_Reports
                );
            if (log_Method.CanInfo() && pg_ParsingLog.BEnabled)
            {
                log_Method.WriteInfo_ToConsole(" d_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString());
            }

            //
            //
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 3
0
        //────────────────────────────────────────
        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);
        }
Ejemplo n.º 4
0
        //────────────────────────────────────────
        /// <summary>
        /// ファイルパス型変数を登録します。
        /// 
        /// todo:文字列、ファイルパスの区別なく登録したい。
        /// </summary>
        /// <param name="sVariableName"></param>
        /// <param name="e_InitialValue"></param>
        /// <param name="bDuplicatedIsError">既に追加されているものを、更に追加しようとしたときにエラーにするなら真。</param>
        /// <param name="log_Reports"></param>
        public void PutFilepath(
            string sName_Variable,
            Expression_Node_Filepath ec_InitialValue,
            bool bDuplicatedIsError,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "PutFilepath",log_Reports);
            //
            //

            if (this.dictionaryExpression_Item.ContainsKey(sName_Variable))
            {
                if (bDuplicatedIsError)
                {
                    goto gt_Error_Duplicated;
                }
                else
                {
                    // 上書き
                    string sOldValue = "";
                    if (log_Method.CanInfo())
                    {
                        sOldValue = this.dictionaryExpression_Item[sName_Variable].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                    }

                    this.dictionaryExpression_Item[sName_Variable] = ec_InitialValue;

                    if (log_Method.CanInfo())
                    {
                        log_Method.WriteInfo_ToConsole("変数[" + sName_Variable + "]は既に[" + sOldValue + "]と定義されていましたが、[" + ec_InitialValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]で上書きしました。");
                    }
                }
            }
            else
            {
                this.dictionaryExpression_Item.Add(sName_Variable, ec_InitialValue);
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_Duplicated:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー922!", log_Method);
                r.Message = "変数[" + sName_Variable + "]は既に定義されていますが、さらに定義されました。";
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 5
0
        //────────────────────────────────────────
        /// <summary>
        /// デバッグ出力。
        /// </summary>
        public void WriteDebug_ToConsole()
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            Log_Reports d_Logging_Dammy = new Log_ReportsImpl(log_Method);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "WriteDebug_ToConsole",d_Logging_Dammy);
            //
            //

            if (log_Method.CanInfo())
            {
                log_Method.WriteInfo_ToConsole("要素数=[" + this.dictionaryExpression_Item.Count + "]");

                // 項目(キーと値)の列挙
                foreach (KeyValuePair<string, Expression_Node_String> kvp in this.dictionaryExpression_Item)
                {
                    if (null == kvp.Value)
                    {
                        log_Method.WriteInfo_ToConsole(" [" + kvp.Key + "]=空っぽ");
                    }
                    else
                    {
                        if (kvp.Value is Expression_Node_Filepath)
                        {
                            // ファイルパス型。
                            // bug: 絶対パスでない場合、空白になるので、SHumanInput で取得することになるはず。
                            log_Method.WriteInfo_ToConsole(" [" + kvp.Key + "]=P型[" + kvp.Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, d_Logging_Dammy) + "] / SHumanInput=[" + ((Expression_Node_Filepath)kvp.Value).Humaninput + "]");
                        }
                        else
                        {
                            log_Method.WriteInfo_ToConsole(" [" + kvp.Key + "]=[" + kvp.Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, d_Logging_Dammy) + "]");
                        }
                    }

                }
            }

            //
            //
            log_Method.EndMethod(d_Logging_Dammy);
            d_Logging_Dammy.EndLogging(log_Method);
            if (!d_Logging_Dammy.Successful)
            {
                log_Method.WriteDebug_ToConsole(d_Logging_Dammy.ToText());
            }
        }
        //────────────────────────────────────────
        /// <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 "";
        }
Ejemplo n.º 7
0
        public void End(Log_Reports log_reports)
        {
            if (this.IsRunning)
            {
                Log_Method log_Method = new Log_MethodImpl(0);
                log_Method.BeginMethod(Info_Syntax.Name_Library, this, "End", log_reports);

                this.MilliSeconds_End = stopwatch.ElapsedMilliseconds;

                StringBuilder sb = new StringBuilder();

                sb.Append(Info_Syntax.Name_Library);
                sb.Append(":");
                sb.Append(this.GetType().Name);
                sb.Append("#End: 計測 ");
                sb.Append(this.ToString());
                sb.Append(Environment.NewLine);

                log_Method.WriteInfo_ToConsole(sb.ToString());
                log_Method.EndMethod(log_reports);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 『レイアウト設定ファイル』をもとに、コントロールを作成し、
        /// フォームと、アプリケーション・モデルにコントロールを動的に追加します。
        /// </summary>
        /// <param name="fo_Config"></param>
        /// <param name="form"></param>
        protected void CreateForm(
            TableUserformconfig fo_Config,
            Form form,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "CreateForm",log_Reports);
            //
            //

            //this.form_noren = form;

            // レイアウトするロジックを一時停止。(メインフォーム)
            form.SuspendLayout();

            // フォームにステータスバーを付けます。(デバッグモードでのみ) TODO:1回限りであること。
            if (null == statusStrip1 && Log_ReportsImpl.BDebugmode_Static)
            {
                statusStrip1 = new System.Windows.Forms.StatusStrip();

                //
                // statusStrip1
                //
                statusStrip1.Location = new System.Drawing.Point(0, 244);
                statusStrip1.Name = "statusStrip1";
                statusStrip1.Size = new System.Drawing.Size(292, 22);
                statusStrip1.TabIndex = 0;
                statusStrip1.Text = "statusStrip1";

                this.statusStripLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
                this.statusStripLabel2.Name = "toolStripStatusLabel1";
                this.statusStripLabel2.Size = new System.Drawing.Size(114, 17);
                this.statusStripLabel2.Text = "toolStripStatusLabel1";
                this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.statusStripLabel2});

                form.Controls.Add(statusStrip1);

                // #情報
                if (log_Method.CanInfo())
                {
                    log_Method.WriteInfo_ToConsole("ステータスバーをフォームに追加した。(デバッグモードでのみ)TODO:1回限りであること。");
                }
            }

            //// フォームに「マルチロール_テキストボックス」を付けます。 TODO:1回限りであること。
            //if (null == this.multiroleTextBox)
            //{
            //    this.multiroleTextBox = new System.Windows.Forms.TextBox();
            //    this.multiroleTextBox.Multiline = true;
            //    form.Controls.Add(this.multiroleTextBox);

            //    // #デバッグ
            //    ystem.Console.WriteLine(Info_NorenImpl.LibraryName + ":MoNorenImpl#CreateForm:マルチロール_テキストボックスをフォームに追加した。TODO:1回限りであること。");
            //}

            // 1つ前のコントロールが入っている仕組み。
            List<Usercontrol> list_StackFc = new List<Usercontrol>();
            List<int> nList_StackTree = new List<int>();

            //
            // レコードの並び順は、記述されている順番とします。
            //
            foreach (RecordUserformconfig fo_Record in fo_Config.List_RecordUserformconfig)
            {
                int nCurTree;
                fo_Record.TryGetInt(out nCurTree, NamesFld.S_TREE, true, -1, this.Owner_MemoryApplication, log_Reports);

                //
                //
                // ここで、コントロール(UserControl)を作成。
                // 作成できなかった、または作成しなかった場合はヌル。
                //
                //
                Usercontrol uct = ucontrolCreator1.Create(
                    fo_Record,
                    true,
                    this.Owner_MemoryApplication,
                    log_Reports
                    );

                //.WriteLine(this.GetType().Name + "#CreateForm: (10) この要素=[" + fcUc.ControlCommon.Name + "] curTree=[" + curTree + "]");

                if (log_Reports.Successful)
                {
                    if (null != uct)
                    {
                        string sName_Control;
                        fo_Record.TryGetString(out sName_Control, NamesFld.S_NAME, true, "", this.Owner_MemoryApplication, log_Reports);

                        Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(null, fo_Record.Parent_TableUserformconfig.Cur_Configurationtree);
                        ec_Str.AppendTextNode(
                            sName_Control,
                            fo_Record.Parent_TableUserformconfig.Cur_Configurationtree,
                            log_Reports
                            );

                        //
                        //
                        // コントロール名の登録。
                        //
                        //
                        this.Owner_MemoryApplication.MemoryForms.PutUsercontrol(
                            ec_Str,
                            uct,
                            log_Reports
                            );

                        if (uct is UsercontrolWindow)
                        {
                            //
                            // 「ウィンドウ」(別窓)を開けたい場合。
                            //
                            UsercontrolWindow uctWnd = (UsercontrolWindow)uct;

                            //ucWindow.SetupStatusStrip();
                            uctWnd.CustomcontrolWindow1.Show();

                            //.WriteLine(this.GetType().Name + "#CreateForm: (20) 【ウィンドウ追加】トップに、この要素=[" + fcUc.ControlCommon.Name + "]を追加。");
                        }
                        else
                        {

                            if (0 == nList_StackTree.Count)
                            {
                                //
                                // ★追加:   メインフォームのトップに、この要素を追加
                                //
                                form.Controls.Add((Control)uct);

                                // 普通、メインウィンドウもここになる。
                            }
                            else
                            {
                                int nPrevTree = nList_StackTree.Last();

                                if (nPrevTree == nCurTree)
                                {
                                    // 1つ前の要素と ツリー値が同じなら、

                                    // 1つ前の要素をスタックから削除し、
                                    list_StackFc.RemoveAt(list_StackFc.Count - 1);
                                    nList_StackTree.RemoveAt(nList_StackTree.Count - 1);

                                    if (0 != nList_StackTree.Count)
                                    {
                                        nPrevTree = nList_StackTree.Last();

                                        //
                                        // ★追加:   前の要素(スタックの最後の要素)に、この要素を追加。
                                        //
                                        Usercontrol prevUc = list_StackFc.Last();

                                        prevUc.AppendChild(
                                            uct,
                                            log_Reports
                                            );

                                        //.WriteLine(this.GetType().Name + "#CreateForm: (40) 【前の要素に、この要素を追加】 前の要素=[" + prevUc.ControlCommon.Name + "]に、この要素=[" + fcUc.ControlCommon.Name + "]を追加。");
                                    }
                                    else
                                    {
                                        nPrevTree = 0;

                                        //
                                        // ★追加:   メインフォームのトップに、この要素を追加
                                        //
                                        form.Controls.Add((Control)uct);

                                        //.WriteLine(this.GetType().Name + "#CreateForm: (50) 【メインフォームのトップ要素として追加2】 メインフォームのトップに、この要素=[" + fcUc.ControlCommon.Name + "]を追加。");
                                    }
                                }
                                else if (nPrevTree < nCurTree)
                                {
                                    // 1つ前の要素より、大きなtree値を持つなら、

                                    //
                                    // ★追加: 1つ前の要素に、この要素を追加。
                                    //
                                    Usercontrol prevUc = list_StackFc.Last();

                                    prevUc.AppendChild(
                                        uct,
                                        log_Reports
                                        );

                                    //.WriteLine(this.GetType().Name + "#CreateForm: (60) 【前の要素に、この要素を追加】 前の要素=[" + prevUc.ControlCommon.Name + "]に、この要素=[" + fcUc.ControlCommon.Name + "]を追加。");
                                }
                                else
                                {
                                    // 1つ前の要素より、小さなtree値を持つなら、

                                    //
                                    // ★削除:
                                    //   自分より小さなtree値を持つ要素が出てくるまで、
                                    //   前の要素を消す。
                                    //
                                    list_StackFc.RemoveAt(list_StackFc.Count - 1);
                                    nList_StackTree.RemoveAt(nList_StackTree.Count - 1);
                                    //.WriteLine(this.GetType().Name + "#CreateForm: (70) 【前要素削除】 この要素=[" + fcUc.ControlCommon.Name + "]");

                                    //
                                    // foreachループの中で、リストの要素数が変わると、
                                    // foreachループは失敗する。
                                    //
                                    // whileループを使うことにする。
                                    //
                                    while (0 < nList_StackTree.Count)
                                    {
                                        Usercontrol prevUc = list_StackFc.Last();
                                        nPrevTree = nList_StackTree.Last();

                                        if (nCurTree <= nPrevTree)
                                        {
                                            list_StackFc.RemoveAt(list_StackFc.Count - 1);
                                            nList_StackTree.RemoveAt(nList_StackTree.Count - 1);
                                            //.WriteLine(this.GetType().Name + "#CreateForm: (80) 【前要素削除】 この要素=[" + fcUc.ControlCommon.Name + "] 前の要素=[" + prevUc.ControlCommon.Name + "]");
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    }

                                    if (0 == nList_StackTree.Count)
                                    {
                                        // 空っぽになったらループを止める。
                                        // エラー?
                                        nPrevTree = -1;
                                    }
                                    else
                                    {
                                        nPrevTree = nList_StackTree.Last();
                                    }

                                    if (0 == nList_StackTree.Count)
                                    {
                                        //
                                        // ★追加:   メインフォームのトップに、この要素を追加
                                        //
                                        form.Controls.Add((Control)uct);

                                        //.WriteLine(this.GetType().Name + "#CreateForm: (90) 【メインフォームのトップ要素として追加3】 メインフォームのトップに、この要素=[" + fcUc.ControlCommon.Name + "]を追加。");
                                    }
                                    else
                                    {
                                        //
                                        // ★追加: 1つ前の要素に、この要素を追加。
                                        //
                                        Usercontrol prevUc = list_StackFc.Last();

                                        prevUc.AppendChild(
                                            uct,
                                            log_Reports
                                            );

                                        //.WriteLine(this.GetType().Name + "#CreateForm: (100) 【前の要素に、この要素を追加】 前の要素=[" + prevUc.ControlCommon.Name + "]に、この要素=[" + fcUc.ControlCommon.Name + "]を追加。");
                                    }

                                }
                            }
                        }

                    }
                }

                list_StackFc.Add(uct);
                nList_StackTree.Add(nCurTree);
            }

            // レイアウトの一時停止を解除。レイアウト実行の強制はしない。(メインフォーム)
            form.ResumeLayout(false);

            //
            //
            //
            //
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 9
0
        //────────────────────────────────────────
        /// <summary>
        /// 『コントロール設定ファイル(Fcnf)』を読み取ります。
        /// 
        /// X→S、S→E、X→A。
        /// </summary>
        public void XToEc_Usercontrolconfig(
            Configurationtree_Node cf_FcConfig,
            RecordUserformconfig fo_Record,
            Expression_Node_Filepath ec_Fopath_Forms,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "XToEc_Usercontrolcnf",log_Reports);

            //
            //

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

            //
            // コントロール名。
            string sName_Control;
            fo_Record.TryGetString(out sName_Control, NamesFld.S_NAME, true, "", this.Owner_MemoryApplication, log_Reports);

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

                Expression_Node_FilepathImpl e_Fpath = new Expression_Node_FilepathImpl(cf_Fpath_Control);

                sFpatha_f = to.GetSFilepath_UsercontrolconfigAbsolute(
                    e_Fpath,//sl_record.Cf_File,
                    ec_Fopath_Forms,
                    log_Reports
                    );
            }

            //
            // X → S (データソース、データターゲットの変換)
            // S → E
            //
            if (log_Reports.Successful)
            {
                Utility_XmlToConfigurationtree_Usercontrolconfig to1 = new Utility_XmlToConfigurationtree_Usercontrolconfig();

                List<string> sList_ControlName = to1.GetList_NameControl(
                    sName_Control,
                    sFpath_f,
                    sFpatha_f,
                    cf_FcConfig,
                    ec_Fopath_Forms,
                    this.Owner_MemoryApplication,
                    log_Reports
                    );

                Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl();
                pg_ParsingLog.BEnabled = false;
                ConfigurationtreeToExpression_F10_ControlList to2 = new ConfigurationtreeToExpression_F10_ControlListImpl();
                to2.Translate(
                    sList_ControlName,
                    cf_FcConfig,
                    this.Owner_MemoryApplication,
                    pg_ParsingLog,
                    log_Reports
                    );
                if (Log_ReportsImpl.BDebugmode_Static && pg_ParsingLog.BEnabled)
                {
                    log_Method.WriteInfo_ToConsole(" parsingLog=" + pg_ParsingLog.ToString());
                }
            }

            //
            // X → A (イベント_アクション_リストを構築します)
            //
            if (log_Reports.Successful)
            {
                //
                // (1)コントロールの名前を指定。
                //
                List<Usercontrol> list_Usercontrol;
                {
                    Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(null, fo_Record.Parent_TableUserformconfig.Cur_Configurationtree);
                    ec_Str.AppendTextNode(
                        sName_Control,
                        fo_Record.Parent_TableUserformconfig.Cur_Configurationtree,
                        log_Reports
                        );

                    list_Usercontrol = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName(
                        ec_Str,
                        true,
                        log_Reports
                        );
                }

                if (0 < list_Usercontrol.Count)
                {
                    Usercontrol uct = list_Usercontrol[0];

                    if (null != uct.ControlCommon.Configurationtree_Control)
                    {
                        //
                        // 「コントロール設定ファイル」のあったコントロールの
                        // 場合に限る。
                        //

                        List<Configurationtree_Node> cfList_Event = uct.ControlCommon.Configurationtree_Control.GetChildrenByNodename(NamesNode.S_EVENT, false, log_Reports);

                        foreach (Configurationtree_Node cf_Event in cfList_Event)
                        {
                            ConfigurationtreeToExpression_Event sToE_Event = new ConfigurationtreeToExpression_EventImpl();
                            sToE_Event.Configurationtree_Event = cf_Event;
                            Functionlist felist = uct.CreateFunctionlist(
                                sToE_Event,
                                this.Owner_MemoryApplication,
                                log_Reports
                                );
                            sToE_Event.Owner_Functionlist = felist;
                        }

                        //
                        // TODO:「dt」「txa」コントロールの場合、
                        // 値が変わったイベントの時に、「値確定」アクションが必ず起動するように
                        // 自動設定したい。
                        //

                    }
                }

            }

            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 10
0
        //────────────────────────────────────────
        /// <summary>
        /// デバッグ出力。
        /// </summary>
        public void WriteDebug_ToConsole()
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            Log_Reports log_Reports_Dammy = new Log_ReportsImpl(log_Method);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "DebugWrite",log_Reports_Dammy);
            //
            //

            log_Reports_Dammy.BeginCreateReport(EnumReport.Dammy);

            log_Method.WriteInfo_ToConsole("コントロールの一覧を出力。総数=[" + this.dictionary_Item.Values.Count + "]");

            int nCount = 1;
            this.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak)
            {

                if (null == fcUc)
                {
                    log_Method.WriteInfo_ToConsole("(" + nCount + ")ヌル");
                    goto end_fc;
                }

                log_Method.WriteInfo_ToConsole("(" + nCount + ")" + fcUc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports_Dammy));
            // fcUc.ControlCommon.Configurationtree_Control は、ヌルのことがある。

                //foreach (S_Event s_event in fcUc.ControlCommon.Configurationtree_Control.S_EventDictionary.Values)
            //{

                //    // デバッグ出力
            //    //ystem.Console.WriteLine(this.GetType().Name + "#DebugWrite:  アクション数=[" + s_event.S_ActionList.Items.Count + "]");
            //    foreach (S_Action s_action in s_event.S_ActionList.Items)
            //    {
            //        //
            //        // アクション
            //        //

                //        // デバッグ出力
            //        //ystem.Console.WriteLine(this.GetType().Name + "#DebugWrite:   アクション=[" + s_action.SType + "] 引数数=[" + s_event.S_ActionList.Items.Count + "]");
            //        foreach (S_Arg s_param in s_action.S_Args.Items.Values)
            //        {
            //            //
            //            // 引数
            //            //

                //            if (s_param.S_ArgEnum == S_ArgEnum.PARAM_ACTION)
            //            {
            //                S_Action s_parentAction = (S_Action)s_param.Parent;

                //                // デバッグ出力
            //                //ystem.Console.WriteLine(this.GetType().Name + "#DebugWrite:    param-action要素=[" + s_param.SNodeName + "] 子引数数=[" + s_parentAction.S_Args.Items.Count + "]");

                //                foreach (S_Arg s_param2 in s_parentAction.S_Args.Items.Values)
            //                {
            //                    // デバッグ出力
            //                    //ystem.Console.WriteLine(this.GetType().Name + "#DebugWrite:     param-actionの子引数=[" + s_param2.SNodeName + "]");
            //                    // 値=[" + oAction2.OValue + "]
            //                }

                //            }
            //            else
            //            {
            //                // デバッグ出力
            //                //ystem.Console.WriteLine(this.GetType().Name + "#DebugWrite:    引数=[" + s_param.SNodeName + "] ");
            //                //値=[" + oArg.OValue + "]
            //            }

                //        }
            //    }
            //}

            end_fc:
                nCount++;
            });

            //
            //
            log_Reports_Dammy.EndCreateReport();
            log_Method.EndMethod(log_Reports_Dammy);
            if (!log_Reports_Dammy.Successful)
            {
                log_Method.WriteDebug_ToConsole(log_Reports_Dammy.ToText());
            }
        }
        //────────────────────────────────────────
        /// <summary>
        /// Exe_2ActionImpl#SToFc で使用。
        /// </summary>
        /// <param name="s_Action"></param>
        /// <param name="bRequired"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public Expression_Node_Function Translate(
            Configurationtree_Node action_Conf,
            bool bRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Translate",log_Reports);
            //
            //

            string sName_Fnc;
            if (action_Conf.Dictionary_Attribute.ContainsKey(PmNames.S_NAME.Name_Pm))
            {
                action_Conf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, true, log_Reports);
            }
            else
            {
                sName_Fnc = "<エラー:" + log_Method.Fullname + ">";
            }

            Expression_Node_Function expr_Func = Collection_Function.NewFunction2( sName_Fnc,
                null, action_Conf, this.Owner_MemoryApplication, log_Reports);

            if (log_Reports.Successful)
            {
                if (null != expr_Func)
                {
                    Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl();
                    pg_ParsingLog.BEnabled = false;
                    expr_Func = ((Expression_Node_FunctionAbstract)expr_Func).Functiontranslatoritem.Translate(
                        sName_Fnc,
                        action_Conf,//これは生成時に指定できない?
                        pg_ParsingLog,
                        this.Owner_MemoryApplication,
                        log_Reports
                        );
                    if (Log_ReportsImpl.BDebugmode_Static && pg_ParsingLog.BEnabled)
                    {
                        log_Method.WriteInfo_ToConsole(" pg_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString());
                    }
                }
            }

            goto gt_EndMethod;
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return expr_Func;
        }
Ejemplo n.º 12
0
        //────────────────────────────────────────
        /// <summary>
        /// デバッグ出力。
        /// </summary>
        public void WriteDebug_ToConsole()
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(log_Method);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "DebugWrite", log_Reports_ThisMethod);

            //
            //

            if (log_Method.CanInfo())
            {
                log_Method.WriteInfo_ToConsole(" ──────────登録関数名一覧");
                foreach (string sKey in this.dictionary_Item.Keys)
                {
                    log_Method.WriteInfo_ToConsole(" key=[" + sKey + "]");
                }
                log_Method.WriteInfo_ToConsole(" ──────────");
            }

            log_Method.EndMethod(log_Reports_ThisMethod);
        }
Ejemplo n.º 13
0
        //────────────────────────────────────────
        /// <summary>
        /// 『ユーザー定義関数設定ファイル(Fnc)』を読み取ります。
        /// </summary>
        public void LoadFile(
            Expression_Node_Filepath filepath_Userfunctionconfig_Expr,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile", log_Reports);

            //
            //

            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole(" ユーザー定義関数設定ファイルの読み取り。");
            }

            Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_FUNCTIONS, filepath_Userfunctionconfig_Expr.Cur_Configuration);//Info_OpyopyoImpl.LibraryName + ":" + this.GetType().Name + ".LoadFile_Fnc"
            Expression_Node_String userfunctionconfig_Expr = new Expression_Node_StringImpl(null, parent_Conf);

            string filepathabsolute = filepath_Userfunctionconfig_Expr.Execute4_OnExpressionString(
                EnumHitcount.Unconstraint, log_Reports);

            if (!log_Reports.Successful)
            {
                goto gt_Error_Fpath;
            }

            if (!System.IO.File.Exists(filepathabsolute))
            {
                goto gt_Error_File;
            }

            XmlDocument xDoc = new XmlDocument();
            Exception err_Excp = null;
            try
            {
                xDoc.Load(filepathabsolute);
            }
            catch (System.IO.IOException ex)
            {
                //
                // エラー。
                err_Excp = ex;
                goto gt_Error_Doc;
            }
            catch (ArgumentException ex)
            {
                //
                // エラー。
                err_Excp = ex;
                goto gt_Error_Doc;
            }
            catch (Exception ex)
            {
                //
                // エラー。
                err_Excp = ex;
                goto gt_Error_Doc;
            }

            XmlElement xRoot = null;
            if (log_Reports.Successful)
            {
                // ルート要素を取得
                xRoot = xDoc.DocumentElement;

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

            string sErrorElementName = "";
            if (log_Reports.Successful)
            {
                XmlNodeList xTopNL = xRoot.ChildNodes;
                foreach (XmlNode xTopNode in xTopNL)
                {
                    if (XmlNodeType.Element == xTopNode.NodeType)
                    {
                        if (NamesNode.S_COMMON_FUNCTION == xTopNode.Name)
                        {
                            XmlElement x_Cur = (XmlElement)xTopNode;

                            string sNameValue = x_Cur.GetAttribute(PmNames.S_NAME.Name_Attribute);
                            if (log_Method.CanDebug(1))
                            {
                                log_Method.WriteDebug_ToConsole(" ユーザー定義関数の追加を開始:" + sNameValue);
                            }

                            // XToCf
                            XmlToConfigurationtree_C15_Elm xToCf = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_COMMON_FUNCTION, log_Reports);
                            xToCf.XmlToConfigurationtree(
                                x_Cur,
                                parent_Conf,
                                this.Owner_MemoryApplication,
                                log_Reports
                                );

                            Configurationtree_Node s_Cur = null;
                            parent_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak)
                            {
                                s_Cur = s_Child;
                                bBreak = true;
                            });

                            // SToE
                            Expression_Node_FunctionImpl ec_CommonFunction = new Expression_Node_FunctionImpl(userfunctionconfig_Expr, s_Cur, new List<string>());

                            Log_TextIndented_ConfigurationtreeToExpressionImpl pg_ParsingLog = new Log_TextIndented_ConfigurationtreeToExpressionImpl();
                            pg_ParsingLog.BEnabled = false;
                            ConfigurationtreeToExpression_AbstractImpl.ParseChild_InAnotherLibrary(
                                s_Cur,
                                ec_CommonFunction,
                                this.Owner_MemoryApplication,
                                pg_ParsingLog,
                                log_Reports
                                );
                            if (log_Method.CanInfo() && pg_ParsingLog.BEnabled)
                            {
                                log_Method.WriteInfo_ToConsole(" d_ParsingLog=" + Environment.NewLine + pg_ParsingLog.ToString());
                            }

                            this.Owner_MemoryApplication.MemoryFunctions.AddFunction(sNameValue, ec_CommonFunction, log_Reports);
                        }
                        else
                        {
                            //
                            // エラー。
                            sErrorElementName = xTopNode.Name;
                            goto gt_Error_UndefinedChild;
                        }
                    }
                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("ユーザー定義関数設定ファイルへのパスにエラーがありました。");
                s.Newline();
                s.Newline();

                // ヒント

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("ユーザー定義関数設定ファイルがありません。");
                s.Newline();
                s.Append("file=[");
                s.Append(filepathabsolute);
                s.Append("]");
                s.Newline();
                s.Newline();

                // ヒント

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

                StringBuilder s = new StringBuilder();
                s.Append("エラー:" + err_Excp.Message);
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append(Log_RecordReportsImpl.ToText_Configuration(filepath_Userfunctionconfig_Expr.Cur_Configuration));

                // ヒント

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

                StringBuilder s = new StringBuilder();
                s.Append("未定義の要素:" + sErrorElementName);
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        private void Execute6_Sub(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports);

            string sFlowSkip;
            this.TrySelectAttribute(out sFlowSkip, Expression_Node_Function04Impl.PM_FLOWSKIP, EnumHitcount.One_Or_Zero, log_Reports);
            if ("" != sFlowSkip.Trim())
            {
                // 処理をスキップします。
                goto gt_EndMethod;
            }

            //
            //
            //
            // テーブル名
            //
            //
            //
            List<string> sList_TableName = new List<string>();
            {
                string sTableNames;
                this.TrySelectAttribute(out sTableNames, Expression_Node_Function04Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports);

                CsvTo_DataTableImpl reader = new CsvTo_DataTableImpl();
                DataTable tblNamesTable = reader.Read(
                    sTableNames
                    );

                foreach (DataRow row in tblNamesTable.Rows)
                {
                    foreach (string column in row.ItemArray)
                    {
                        sList_TableName.Add(column);
                    }
                }
            }

            foreach (string sTableName in sList_TableName)
            {
                Table_Humaninput o_Table;
                if (log_Reports.Successful)
                {
                    Expression_Node_String ec_ArgTableName;
                    this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function04Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports);

                    Expression_Node_StringImpl ec_TableName = new Expression_Node_StringImpl(this, ec_ArgTableName.Cur_Configuration);
                    ec_TableName.AppendTextNode(
                        sTableName,
                        this.Cur_Configuration,
                        log_Reports
                        );

                    // テーブル
                    o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        ec_TableName,
                        true,
                        log_Reports
                        );
                }
                else
                {
                    o_Table = null;
                }

                string sCsvText;
                if (log_Reports.Successful)
                {
                    ToCsv_Table_Humaninput_Impl textizer = new ToCsv_Table_Humaninput_Impl();
                    sCsvText = textizer.ToCsvText(o_Table, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sCsvText = null;
                }

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

                    //essageBox.Show("テーブルのtext=[" + csvText + "]", "デバッグ");

                    // TODO ファイルパスの妥当性判定も欲しい
                    sFpatha = o_Table.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sFpatha = "";
                }

                if (log_Reports.Successful)
                {
                    bool bPopup;
                    string sPopup;
                    this.TrySelectAttribute(out sPopup, Expression_Node_Function04Impl.PM_POPUP, EnumHitcount.One_Or_Zero, log_Reports);

                    if ("block" == sPopup.Trim())
                    {
                        log_Method.WriteInfo_ToConsole("sPopup=[" + sPopup + "] ポップアップしません。");
                        bPopup = false;
                    }
                    else
                    {
                        bPopup = true;
                    }

                    CsvWriterImpl writer = new CsvWriterImpl();
                    writer.Write(
                        sCsvText, sFpatha, bPopup);
                }
            }

            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }