Example #1
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;
        }
Example #2
0
        //────────────────────────────────────────
        /// <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);
            }
        }
Example #3
0
        //────────────────────────────────────────

        /// <summary>
        /// 属性。
        /// </summary>
        /// <param name="out_E_Result">検索結果。</param>
        /// <param name="sName"></param>
        /// <param name="bRequired"></param>
        /// <param name="hits"></param>
        /// <param name="log_Reports"></param>
        /// <returns>検索結果が1件以上あれば真。</returns>
        public bool TrySelectAttribute_ExpressionFilepath(
            out Expression_Node_Filepath ec_Result_Out,
            string sName,
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            // 使いません。
            Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl(sName, this.Cur_Configuration);

            filepath_Conf.InitPath("", log_Reports);
            ec_Result_Out = new Expression_Node_FilepathImpl(filepath_Conf);
            return(false);
        }
Example #4
0
        //────────────────────────────────────────

        /// <summary>
        /// ファイル名の頭と末尾に文字列を付けることができます。
        /// </summary>
        /// <param name="prefix">ファイル名の頭に付ける文字列。</param>
        /// <param name="suffix">ファイル名の末尾に付ける文字列。</param>
        public Expression_Node_Filepath Rename_Append(string prefix, string suffix, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            Expression_Node_Filepath result;

            string absolute = this.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);

            if ("" == absolute)
            {
                result = null;
                goto gt_Error_Empty;
            }

            string directory = Path.GetDirectoryName(absolute);
            string filename  = Path.GetFileNameWithoutExtension(absolute);
            string extension = Path.GetExtension(absolute);//拡張子の「.」を含む。

            absolute = Path.Combine(directory, prefix + filename + suffix + extension);
            Configurationtree_NodeFilepath config = new Configurationtree_NodeFilepathImpl("<rename>", null);

            config.InitPath(absolute, log_Reports);
            result = new Expression_Node_FilepathImpl(config);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("ファイルパスが空文字列でした。");

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

        /// <summary>
        /// このデータは、ファイルパス型だ、と想定して、ファイルパスを取得します。
        /// </summary>
        /// <returns></returns>
        public static Expression_Node_Filepath Execute4_OnExpressionString_AsFilepath_Impl(
            Expression_Node_String ec_Caller,
            EnumHitcount request,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Syntax.Name_Library, ec_Caller, "Execute4_OnExpressionString_AsFilepath_Impl", log_Reports);
            //
            //
            //
            //

            Expression_Node_Filepath ec_Fpath_result;

            //
            // ファイルパス。
            string sFpath = ec_Caller.Execute5_Main(log_Reports);

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

                ec_Fpath_result = new Expression_Node_FilepathImpl(cf_Fpath);
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(ec_Fpath_result);
        }
