Exemple #1
0
        //────────────────────────────────────────

        /// <summary>
        /// 相対パスが設定されていた場合、その相対元となるディレクトリーへのパスです。
        /// そうでない場合は、System.Windows.Forms.StartupPath を入れてください。
        /// </summary>
        /// <param name="newDirectoryPath"></param>
        public void SetDirectory_Base(
            string sFolderpath_New,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            // ダミー・フラグ。使いません。
            bool bDammyFlagCheckPathTooLong = false;

            if (this.Cur_Configuration is Configurationtree_NodeFilepath)
            {
                Configurationtree_NodeFilepath cf_Fpath = ((Configurationtree_NodeFilepath)this.Cur_Configuration);

                // チェック。絶対パスにすることができればOK。
                Utility_Configurationtree_Filepath.ToFilepathabsolute(
                    sFolderpath_New,
                    cf_Fpath.GetHumaninput(),
                    ref bDammyFlagCheckPathTooLong,
                    false,       //ファイル名の長さが上限超過ならエラー
                    log_Reports, //out sErrorMsg,
                    this.Cur_Configuration
                    );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                cf_Fpath.SetDirectory_Base(sFolderpath_New);
            }
            else
            {
                // エラー
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー903!", log_Method);

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

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

            //
            //
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
Exemple #2
0
        //────────────────────────────────────────

        public static string ToFilepathabsolute(
            Configurationtree_NodeFilepath filepath_Conf,
            ref bool ref_IsTooLong_Path,
            bool isSafe_TooLong_Path,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Syntax.Name_Library, "Utility_Configurationtree_Filepath", "ToFilepathabsolute①", log_Reports);

            string sResult;

            if (log_Reports.Successful)
            {
                sResult = Utility_Configurationtree_Filepath.ToFilepathabsolute(
                    "",
                    filepath_Conf.GetHumaninput(),
                    ref ref_IsTooLong_Path,
                    isSafe_TooLong_Path,
                    log_Reports,//out sErrorMsg,
                    filepath_Conf
                    );
            }
            else
            {
                sResult = "";
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(sResult);
        }
        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);
        }
        //────────────────────────────────────────
        public static string ToFilepathabsolute(
            Configurationtree_NodeFilepath filepath_Conf,
            ref bool ref_IsTooLong_Path,
            bool isSafe_TooLong_Path,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Syntax.Name_Library, "Utility_Configurationtree_Filepath", "ToFilepathabsolute①", log_Reports);

            string sResult;

            if (log_Reports.Successful)
            {
                sResult = Utility_Configurationtree_Filepath.ToFilepathabsolute(
                    "",
                    filepath_Conf.GetHumaninput(),
                    ref ref_IsTooLong_Path,
                    isSafe_TooLong_Path,
                    log_Reports,//out sErrorMsg,
                    filepath_Conf
                    );
            }
            else
            {
                sResult = "";
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return sResult;
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        //────────────────────────────────────────

        /// <summary>
        /// コンストラクター。
        /// </summary>
        /// <param name="s_Fpath"></param>
        public Expression_Node_FilepathImpl(Configurationtree_NodeFilepath fpath_Conf)
            : base(null, fpath_Conf)
        {
        }
Exemple #7
0
        //────────────────────────────────────────

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

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

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

            string sFpath;

            if (this.Cur_Configuration is Configurationtree_NodeFilepath)
            {
                Configurationtree_NodeFilepath cf_Fpath = (Configurationtree_NodeFilepath)this.Cur_Configuration;

                bool bCheckPathTooLong = false;

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

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

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

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(sFpath);
        }
 //────────────────────────────────────────
 /// <summary>
 /// コンストラクター。
 /// </summary>
 /// <param name="s_Fpath"></param>
 public Expression_Node_FilepathImpl(Configurationtree_NodeFilepath fpath_Conf)
     : base(null, fpath_Conf)
 {
 }