ATRC 1.2.1

Additional Details

Latest version 1.3.1 has inserting, if there is no use for such thing this version should do just fine

There is a newer version of this package available.
See the version list below for details.
dotnet add package ATRC --version 1.2.1
                    
NuGet\Install-Package ATRC -Version 1.2.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="ATRC" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ATRC" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="ATRC" />
                    
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 ATRC --version 1.2.1
                    
#r "nuget: ATRC, 1.2.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.
#:package ATRC@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ATRC&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=ATRC&version=1.2.1
                    
Install as a Cake Tool

ATRC resource file library made with C#

Uses dotnet 8.0, works on linux, windows and propably macos


Build nupkg: .\ATRC\BuildNupkg.bat

Run test project .\ATRC.TEST\Run.bat

Usage in c#

using ATRC;
namespace Test
{
    public class Program
    {

        private static ATRC.Filehandler.ATRCFileData fileData = new(); // This will contain the file data
        
        static void Main(string[] args)
        {
            fileData.Read("file.atrc"); // Read and parse file.atrc
            fileData.AddBlock("test"); // Create new block
            fileData.AddKey("test", "test_key", "my_value"); // Create new key to test-block with my_value as its value
            string[] test_array = {"my", "values"};
            fileData.AddKey("test", "array_key", test_array); // Create new array key

            // Read both keys
            string contents_1 = fileData.S_ReadKey("test", "test_key"); // Read string key
            string[] contents_2 = fileData.A_ReadKey("test", "array_key"); // Read array key
    
            // Create new variable if it does not exist
            if(!fileData.VariableExists("system32_path")){
                fileData.AddVariable("system32_path", "C:\\Windows\\System32");
            }

            // Remove array and test_key
            fileData.RemoveKey("test", "array_key");
            fileData.ModifyKey("test", "test_key", "%system32_path%\\explorer.exe");

            // Move key to other location
            fileData.AddBlock("WinShell");
            fileData.MoveKey("test", "WinShell", "test_key");

            Console.WriteLine(fileData.S_ReadKey("WinApps", "test_key")); // -> C:\Windows\System32\notepad.exe
            /*
            file.atrc ->
            %system32_path%=C:\Windows\System32
            [WinApps]
            test_key=%system32_path%\notepad.exe
            */
        }
    }
}

Usage in .atrc

! whitespaces are kept after = sign, if you want to add whitespace use & and everything is case-sensitive
! create a new block with []
! variable, key or block names can't contain: !, %, & or ,
! variables are constants
%variable%=value
<%private_variable%=private_value!This can't be accessed be modified or read outside the file

[blockname]
key1=value
variable_list=%variable%, %private_variable%! when reading this, csharp will show {"value", " private_value"}

whitespace = hello 
whitespace2 = hello&
! Key would be 'whitespace' and its key ' hello' 
! If you want to include !, %, &, or , in your value, use \
reserved_characters=this\, is \&\% reserved\!

ATRCFileData methods:

  • AddBlock → Adds given block

  • RemoveBlock → Removes given block

  • BlockExists → Check if block exists

  • AddVariable → Adds given variable with its value

  • A_ReadVariable → Reads list variable, returning contents in a string[]

  • S_ReadVariable → Reads variable, returning contents in a string

  • ModifyVariable → Modify given variable with given value

  • RemoveVariable → Removes given variable

  • VariableExists → Checks whether variable exists

  • IsPrivateVariable-> Checks if variable is private

  • AddKey → Adds key to the given block

  • A_ReadKey → Reads list key, returning its contents in a string[]

  • S_ReadKey → Reads key, returning its contents in a string

  • ModifyKey → Modifies given key with the given value

  • RemoveKey → Remove the given key from given block

  • MoveKey → Move key from source to destination

  • KeyExists → Checks whether the key exists

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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.