Example #6
0
        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;
        }
        //────────────────────────────────────────
        /// <summary>
        /// ファイル名の頭と末尾に文字列を付けることができます。
        /// </summary>
        /// <param name="prefix">ファイル名の頭に付ける文字列。</param>
        /// <param name="suffix">ファイル名の末尾に付ける文字列。</param>
        public Expression_Node_Filepath Rename_Append(string prefix, string suffix, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "Rename_Append", log_Reports);

            Expression_Node_Filepath result;

            string absolute = this.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);
            if ("" == absolute)
            {
                result = null;
                goto gt_Error_Empty;
            }

            string directory = Path.GetDirectoryName(absolute);
            string filename = Path.GetFileNameWithoutExtension(absolute);
            string extension = Path.GetExtension(absolute);//拡張子の「.」を含む。
            absolute = Path.Combine(directory, prefix + filename + suffix + extension);
            Configurationtree_NodeFilepath config = new Configurationtree_NodeFilepathImpl("<rename>", null);
            config.InitPath(absolute, log_Reports);
            result = new Expression_Node_FilepathImpl(config);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("ファイルパスが空文字列でした。");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result;
        }
        //────────────────────────────────────────
        protected void Execute6_Sub(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, 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();
            }

            Exception error_Exception;
            string error_Filepath_Export;

            Expression_Node_Filepath pm_FileImportListfile_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FileImportListfile_Expr, Expression_Node_Function49Impl.PM_FILE_IMPORT_LISTFILE, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_String pm_FieldImportListfile_Expr;
            this.TrySelectAttribute(out pm_FieldImportListfile_Expr, Expression_Node_Function49Impl.PM_FIELD_IMPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_FilterExtensionImport_Expr;
            this.TrySelectAttribute(out pm_FilterExtensionImport_Expr, Expression_Node_Function49Impl.PM_FILTER_EXTENSION_IMPORT, EnumHitcount.One, log_Reports);

            Expression_Node_Filepath pm_FileExportListfile_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FileExportListfile_Expr, Expression_Node_Function49Impl.PM_FILE_EXPORT_LISTFILE, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_String pm_FieldExportListfile_Expr;
            this.TrySelectAttribute(out pm_FieldExportListfile_Expr, Expression_Node_Function49Impl.PM_FIELD_EXPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_TypefieldExportListfile_Expr;
            this.TrySelectAttribute(out pm_TypefieldExportListfile_Expr, Expression_Node_Function49Impl.PM_TYPEFIELD_EXPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_CommentfieldExportListfile_Expr;
            this.TrySelectAttribute(out pm_CommentfieldExportListfile_Expr, Expression_Node_Function49Impl.PM_COMMENTFIELD_EXPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_RegularexpressionReplacebeforeNamefileexport_Expr;
            this.TrySelectAttribute(out pm_RegularexpressionReplacebeforeNamefileexport_Expr, Expression_Node_Function49Impl.PM_REGULAREXPRESSION_REPLACEBEFORE_NAMEFILEEXPORT, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_String pm_RegularexpressionReplaceafterNamefileexport_Expr;
            this.TrySelectAttribute(out pm_RegularexpressionReplaceafterNamefileexport_Expr, Expression_Node_Function49Impl.PM_REGULAREXPRESSION_REPLACEAFTER_NAMEFILEEXPORT, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_Filepath pm_FolderSource_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FolderSource_Expr, Expression_Node_Function49Impl.PM_FOLDER_SOURCE, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_Filepath pm_FolderDestination_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FolderDestination_Expr, Expression_Node_Function49Impl.PM_FOLDER_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports);

            //ポップアップ指定
            string pm_Popup;
            this.TrySelectAttribute(out pm_Popup, Expression_Node_Function49Impl.PM_POPUP, EnumHitcount.One_Or_Zero, log_Reports);
            pm_Popup = pm_Popup.Trim();

            // メッセージボックスの表示。
            {
                Log_TextIndented str_Messagebox = new Log_TextIndentedImpl();
                str_Messagebox.Append(log_Method.Fullname);
                str_Messagebox.Append(":");
                str_Messagebox.Append(Environment.NewLine);

                this.Dictionary_Expression_Attribute.ToText_Debug(str_Messagebox, log_Reports);

                str_Messagebox.Append(
                    "file-import-listfile=[" + pm_FileImportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "field-import-listfile=[" + pm_FieldImportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "filter-extension-import=[" + pm_FilterExtensionImport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +

                    "file-export-listfile=[" + pm_FileExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "field-export-listfile=[" + pm_FieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "typefield-export-listfile=[" + pm_TypefieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "commentfield-export-listfile=[" + pm_CommentfieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +

                    "regularexpression-replacebefore-namefileexport=[" + pm_RegularexpressionReplacebeforeNamefileexport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "regularexpression-replaceafter-namefileexport=[" + pm_RegularexpressionReplaceafterNamefileexport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +

                    "folder-source=[" + pm_FolderSource_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "folder-destination=[" + pm_FolderDestination_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "pm_Popup=[" + pm_Popup + "]\n\n"
                    );

                MessageBox.Show(str_Messagebox.ToString(), "デバッグ表示");
            }

            //書出し先ファイルパス。
            string filepath_Export = "";
            try
            {
                filepath_Export = pm_FileExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                if ("" == filepath_Export)
                {
                    //エラー
                    error_Exception = null;
                    error_Filepath_Export = filepath_Export;
                    goto gt_Error_FilepathExport;
                }

            }
            catch (Exception ex)
            {
                //エラー
                error_Exception = ex;
                error_Filepath_Export = filepath_Export;
                goto gt_Error_FilepathExport;
            }

            // 「ファイル・リスト」CSVファイル読取り
            Table_Humaninput tableH;
            if (log_Reports.Successful)
            {
                CsvTo_Table_HumaninputImpl reader = new CsvTo_Table_HumaninputImpl();

                Request_ReadsTable request_Reads = new Request_ReadsTableImpl();
                Format_Table_Humaninput tblFormat_puts = new Format_Table_HumaninputImpl();
                request_Reads.Name_PutToTable = log_Method.Fullname;//暫定
                request_Reads.Expression_Filepath = pm_FileImportListfile_Expr;

                tableH = reader.Read(
                    request_Reads,
                    tblFormat_puts,
                    true,
                    log_Reports
                    );
            }
            else
            {
                tableH = null;
            }

            // CSVに列追加。
            string name_FieldNew;
            int index_FieldNew;
            if (log_Reports.Successful)
            {
                name_FieldNew = pm_FieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                string name_Typefield = pm_TypefieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                Fielddefinition fielddefinition_New = new FielddefinitionImpl(name_FieldNew, FielddefinitionImpl.TypefieldFromString(name_Typefield, true, log_Reports));
                fielddefinition_New.Comment = pm_CommentfieldExportListfile_Expr.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);
                tableH.AddField(fielddefinition_New, true, log_Reports);

                index_FieldNew = tableH.RecordFielddefinition.ColumnIndexOf_Trimupper(name_FieldNew);
            }
            else
            {
                index_FieldNew = -1;
            }

            string regularexpression_Replacebefore_Namefileexport = pm_RegularexpressionReplacebeforeNamefileexport_Expr.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);
            string regularexpression_Replaceafter_Namefileexport = pm_RegularexpressionReplaceafterNamefileexport_Expr.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);
            string name_FieldSource = pm_FieldImportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);// "FILE"
            if (log_Reports.Successful)
            {
                //
                // CSVソースファイル読取
                //

                int rowNumber = 1;
                tableH.ForEach_Datapart(delegate(Record_Humaninput recordH, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    //記述されているファイルパス
                    string filepath_Source_Cur;
                    if (log_Reports.Successful)
                    {
                        String_HumaninputImpl.TryParse(
                            recordH.ValueAt(name_FieldSource),
                            out filepath_Source_Cur, "", "", log_Method, log_Reports);
                    }
                    else
                    {
                        filepath_Source_Cur = "";
                    }

                    if ("" == filepath_Source_Cur)
                    {
                        //空欄なら無視。
                        goto gt_EndInnermethod;
                    }

                    Configurationtree_NodeFilepath filepathCur_Conf;
                    if (log_Reports.Successful)
                    {
                        filepathCur_Conf = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);
                        filepathCur_Conf.InitPath(filepath_Source_Cur, log_Reports);
                    }
                    else
                    {
                        filepathCur_Conf = null;
                    }

                    Expression_Node_Filepath filepathCur_Expr;
                    if (log_Reports.Successful)
                    {
                        filepathCur_Expr = new Expression_Node_FilepathImpl(filepathCur_Conf);
                    }
                    else
                    {
                        filepathCur_Expr = null;
                    }

                    //頭をカットする
                    Expression_Node_Filepath fileDestination_Expr;
                    if (log_Reports.Successful)
                    {
                        string filepath_Destination_New1;
                        filepathCur_Expr.TryCutFolderpath(out filepath_Destination_New1, pm_FolderSource_Expr, true, log_Reports);

                        //転送先パスの作成
                        Configurationtree_NodeFilepath fileDestination_Conf = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);
                        fileDestination_Conf.InitPath(pm_FolderDestination_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), filepath_Destination_New1, log_Reports);

                        fileDestination_Expr = new Expression_Node_FilepathImpl(fileDestination_Conf);
                    }
                    else
                    {
                        fileDestination_Expr = null;
                    }

                    if (!log_Reports.Successful)
                    {
                        //エラー
                        isBreak2 = true;
                        goto gt_EndInnermethod;
                    }

                    //
                    //ソース側の拡張子を確認したい。
                    //
                    string extension;
                    string filterExtension = pm_FilterExtensionImport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint,log_Reports);
                    List<string> list_FilterExtension = new CsvTo_ListImpl().Read(filterExtension);
                    fileDestination_Expr.TryGetExtension(out extension,log_Reports);
                    //log_Method.WriteDebug_ToConsole("拡張子=[" + extension + "](要素数=" + list_FilterExtension.Count + ") フィルター=[" + filterExtension + "] 含まれる?=[" + list_FilterExtension.Contains(extension) + "]");

                    if (list_FilterExtension.Contains(extension))
                    {
                        //フィルターに含まれる

                        //出力側のファイルパス
                        Value_Humaninput valueH_New = new String_HumaninputImpl(log_Method.Fullname);
                        valueH_New.Text = fileDestination_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                        //ファイル名を正規表現で置換をするか否か
                        if("" != regularexpression_Replacebefore_Namefileexport)
                        {
                            Match m1 = Regex.Match(valueH_New.Text, regularexpression_Replacebefore_Namefileexport);
                            if (m1.Success)
                            {
                                //ファイルパスを正規表現で置換します。
                                valueH_New.Text = System.Text.RegularExpressions.Regex.Replace(
                                    valueH_New.Text,
                                    regularexpression_Replacebefore_Namefileexport,
                                    regularexpression_Replaceafter_Namefileexport
                                    );
                            }
                            else
                            {
                                //【2012-10-24 追加】
                                //置換が指定されているのに置換ができなかった場合は、空文字列に変換します。
                                valueH_New.Text = "";
                            }

                        }

                        //
                        // レコードの追加列に値セット。
                        //
                        recordH.SetValueAt(index_FieldNew, valueH_New, log_Reports);
                    }
                    else
                    {
                    }

                    //
                gt_EndInnermethod:
                    rowNumber++;
                }, log_Reports);
            }

            //自動連番を振ります。
            if (log_Reports.Successful)
            {
                tableH.RenumberingNoField();
            }

            //CSVファイルの書出し
            if (log_Reports.Successful)
            {
                string text_Csv = new ToCsv_Table_Humaninput_Impl().ToCsvText(tableH, log_Reports);

                try
                {

                    System.IO.File.WriteAllText(
                        filepath_Export,
                        text_Csv,
                        Global.ENCODING_CSV
                        );

                    if (pm_Popup != S_BLOCK)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();

                        s.Append("ファイルに書き込みました。");
                        s.Newline();
                        s.Append("[");
                        s.Append(filepath_Export);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        MessageBox.Show(s.ToString(), "▲実行結果!(L02)");
                    }
                }
                catch (Exception ex)
                {
                    //エラー
                    error_Exception = ex;
                    error_Filepath_Export = filepath_Export;
                    goto gt_Error_Exception;
                }
            }

            goto gt_EndMethod;
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_FilepathExport:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(error_Exception), log_Reports);//例外メッセージ
                tmpl.SetParameter(2, error_Filepath_Export, log_Reports);//出力先ファイルパス

                this.Owner_MemoryApplication.CreateErrorReport("Er:110031;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Exception:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(error_Exception), log_Reports);//例外メッセージ
                tmpl.SetParameter(2, error_Filepath_Export, log_Reports);//出力先ファイルパス

                this.Owner_MemoryApplication.CreateErrorReport("Er:110032;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Example #9
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);
        }
        public void TryGetFilepath_Configurationtree(out Configurationtree_NodeFilepath out_Value, string sName, bool bRequired,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "TryGetFilepath_Configurationtree", log_Reports);
            //

            if (!this.Dictionary_Field.ContainsKey(sName))
            {
                //該当なし。

                if (bRequired)
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname,null);//ヌル・オブジェクト。
                    goto gt_Error_NotFound;
                }
                else
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。
                    goto gt_EndMethod;
                }
            }

            FieldUserformtable fo_Field = this.Dictionary_Field[sName];

            if (EnumTypedb.ConfFilepath != fo_Field.EnumTypedb)
            {
                //型が異なる。

                if (bRequired)
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。
                    goto gt_Error_Type;
                }
                else
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。
                    goto gt_EndMethod;
                }
            }
            out_Value = (Configurationtree_NodeFilepath)fo_Field.Data;

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFound:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sName, log_Reports);//フィールド名

                memoryApplication.CreateErrorReport("Er:6007;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Type:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sName, log_Reports);//フィールド名
                tmpl.SetParameter(2, fo_Field.EnumTypedb.ToString(), log_Reports);//フィールドの型名

                memoryApplication.CreateErrorReport("Er:6008;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Example #11
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);
        }
