FileAction 1.0.1

dotnet add package FileAction --version 1.0.1
                    
NuGet\Install-Package FileAction -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FileAction" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FileAction" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="FileAction" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FileAction --version 1.0.1
                    
#r "nuget: FileAction, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=FileAction&version=1.0.1
                    
Install FileAction as a Cake Addin
#tool nuget:?package=FileAction&version=1.0.1
                    
Install FileAction as a Cake Tool

FileAction

FileAction クラスは、相対パスを使用してファイルの読み書きを簡単に行うためのユーティリティクラスです。このクラスは、テキストファイルや CSV ファイルの操作をサポートしています。

主な機能

1. 相対パスを絶対パスに変換

  • メソッド名: ConvertFileLink
  • 説明: 実行ファイルからの相対パスを絶対パスに変換します。
  • 引数: currentFilePath (相対パス)
  • 戻り値: 絶対パス

2. ファイルから文字列を読み取る

  • メソッド名: Read
  • 説明: 指定されたファイルから文字列を読み取ります。
  • 引数: currentFilePath (相対パス)
  • 戻り値: ファイルの内容を文字列として返します。

3. ファイルから CSV データを読み取る

  • メソッド名: ReadCSV
  • 説明: 指定された CSV ファイルを読み取り、二次元配列として返します。
  • 引数: currentFilePath (相対パス)
  • 戻り値: CSV データを格納した List<List<string>>

4. ファイルに文字列を書き込む

  • メソッド名: Write
  • 説明: 指定されたファイルに文字列を書き込みます。
  • 引数:
    • currentFilePath (相対パス)
    • writeString (書き込む文字列)
    • fileMode (書き込みモード: FileMode)

5. ファイルに追記する

  • メソッド名: WriteAdd
  • 説明: 指定されたファイルに文字列を追記します。
  • 引数:
    • currentFilePath (相対パス)
    • writeString (追記する文字列)

6. ファイルに上書きする

  • メソッド名: WriteNew
  • 説明: 指定されたファイルに文字列を上書きします。
  • 引数:
    • currentFilePath (相対パス)
    • writeString (上書きする文字列)

7. ファイルの内容を削除する

  • メソッド名: Clear
  • 説明: 指定されたファイルの内容を削除します。
  • 引数: currentFilePath (相対パス)

使用例

ファイルから文字列を読み取る

string content = FileAction.Read("example.txt");
Console.WriteLine(content);

CSV ファイルを読み取る

List<List<string>> csvData = FileAction.ReadCSV("data.csv");
foreach (var row in csvData)
{
    Console.WriteLine(string.Join(", ", row));
}

ファイルに追記する

FileAction.WriteAdd("example.txt", "\n追加のテキスト");

ファイルの内容を削除する

FileAction.Clear("example.txt");

ライセンス

このプロジェクトは GNU General Public License v3.0 の下でライセンスされています。

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 178 4/15/2025
1.0.0 171 4/15/2025