EggEgg.CSharp-ProtoParser 1.1.0-beta51

This is a prerelease version of EggEgg.CSharp-ProtoParser.
dotnet add package EggEgg.CSharp-ProtoParser --version 1.1.0-beta51
NuGet\Install-Package EggEgg.CSharp-ProtoParser -Version 1.1.0-beta51
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="EggEgg.CSharp-ProtoParser" Version="1.1.0-beta51" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EggEgg.CSharp-ProtoParser --version 1.1.0-beta51
#r "nuget: EggEgg.CSharp-ProtoParser, 1.1.0-beta51"
#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.
// Install EggEgg.CSharp-ProtoParser as a Cake Addin
#addin nuget:?package=EggEgg.CSharp-ProtoParser&version=1.1.0-beta51&prerelease

// Install EggEgg.CSharp-ProtoParser as a Cake Tool
#tool nuget:?package=EggEgg.CSharp-ProtoParser&version=1.1.0-beta51&prerelease

csharp-protoparser

csharp-protoparser is a .proto file parser compatiable with go-protoparser.

NuGet

Changelog

v1.1.0

  • Fixed the issue whereby arm64 CPU arch devices are accidentally recognized as x64 CPU arch.
  • Fixed the issue whereby using multiple versions of this nuget on the same device may conflict with each other.

Usage

Simple:

using YYHEggEgg.ProtoParser;
using YYHEggEgg.ProtoParser.RawProtoHandler;

string protoText = @"<Fill in with a .proto file content>";
// Very simple parse.
ProtoJsonResult parseres = await ProtoParser.ParseFromTextAsync(protoText);

var files = new string[] { "file1.proto", "file2.proto" };
var filesParsed = await ProtoParser.ParseFromFilesAsync(files);
// The key of dictionary is the FULL PATH of the provided file(s)
// The value of dictionary is ProtoJsonResult
Console.WriteLine(JsonSerializer.Serialize(filesParsed["D:\\test\\protos\\file1.proto"]));

// Or you can let the input be a directory's all .proto files:
var dir = "test/protos";
// Returns a similar dictionary as below.
var dirParsed = await ProtoParser.ParseFromDirectoryAsync(dir);

// You may want to output content to directory, not memory:
await ProtoParser.ParseFromDirectoryAsync(dir, "Proto2json_Output");
// But you need to process them yourself.
var dirParsedOne = ProtoJsonRawDataAnalyzer.AnalyzeRawProto(
    JsonSerializer.Deserialize<Proto>(File.ReadAllText("D:\\Proto2json_Output\\file1.proto.json"))
    // If needed, add param: 'ProtoContext.Default.Proto' to Deserialize to make it Aot compatiable (.NET 8.0+ only)
);

// Or you may dislike ProtoJsonResult; it's OK to use the original data structure from go-protoparser.
// Just add 'AsRaw' to methods' name.
Proto unorderedProto = await ProtoParser.ParseFromTextAsRawAsync(protoText);

// There're syncronous methods; but it's recommended to use asyncronous ones.
Proto unorderedProto2 = ProtoParser.ParseFromTextAsRaw(protoText);

Principle

The package simply packs built go-proto2json inside, and extract the program from the embedded resources to a temp path when needed.

The package will check whether the program's SHA256 is correct before every run, so don't need to worry potential errors. By the way, invoke less times of methods (e.g. using ParseFromFilesAsync with a file list instead of individual ParseFromTextAsync calls) can make the performance better!

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0-beta51 2 4/6/2024
1.1.0-beta50 1 3/6/2024
1.0.0-rc54 1 2/26/2024
1.0.0-rc53 1 2/26/2024
1.0.0-rc52 0 2/25/2024
1.0.0-dev03 1 2/22/2024
1.0.0-dev02 0 2/22/2024
1.0.0-dev01 1 2/22/2024
1.0.0-beta51 0 2/25/2024
1.0.0-beta50 1 2/23/2024

csharp-protoparser is a .proto file parser compatiable with go-protoparser.