Example #12
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);
        }
Example #13
0
        //────────────────────────────────────────
        /// <summary>
        /// 「レイアウト_テーブル」のテーブルタイプが「Form」専用。
        /// </summary>
        /// <param name="fo_Record"></param>
        /// <param name="dataRow"></param>
        /// <param name="o_Table_Form"></param>
        /// <param name="ol_Config2"></param>
        /// <param name="pg_Logging"></param>
        /// <returns>0:正常終了、2:continue。</returns>
        private int Read_Form(
            RecordUserformconfig fo_Record,
            DataRow dataRow,
            Table_Humaninput o_Table_Form,
            TableUserformconfig fo_Config,
            MemoryApplication memoryApplication,
            Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "Read_Layout",pg_Logging);
            //
            //

            int nResult = 0;

            int nIntValue;// = 0;
            string sValue;// = "";
            bool bValue;// = false;

            //
            // TREE (特殊判定)
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TREE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    //フィールド有り

                    if (dataRow[sFieldName] is DBNull)// この連想配列は大文字・小文字を区別しないのが欠点。
                    {
                        // フィールドは有るが、未記入の時。

                        // TREEフィールドが未記入の場合は、空行と判断して、無視します。
                        nResult = 2;
                        goto gt_EndMethod;
                    }

                    //フィールドが有り、記入もあるとき。

                    pg_Logging.Log_Callstack.Push(pg_Method, "③");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 「値が空(-1)」は、空行としてよく使います。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "③");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_TREE, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NTree = nIntValue;
                    }
                    else
                    {
                        // エラー時
                    }
                }

            }

            //
            // NO
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_NO;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (pg_Logging.Successful)
                {
                    if (bContained)
                    {
                        pg_Logging.Log_Callstack.Push(pg_Method, "④");
                        bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                            dataRow[sFieldName],
                            out nIntValue,
                            EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                            -1,
                            pg_Logging
                            );
                        pg_Logging.Log_Callstack.Pop(pg_Method, "④");

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

                        if (bParsedSuccessful)
                        {
                            fo_Record.Set(NamesFld.S_NO, EnumTypedb.Int, nIntValue, pg_Logging);
                            //fo_Record.NNo = nIntValue;
                        }
                        else
                        {
                            fo_Record.Set(NamesFld.S_NO, EnumTypedb.Int, 0, pg_Logging);
                            //fo_Record.NNo = 0;
                        }
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_NO, EnumTypedb.Int, 0, pg_Logging);
                        //fo_Record.NNo = 0;
                    }

                }
            }

            //
            // NAME
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_NAME;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑤");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑤");

                    if (bBool)
                    {
                        // コントロール名。
                        fo_Record.Set( NamesFld.S_NAME, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.Name = sValue;
                    }
                    else
                    {
                        //
                        // NAME がエラー?
                        //

                        // コントロール名。
                        fo_Record.Set(NamesFld.S_NAME, EnumTypedb.String, "<エラー>", pg_Logging);
                        //fo_Record.Name = "<エラー>";
                    }

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

                }
            }

            //
            // int型のTREEフィールドが-1の場合は、空行と判断します。
            //
            int nCurTree;
            fo_Record.TryGetInt(out nCurTree, NamesFld.S_TREE, true, -1, memoryApplication, pg_Logging);
            if (-1 == nCurTree)
            {
                nResult = 2;
                goto gt_EndMethod;
            }

            //
            // TYPE
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TYPE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑦");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑦");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_TYPE, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SType = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_TYPE, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SType = "";
                    }

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

            //
            // TEXT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TEXT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑧");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑧");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_TEXT, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SText = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_TEXT, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SText = "";
                    }

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

                }
            }

            //
            // FILE
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_FILE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑨");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑨");

                    if (bBool)
                    {
                        Configurationtree_NodeFilepath cf_Fpath_Control = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L10_1", o_Table_Form);
                        cf_Fpath_Control.InitPath(sValue, pg_Logging);
                        if (pg_Logging.Successful)
                        {
                            fo_Record.Set(NamesFld.S_FILE, EnumTypedb.ConfFilepath, cf_Fpath_Control, pg_Logging);
                            //fo_Record.Cf_File = cf_Fpath_Control;
                        }
                    }
                    else
                    {
                        Configurationtree_NodeFilepath cf_Fpath_Control = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L10_2", o_Table_Form);
                        cf_Fpath_Control.InitPath("", pg_Logging);
                        if (pg_Logging.Successful)
                        {
                            fo_Record.Set(NamesFld.S_FILE, EnumTypedb.ConfFilepath, cf_Fpath_Control, pg_Logging);
                            //fo_Record.Cf_File = cf_Fpath;
                        }
                    }

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

                }
            }

            //
            // ENABLED
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_ENABLED;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑩");
                    bool bParseSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑩");

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

                    if (bParseSuccessful)
                    {
                        fo_Record.Set( NamesFld.S_ENABLED, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BEnabled = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_ENABLED, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BEnabled = false;
                    }
                }
            }

            //
            // VISIBLE
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_VISIBLE;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑪");
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑪");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_VISIBLE, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BVisible = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_VISIBLE, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BVisible = false;
                    }
                }
                else
                {
                    //
                    // VISIBLEフィールドがない場合、常に可視とします。
                    //

                    fo_Record.Set(NamesFld.S_VISIBLE, EnumTypedb.Bool, true, pg_Logging);
                    //fo_Record.BVisible = true;
                }
            }

            //
            // READ_ONLY
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_READ_ONLY;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑫");
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑫");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_READ_ONLY, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BReadOnly = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_READ_ONLY, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BReadOnly = false;
                    }
                }
            }

            //
            // WORD_WRAP
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_WORD_WRAP;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑬");
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑬");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_WORD_WRAP, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BWordWrap = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_WORD_WRAP, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BWordWrap = false;
                    }
                }
            }

            //
            // NEW_LINE
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_NEW_LINE;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑭");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑭");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_NEW_LINE, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SNewLine = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_NEW_LINE, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SNewLine = "";
                    }

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

                }
                else
                {
                    //
                    // VISIBLEフィールドがない場合、指定なしとします。
                    //

                    fo_Record.Set(NamesFld.S_NEW_LINE, EnumTypedb.String, "", pg_Logging);
                    //fo_Record.SNewLine = "";
                }
            }

            //
            // SCROLL_BARS
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_SCROLL_BARS;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑮");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑮");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_SCROLL_BARS, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SScrollBars = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_SCROLL_BARS, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SScrollBars = "";
                    }

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

            //
            // CHK_VALUE_TYPE
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_CHK_VALUE_TYPE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑯");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑯");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_CHK_VALUE_TYPE, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SChkValueType = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_CHK_VALUE_TYPE, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SChkValueType = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        goto gt_EndMethod;
                    }
                }
            }

            //
            // FONT_SIZE_PT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_FONT_SIZE_PT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑰");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑰");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_FONT_SIZE_PT, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SFontSizePt = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_FONT_SIZE_PT, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SFontSizePt = "";
                    }

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

            //
            // PIC_ZOOM
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_PIC_ZOOM;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑱");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        1000,// 等倍サイズ。千分率なので1000。
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑱");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_PIC_ZOOM, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NPicZoom = nIntValue;
                    }
                }
                else
                {
                    //
                    // フィールドが無かった場合。
                    //
                    fo_Record.Set(NamesFld.S_PIC_ZOOM, EnumTypedb.Int, 1000, pg_Logging);
                    //fo_Record.NPicZoom = 1000;// 等倍サイズ。千分率なので1000。
                }
            }

            //
            // X_LT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_X_LT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑲");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑲");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_X_LT, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NAbsXLt = nIntValue;
                    }
                }
            }

            //
            // Y_LT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_Y_LT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑳");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑳");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_Y_LT, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NAbsYLt = nIntValue;
                    }
                }
            }

            //
            // WIDTH
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_WIDTH;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(21)");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(21)");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_WIDTH, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NWidth = nIntValue;
                    }
                }
            }

            //
            // HEIGHT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_HEIGHT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(22)");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(22)");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_HEIGHT, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NHeight = nIntValue;
                    }
                }
            }

            //
            // TAB_INDEX
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TAB_INDEX;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(23)");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value,//大したデータではないので、省略すると-1にする。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(23)");

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

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_TAB_INDEX, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NTabIndex = nIntValue;
                    }
                }
            }

            //
            // BACK_COLOR
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_BACK_COLOR;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(24)");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(24)");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_BACK_COLOR, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SBackColor = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_BACK_COLOR, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SBackColor = "";
                    }

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

                }
                else
                {
                    fo_Record.Set(NamesFld.S_BACK_COLOR, EnumTypedb.String, "", pg_Logging);
                    //fo_Record.SBackColor = "";
                }
            }

            this.Read_FormLst(
                false,
                fo_Record,
                dataRow,
                o_Table_Form,
                pg_Logging
                );

            //
            //
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
            return nResult;
        }
