//──────────────────────────────────────── /// <summary> /// パスを設定します。 /// </summary> /// <param name="folderRel_New">フォルダーのパス。</param> /// <param name="fileBoth_Newhumaninput">ファイルの相対パス、または絶対パス。</param> public static Expr_Filepath Init2( string folderRel_New, string fileBoth_Newhumaninput, string confName, Conf_String cParent_OrNull, Log_Reports log_Reports ) { // ツール設定ファイルへのパスは固定とします。 Expr_Filepath eFileRel = null; { Conf_Filepath cFileRel = new Conf_FilepathImpl(confName, cParent_OrNull); // #コンフィグ作成 cFileRel.Init1( folderRel_New, fileBoth_Newhumaninput, log_Reports); if (log_Reports.Successful) { eFileRel = new Expr_FilepathImpl(cFileRel); } } return(eFileRel); }
//──────────────────────────────────────── /// <summary> /// E_Elm属性。 /// </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 Expr_Filepath out_eResult, string sName, EnumHitcount hits, Log_Reports log_Reports ) { return(this.Attributes.TrySelect_ExpressionFilepath( out out_eResult, sName, hits, log_Reports)); }
//──────────────────────────────────────── /// <summary> /// 属性。 /// </summary> /// <param name="out_E_Result">検索結果。</param> /// <param name="name"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelectAttribute_ExpressionFilepath( out Expr_Filepath eResult_Out, string name, EnumHitcount hits, Log_Reports log_Reports ) { // 使いません。 eResult_Out = Expr_FilepathImpl.Init2( "", "", name, this.Conf, log_Reports ); return(false); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// フォルダー絶対パスを指定すると、そのフォルダーパスを切り落とした文字列を返します。 /// /// 違うフォルダーだった場合、失敗します。 /// /// 先頭がディレクトリー区切り文字にならないようにして結果を返します。 /// </summary> /// <param name="folerpath"></param> public void TryCutFolderpath( out string out_Filepath_New, Expr_Filepath folderpath, bool isRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TryCutFolderpath", log_Reports); //まず、自分の絶対パス string my = this.Lv4Execute_OnImplement(EnumHitcount.Unconstraint, log_Reports); //if(log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("my=[" + my + "]"); //} //指定されたフォルダーの絶対パス string you = folderpath.Lv4Execute_OnImplement(EnumHitcount.Unconstraint, log_Reports); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("you=[" + you + "]"); //} //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("my.StartsWith(you)=[" + my.StartsWith(you) + "]"); //} if (my.StartsWith(you)) { out_Filepath_New = my.Substring(you.Length); //if (log_Method.CanDebug(1)) //{ // log_Method.WriteDebug_ToConsole("you.Length=[" + you.Length + "]"); // log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1 + "]"); // log_Method.WriteDebug_ToConsole("filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())=[" + filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) + "]"); // if (filepath_New1.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) // { // log_Method.WriteDebug_ToConsole("filepath_New1=[" + filepath_New1.Substring(1) + "]"); // } //} // 先頭がディレクトリー区切り文字だった場合、それを切り捨てます。 if (out_Filepath_New.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { out_Filepath_New = out_Filepath_New.Substring(1); } //Conf_Filepath filepath_Conf_New = new Conf_FilepathImpl(log_Method.Fullname, null); //filepath_Conf_New.I nitPath(filepath_New1, log_Reports); //out_Filepath_ExprNew = new Expression_Node_FilepathImpl(filepath_Conf_New); } else { //失敗 out_Filepath_New = ""; if (isRequired) { // エラー。 goto gt_Error_Failure; } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_Failure: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー922!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("ファイルパスの加工に失敗しました。\n"); s.Append("[" + my + "]の頭から、フォルダー[" + you + "]を切りぬこうとしましたが、フォルダーが違いました。"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 指定のフィールド名だけに絞り込んだサブテーブルを作って返します。 /// </summary> /// <param name="sFieldNameList"></param> /// <returns></returns> public static Table_Humaninput CreateSubTableBySelect( string name_NewTable, List <string> list_Src_SNewFieldName, Expr_Filepath expr_Fpath_NewTable, EnumLogic enumWhereLogic, List <Recordcondition> list_Reccond, Table_Humaninput src_XenonTable, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "CreateSubTableBySelect", log_Reports); // // // // Table_Humaninput tableH_New = new Table_HumaninputImpl( name_NewTable, expr_Fpath_NewTable, expr_Fpath_NewTable.Conf); RecordFielddef recordFielddefinigion_New; List <List <string> > sFieldListList; Utility_Table.SelectFieldListList( out sFieldListList, out recordFielddefinigion_New, enumWhereLogic, list_Src_SNewFieldName, list_Reccond, src_XenonTable, log_Reports ); // // 新しいテーブルを作成します。(列定義の追加) // tableH_New.CreateTable(recordFielddefinigion_New, log_Reports); if (tableH_New.DataTable.Columns.Count < 1) { // エラー。 goto gt_Error_ZeroField; } else if (tableH_New.RecordFielddef.Count < 1) { // エラー。 goto gt_Error_ZeroFieldDef; } // 不要なレコードを除去して絞り込んだ後で、 // レコード追加。 { tableH_New.AddRecordList(sFieldListList, recordFielddefinigion_New, log_Reports); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_ZeroField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー471!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append(" フィールドが0件のテーブルを作ることはできません。newFldDefList=["); t.Append(recordFielddefinigion_New.Count); t.Append("]"); t.Newline(); t.Newline(); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_ZeroFieldDef: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー472!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append(" フィールド定義が0件のテーブルを作ることはできません。o_NewTable.FieldDefinitions.Count=["); t.Append(tableH_New.RecordFielddef.Count); t.Append("]"); t.Newline(); t.Newline(); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(tableH_New); }
/// <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 Expr_Filepath out_eFliepath, 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.TrySelect2(out value, name_Attribute, hits, log_Reports); out_eFliepath = Expr_FilepathImpl.Init2( "", value, log_Method.Fullname, null, log_Reports ); //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); }