UtilityPack.FileManager
1.1.0
See the version list below for details.
dotnet add package UtilityPack.FileManager --version 1.1.0
NuGet\Install-Package UtilityPack.FileManager -Version 1.1.0
<PackageReference Include="UtilityPack.FileManager" Version="1.1.0" />
paket add UtilityPack.FileManager --version 1.1.0
#r "nuget: UtilityPack.FileManager, 1.1.0"
// Install UtilityPack.FileManager as a Cake Addin #addin nuget:?package=UtilityPack.FileManager&version=1.1.0 // Install UtilityPack.FileManager as a Cake Tool #tool nuget:?package=UtilityPack.FileManager&version=1.1.0
FileManager
This package offer different static classes to manage data across file types, it currently support:
- Writing and Reading CSV
- Writing and Reading INI
- Reading Windows Registry
Class CsvManager
Property
delimiter : public string
Delimiter used to separate columns in the csv files. (Deafault 😉culture : public CultureInfo
Culture to write csv filescreateFolders : public bool
If true create every unexisting directory when passing a csv path. (Deafault true)
Methods
Read< T >(string path) : List< T >
Create a list of values reading them from a csv fileWrite< T >(string path, List< T > prodotti) : string
Write a list of instance to a csv fileWrite< T, M >(string path, List< T > prodotti) : string
Write a list of instance to a csv file, with a specific class map to define specific behaviour
Example
// Change settings
CsvManager.delimiter = ",";
// Define and create an instance to rappresent a csv row
class Item
{
public string Name;
public int Age;
}
List<Item> list = new();
// Read the csv content from file and create a list
list = CsvManager.Read<Item>("C:\example.csv");
// Modify the list and save it back as csv
list.RemoveAt(0);
CsvManager.Write<Item>("C:\example.csv", list);
Class IniManager
Property
printErrors : public bool
If true print errors, when a file is not found or a section or key are missingforceWrite : public bool
If true create section and key when they are not found during writing
Methods
Read< T >(string filePath, string section, string key, T defaul) : T
Read a value from a file ini, if some error occours return the default value passed insteadWrite(string filePath, string section, string key, object value) : bool
Read a value from a file ini, if some error occours return the default value passed instead
Example
// Change settings
IniManager.forceWrite = true;
// Read a value from a specific ini section and key
int value = IniManager.Read<int>("C:\example.ini", "admin", "login", 0);
// Modify the value and save it back as ini
value += 1
IniManager.Write("C:\example.ini", "admin", "login", value);
Class RegistryManager
Methods
- Read(RegistryHive root, string key, string subKey) : string
Read a value from a specific section of the registry
Example
// Read a value from a key of the registry
string value = RegistryManager.Read(RegistryHive.LocalMachine, "admin", "login");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- CsvHelper (>= 27.2.1)
- ini-parser-netstandard (>= 2.5.2)
- Microsoft.Win32.Registry (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.