Example #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e_Result">検索結果。</param>
        /// <param name="name_Attribute"></param>
        /// <param name="bRequired"></param>
        /// <param name="hits"></param>
        /// <param name="log_Reports"></param>
        /// <returns>検索結果が1件以上あれば真。</returns>
        public bool TrySelect_ExpressionFilepath(
            out Expression_Node_Filepath out_Fliepath_Expr,
            string name_Attribute,
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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


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


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

            filepath_Conf.InitPath(value, log_Reports);

            out_Fliepath_Expr = new Expression_Node_FilepathImpl(filepath_Conf);

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

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

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

            //        // ヒント

            //        r.Message = s.ToString();
            //        log_Reports.EndCreateReport();
            //    }
            //    goto gt_EndMethod;
            ////────────────────────────────────────────
            //    #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(isResult);
        }
        //────────────────────────────────────────
        /// <summary>
        /// <f-set-var>要素の名前を指定して、値を取り出します。(ファイル・パスとします)
        /// 該当がなければヌルを返します。
        /// </summary>
        /// <param name="projectName"></param>
        /// <param name="bRequired">該当がない場合にエラー扱いにするなら真</param>
        /// <returns></returns>
        public Expression_Node_Filepath GetFilepathByFsetvarname(
            string sNamevar_Expected,
            MemoryVariables moVariables,
            bool bRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetFilepathByFsetvarname",log_Reports);
            //
            //

            Expression_Node_Filepath ec_Fpath = null;

            //各<f-set-var>
            this.Dictionary_Fsetvar_Configurationtree.List_Child.ForEach(delegate(Configurationtree_Node s_Fsetvar, ref bool bBreak)
            {
                //name-var属性
                string sNamevar_Cur;
                s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_NAME_VAR, out sNamevar_Cur, true, log_Reports);

                if (sNamevar_Cur == sNamevar_Expected)
                {
                    string sFolder;
                    s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_FOLDER, out sFolder, false, log_Reports);

                    string sValue;
                    s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports);

                    {
                        Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("『エディター設定ファイル』の[" + sNamevar_Expected + "]要素_L09Mid_2[" + sValue + "]", this.Parent);
                        cf_Fpath.InitPath(
                            sValue,
                            log_Reports
                        );

                        if ("" != sFolder)
                        {
                            //フォルダーパス変数名の指定有り
                            Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sFolder, null, cf_Fpath);

                            log_Reports.Log_Callstack.Push(log_Method, "②");
                            Expression_Node_Filepath ec_Fpath_Folder = moVariables.GetExpressionfilepathByVariablename(ec_Namevar_Folder, true, log_Reports);
                            log_Reports.Log_Callstack.Pop(log_Method, "②");

                            if (log_Reports.Successful)
                            {
                                string sDirectory = ec_Fpath_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                                if (log_Method.CanDebug(1))
                                {
                                    log_Method.WriteDebug_ToConsole("folder=[" + sFolder + "] directory=[" + sDirectory + "]");
                                }
                                cf_Fpath.SetDirectory_Base(
                                    sDirectory
                                    );
                            }
                        }

                        if (!log_Reports.Successful)
                        {
                            // 既エラー。
                            bBreak = true;
                            goto gt_EndMethod2;
                        }

                        ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                    }
                }

                goto gt_EndMethod2;
                //
                //
            gt_EndMethod2:
                ;
            });

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

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("次の要素は必要でしたが、記述されていませんでした。<" + NamesNode.S_EDITOR + ">要素の中に。");
                s.Newline();
                s.Newline();

                s.Append("<" + NamesNode.S_F_SET_VAR + " name=\"" + sNamevar_Expected + "\" >");
                s.Newline();
                s.Newline();

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

                s.Append(" ・『設定ファイル』に、必要な内容が書けていない?");
                s.Newline();

                s.Append(" ・設定ファイル情報:");
                s.Append(r.Message_Configuration(this.Parent));
                s.Newline();
                s.Newline();

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return ec_Fpath;
        }
        //────────────────────────────────────────
        /// <summary>
        /// 『Aa_Tool.xml/<editor>要素』または、『Aa_Editor.xml/<ルート>要素』を読み取ります。
        /// <f-set-var>を読み取った場合、逐次、変数モデルに追加していきます。
        /// </summary>
        public void LoadFile_Aaxml(
            Expression_Node_Filepath ec_Fpath_Aaxml,
            MemoryVariables moVariables,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "LoadFile_Aaxml",log_Reports);

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

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

            Exception err_Excp;
            try
            {

                xDoc.Load(sFpatha);

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

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

                foreach (XmlNode xNode_Fsetvar in xNl_Fsetvar)
                {
                    if (XmlNodeType.Element == xNode_Fsetvar.NodeType)
                    {
                        //<f-set-var>要素
                        XmlElement xFsetvar = (XmlElement)xNode_Fsetvar;

                        //name-var属性
                        string sNamevar = xFsetvar.GetAttribute(PmNames.S_NAME_VAR.Name_Attribute);

                        //folder属性
                        string sFolder = xFsetvar.GetAttribute(PmNames.S_FOLDER.Name_Attribute);

                        //value属性
                        string sValue = xFsetvar.GetAttribute(PmNames.S_VALUE.Name_Attribute);

                        //description属性
                        string sDescription = xFsetvar.GetAttribute(PmNames.S_DESCRIPTION.Name_Attribute);

                        Configurationtree_Node cf_Fsetvar = new Configurationtree_NodeImpl(NamesNode.S_F_SET_VAR,
                            null//todo:親ノード
                            );
                        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);

                        this.Dictionary_Fsetvar_Configurationtree.List_Child.Add(cf_Fsetvar, log_Reports);

                        //変数への追加
                        {
                            if (
                                NamesVar.Test_Filepath(sNamevar)
                                )
                            {
                                // ファイルパスの場合
                                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("name-var=[" + sNamevar + "]", ec_Fpath_Aaxml.Cur_Configuration);
                                cf_Fpath.InitPath(
                                    sValue,
                                    log_Reports
                                    );
                                if ("" != sFolder)
                                {
                                    Expression_Node_Filepath ec_Folder = moVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sFolder, ec_Fpath_Aaxml, cf_Fsetvar), true, log_Reports);

                                    if (log_Reports.Successful)
                                    {
                                        cf_Fpath.SetDirectory_Base(
                                            ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)
                                            //sFolder
                                            );
                                    }
                                }

                                if (log_Reports.Successful)
                                {
                                    Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                                    moVariables.PutFilepath(
                                        sNamevar,
                                        ec_Fpath,
                                        true,
                                        log_Reports
                                        );
                                }
                            }
                            else
                            {
                                // ファイルパスでない場合
                                moVariables.PutString(
                                    sNamevar,
                                    sValue,
                                    log_Reports
                                    );
                            }

                        }
                    }

                    if (!log_Reports.Successful)
                    {
                        //既エラー
                        break;
                    }
                }

                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }
            catch (System.IO.IOException ex)
            {
                // 既エラー。
                err_Excp = ex;
                goto gt_Error_IOException;
            }

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

                StringBuilder s = new StringBuilder();
                s.Append("エディター設定ファイルが見つかりません。:" + err_Excp.Message);

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

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
        //────────────────────────────────────────
        /// <summary>
        /// Aa_Files.xmlの「FOLDER」「FILE」列を読取ります。
        /// </summary>
        /// <param name="ec_Fpath"></param>
        /// <param name="sTableNameToPuts"></param>
        /// <param name="sFpatha_Aafiles"></param>
        /// <param name="dataRow"></param>
        /// <param name="o_IndexTable"></param>
        /// <param name="log_Reports"></param>
        private void Read_Folder_File(
            out Expression_Node_Filepath ec_Fpath,
            string sTableNameToPuts,
            string sFpatha_Aafiles,
            DataRow dataRow,
            Table_Humaninput o_IndexTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Read_Folder_File",log_Reports);

            string sFpath;//バックアップ用に使い回す文字列。
            ec_Fpath = null;//セットパス用に使い回す。

            {
                //
                // フォルダー変数の指定の有無
                //
                string sNamevarFolder;
                {
                    string sFieldName2 = NamesFld.S_FOLDER;
                    if (String_HumaninputImpl.TryParse(
                        dataRow[sFieldName2],
                        out sNamevarFolder,
                        o_IndexTable.Name,
                        sFieldName2,
                        log_Method,
                        log_Reports))
                    {
                        // 正常、スルー。
                    }
                    else
                    {
                        sNamevarFolder = "";
                    }
                }

                // テーブルのファイルのパスを取得
                string sName_Field = NamesFld.S_FILE;
                if (String_HumaninputImpl.TryParse(
                    dataRow[sName_Field],
                    out sFpath,
                    o_IndexTable.Name,
                    sName_Field,
                    log_Method,
                    log_Reports))
                {

                    if ("" != sNamevarFolder.Trim())
                    {
                        // FOLDER列に、変数名が指定されているとき。

                        Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sNamevarFolder.Trim(), null, new Configurationtree_NodeImpl(o_IndexTable.Name, null));//todo:

                        log_Reports.Log_Callstack.Push(log_Method, "③");
                        Expression_Node_Filepath ec_Fopath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(
                            ec_Namevar_Folder, true, log_Reports);
                        log_Reports.Log_Callstack.Pop(log_Method, "③");

                        if (null == ec_Fopath)
                        {
                            goto gt_Error_NullFolder;
                        }

                        //if (log_Method.CanDebug(1))
                        //{
                        //    log_Method.WriteDebug_ToConsole(".csvのFOLDER列に[" + sNamevarFolder + "]と指定されていました。");
                        //}

                        log_Reports.Log_Callstack.Push(log_Method, "⑧");
                        //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返す??
                        string sFopath2 = ec_Fopath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                        if ("" == sFopath2)
                        {
                            //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返すようなので、入力値をそのまま返すことにした。
                            sFopath2 = ec_Fopath.Humaninput.Trim();
                        }
                        log_Reports.Log_Callstack.Pop(log_Method, "⑧");

                        //if (log_Method.CanDebug(1))
                        //{
                        //    log_Method.WriteDebug_ToConsole("[" + sNamevarFolder + "]変数の内容は["+sFopath2+"]");
                        //    //this.Owner_MemoryApplication.MemoryVariables.WriteDebug_ToConsole();
                        //}

                        // 「フォルダー」 + 「¥」 + 「相対パス」
                        sFpath = sFopath2 + System.IO.Path.DirectorySeparatorChar + sFpath;
                    }
                }

                //
                // ファイルパス
                //
                Configurationtree_NodeFilepath cf_Fpath1;
                {
                    StringBuilder s = new StringBuilder();
                    s.Append("L11_1[");
                    s.Append(NamesFile.S_AA_FILES_CSV);
                    s.Append("ファイルの");
                    s.Append(sTableNameToPuts);
                    s.Append("指定=");
                    s.Append(sFpath);
                    s.Append("]");
                    cf_Fpath1 = new Configurationtree_NodeFilepathImpl(s.ToString(), null);
                    //cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L11_1", new Configurationtree_NodeImpl(s.ToString(), null));
                }

                cf_Fpath1.InitPath(sFpath, log_Reports);

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

                ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath1);
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullFolder:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:110009;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 「日別バックアップ」するテーブルの登録。
        /// </summary>
        /// <param name="log_Reports"></param>
        private void RegisterDateBackup(
            Log_Reports log_Reports
            )
        {
            //
            // 全てのテーブルについて。
            //
            foreach (Table_Humaninput oTable in this.Owner_MemoryApplication.MemoryTables.Dictionary_Table_Humaninput.Values)
            {
                //
                // フラグ読取: 日初めのバックアップを取るかどうかどうか。
                //
                bool bDateBackupFlag;

                bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                    oTable.IsDatebackupActivated,// dataRow["DATE_BACKUP"],
                    out bDateBackupFlag,
                    EnumOperationIfErrorvalue.Error,
                    null,
                    log_Reports
                    );
                if (!log_Reports.Successful)
                {
                    // エラー
                    goto gt_EndMethod;
                }

                if (bParsedSuccessful)
                {
                    if (bDateBackupFlag)
                    {
                        //
                        // バックアップを取るなら、
                        // ファイルパスをリストに入れる。
                        //

                        Log_TextIndented txt = new Log_TextIndentedImpl();
                        oTable.ToText_Locationbreadcrumbs(txt);

                        Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L11_2", oTable);//  txt.ToString() + "のDataBackup");
                        cf_Fpath.InitPath(
                            oTable.Expression_Filepath_ConfigStack.Humaninput,
                            log_Reports
                            );
                        if (!log_Reports.Successful)
                        {
                            // 既エラー。
                            goto gt_EndMethod;
                        }

                        Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                        this.List_Expression_Filepath_BackupRequest_Out.Add(ec_Fpath);
                    }
                }
            }

            //
            //
            //
            //
            gt_EndMethod:
            return;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e_Result">検索結果。</param>
        /// <param name="name_Attribute"></param>
        /// <param name="bRequired"></param>
        /// <param name="hits"></param>
        /// <param name="log_Reports"></param>
        /// <returns>検索結果が1件以上あれば真。</returns>
        public bool TrySelect_ExpressionFilepath(
            out Expression_Node_Filepath out_Fliepath_Expr,
            string name_Attribute,
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TrySelect_ExpressionFilepath", log_Reports);

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

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

            out_Fliepath_Expr = new Expression_Node_FilepathImpl(filepath_Conf);

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

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

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

            //        // ヒント

            //        r.Message = s.ToString();
            //        log_Reports.EndCreateReport();
            //    }
            //    goto gt_EndMethod;
            ////────────────────────────────────────────
            //    #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return isResult;
        }
