コード例 #1
0
        public void SetHumaninput(
            string filepath_Humaninput_New,
            Log_Reports log_Reports
            )
        {
            if (log_Reports.Successful)
            {
                // ダミー・フラグ。使いません。
                bool bDammyFlagCheckPathTooLong = false;

                // チェックするだけ。 絶対パスにすることができれば問題なし、そのままスルー。
                Utility_Configurationtree_Filepath.ToFilepathabsolute(
                    this.directory_Base,
                    filepath_Humaninput_New,
                    ref bDammyFlagCheckPathTooLong,
                    false,//ファイル名の長さが上限超過ならエラー
                    log_Reports,
                    this.Parent
                    );
            }

            if (log_Reports.Successful)
            {
                // 引数を受け入れます。
                this.humaninput = filepath_Humaninput_New;
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            return;
        }
コード例 #2
0
        //────────────────────────────────────────

        /// <summary>
        /// 絶対パスが、ファイルシステムで使えるファイルパスの文字列の長さの制限を越えていれば真。
        /// </summary>
        /// <param name="newDirectoryPath">指定するものがない場合は、System.Windows.Forms.StartupPath を入れてください。</param>
        /// <param name="newHumanInputFilePath"></param>
        /// <param name="cur_Conf"></param>
        public static bool IsTooLong_Path(
            string folderpath_New,
            string filepath_Humaninput_New,
            Log_Reports log_Reports,
            Configurationtree_Node cur_Conf
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            // フラグ。
            bool bFlagCheckPathTooLong = false;

            if (log_Reports.Successful)
            {
                // チェック。絶対パスにすることができればOK。
                Utility_Configurationtree_Filepath.ToFilepathabsolute(
                    folderpath_New,
                    filepath_Humaninput_New,
                    ref bFlagCheckPathTooLong,
                    true,        //ファイル名の長さが上限超過でも、正常処理扱いとします。
                    log_Reports, // out sErrorMsg,
                    cur_Conf
                    );
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(bFlagCheckPathTooLong);
        }
コード例 #3
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;
        }
コード例 #4
0
        //────────────────────────────────────────

        /// <summary>
        /// パスを設定します。相対パス、絶対パスの違いを吸収するためのものです。
        /// </summary>
        /// <param name="sFopath_New">フォルダーパス。指定するものがない場合は、System.Windows.Forms.StartupPath を入れてください。</param>
        /// <param name="sFpath_Newhumaninput">ファイルパス。</param>
        public void InitPath(
            string sFopath_New,
            string sFpath_Newhumaninput,
            Log_Reports log_Reports
            )
        {
            // ダミー・フラグ。使いません。
            bool bDammyFlagCheckPathTooLong = false;

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

            if (log_Reports.Successful)
            {
                this.SetDirectory_Base(sFopath_New);
            }

            if (log_Reports.Successful)
            {
                this.SetHumaninput(
                    sFpath_Newhumaninput,
                    log_Reports
                    );
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            return;
        }
コード例 #5
0
        //────────────────────────────────────────

        public static string ToFilepathabsolute(
            string humaninput,
            ref bool ref_isTooLong_Path,
            bool isSafe_TooLong_Path,
            Log_Reports log_Reports,
            Configurationtree_Node cur_Conf
            )
        {
            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(
                    "",
                    humaninput,
                    ref ref_isTooLong_Path,
                    isSafe_TooLong_Path,
                    log_Reports,//out sErrorMsg,
                    cur_Conf
                    );
            }
            else
            {
                sResult = "";
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(sResult);
        }
コード例 #6
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);
        }