Example #20
0
 //────────────────────────────────────────
 /// <summary>
 /// 属性。
 /// </summary>
 /// <param name="out_E_Result">検索結果。</param>
 /// <param name="sName"></param>
 /// <param name="bRequired"></param>
 /// <param name="hits"></param>
 /// <param name="log_Reports"></param>
 /// <returns>検索結果が1件以上あれば真。</returns>
 public bool TrySelectAttribute_ExpressionFilepath(
     out Expression_Node_Filepath ec_Result_Out,
     string sName,
     EnumHitcount hits,
     Log_Reports log_Reports
     )
 {
     // 使いません。
     Configurationtree_NodeFilepath filepath_Conf = new Configurationtree_NodeFilepathImpl(sName, this.Cur_Configuration);
     filepath_Conf.InitPath("", log_Reports);
     ec_Result_Out = new Expression_Node_FilepathImpl(filepath_Conf);
     return false;
 }
        //────────────────────────────────────────
        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 "";
        }
Example #23
0
        //────────────────────────────────────────
        /// <summary>
        /// システム変数を、自動類推して、自動登録します。
        /// </summary>
        /// <param name="ec_Fopath_Editor"></param>
        /// <param name="log_Reports"></param>
        public void Load_AutoSystemVariable(
            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, "Load_AutoSystemVariable",log_Reports);
            //
            //

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

            //
            // Engine フォルダー
            //
            if (log_Reports.Successful)
            {

                string sNamevar = NamesVar.S_SP_ENGINE;
                string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_ENGINE;
                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration);
                cf_Fpath.InitPath(sValue, log_Reports);
                this.Owner_MemoryApplication.MemoryVariables.PutFilepath(
                    sNamevar,
                    new Expression_Node_FilepathImpl(cf_Fpath),
                    false,//重複登録可。
                    log_Reports
                    );
            }

            //
            // Forms フォルダー
            //
            if (log_Reports.Successful)
            {
                string sNamevar = NamesVar.S_SP_FORMS;
                string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_FORMS;
                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration);
                cf_Fpath.InitPath(sValue, log_Reports);
                this.Owner_MemoryApplication.MemoryVariables.PutFilepath(
                    sNamevar,
                    new Expression_Node_FilepathImpl(cf_Fpath),
                    false,//重複登録可。
                    log_Reports
                    );
            }

            //
            // Logs フォルダー
            //
            if (log_Reports.Successful)
            {
                string sNamevar = NamesVar.S_SP_LOGS;
                string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOGS;
                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration);
                cf_Fpath.InitPath(sValue, log_Reports);
                this.Owner_MemoryApplication.MemoryVariables.PutFilepath(
                    sNamevar,
                    new Expression_Node_FilepathImpl(cf_Fpath),
                    false,//重複登録可。
                    log_Reports
                    );
            }

            //
            // Aa_Files.csv ファイル
            //
            if (log_Reports.Successful)
            {
                string sNamevar = NamesVar.S_SP_FILES;
                string sValue = sFopath_Editor + System.IO.Path.DirectorySeparatorChar + NamesFile.S_ENGINE + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_FILES_CSV;
                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("L09自動類推", ec_Fopath_Editor.Cur_Configuration);
                cf_Fpath.InitPath(sValue, log_Reports);
                this.Owner_MemoryApplication.MemoryVariables.PutFilepath(
                    sNamevar,
                    new Expression_Node_FilepathImpl(cf_Fpath),
                    false,//重複登録可。
                    log_Reports
                    );

                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("「エディター設定ファイル」の Dic に S_SP_FILES を登録します。 sValue=[" + sValue + "]");
                }
            }

            goto gt_EndMethod;
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Example #24
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);
        }
Example #25
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);
        }
Example #26
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;
        }
Example #27
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;
        }
Example #28
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;
        }
Example #29
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;
        }
Example #30
0
        //────────────────────────────────────────
        /// <summary>
        /// このデータは、ファイルパス型だ、と想定して、ファイルパスを取得します。
        /// </summary>
        /// <returns></returns>
        public static Expression_Node_Filepath Execute4_OnExpressionString_AsFilepath_Impl(
            Expression_Node_String ec_Caller,
            EnumHitcount request,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Syntax.Name_Library, ec_Caller, "Execute4_OnExpressionString_AsFilepath_Impl", log_Reports);
            //
            //
            //
            //

            Expression_Node_Filepath ec_Fpath_result;

            //
            // ファイルパス。
            string sFpath = ec_Caller.Execute5_Main(log_Reports);
            {
                Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L01_1", ec_Caller.Cur_Configuration);
                cf_Fpath.InitPath(sFpath, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    ec_Fpath_result = null;
                    goto gt_EndMethod;
                }

                ec_Fpath_result = new Expression_Node_FilepathImpl(cf_Fpath);
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return ec_Fpath_result;
        }
Example #31
0
        //────────────────────────────────────────
        /// <summary>
        /// 定型処理。
        /// </summary>
        public void P101_LoadAatoolxml(
            Configurationtree_Node cf_CallerMethod,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "P101_LoadAatoolxml", log_Reports);
            //
            //

            this.Owner_MemoryApplication.MemoryAatoolxml.Clear(this.Owner_MemoryApplication);

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

                    ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);
                }

                this.Owner_MemoryApplication.MemoryAatoolxml.LoadFile(ec_Fpath, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }
            else
            {
                // エラー終了処理
            }

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