mirror of https://github.com/Xpl0itR/protodec.git
bugfixes
This commit is contained in:
parent
3fe8077e7f
commit
253983430d
|
@ -6,13 +6,13 @@ using protodec;
|
||||||
|
|
||||||
const string indent = " ";
|
const string indent = " ";
|
||||||
const string help = """
|
const string help = """
|
||||||
Usage: protodec(.exe) [options] <target_assembly_path> <out_path>
|
Usage: protodec(.exe) <target_assembly_path> <out_path> [options]
|
||||||
Options:
|
|
||||||
--skip_enums Skip parsing enums and replace references to then with int32.
|
|
||||||
--include_runtime_assemblies Add the assemblies of the current runtime to the search path.
|
|
||||||
Arguments:
|
Arguments:
|
||||||
target_assembly_path Either a single assembly or a directory of assemblies to be parsed.
|
target_assembly_path Either a single assembly or a directory of assemblies to be parsed.
|
||||||
out_path An existing directory to output into individual files, otherwise output to a single file.
|
out_path An existing directory to output into individual files, otherwise output to a single file.
|
||||||
|
Options:
|
||||||
|
--skip_enums Skip parsing enums and replace references to then with int32.
|
||||||
|
--include_runtime_assemblies Add the assemblies of the current runtime to the search path.
|
||||||
""";
|
""";
|
||||||
|
|
||||||
if (args.Length < 2)
|
if (args.Length < 2)
|
||||||
|
|
11
Protodec.cs
11
Protodec.cs
|
@ -97,9 +97,9 @@ public sealed class Protodec
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ParseMessage(type, skipEnums);
|
ParseMessage(type, skipEnums);
|
||||||
message.Imports.Add(type.Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.Imports.Add(type.Name);
|
||||||
return type.Name;
|
return type.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public sealed class Protodec
|
||||||
?.ConstructorArguments[0]
|
?.ConstructorArguments[0]
|
||||||
.Value
|
.Value
|
||||||
as string
|
as string
|
||||||
?? TranslateEnumFieldName(field.Name);
|
?? TranslateEnumFieldName(enumEnum.Name, field.Name);
|
||||||
|
|
||||||
protoEnum.Fields.Add(enumFieldId, enumFieldName);
|
protoEnum.Fields.Add(enumFieldId, enumFieldName);
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,6 @@ public sealed class Protodec
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message.Imports.Add(protoEnum.Name);
|
|
||||||
Enums.Add(protoEnum.Name, protoEnum);
|
Enums.Add(protoEnum.Name, protoEnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,8 +160,10 @@ public sealed class Protodec
|
||||||
name.IsBeebyted() ? name : name.ToSnakeCaseLower();
|
name.IsBeebyted() ? name : name.ToSnakeCaseLower();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static string TranslateEnumFieldName(string name) =>
|
private static string TranslateEnumFieldName(string enumName, string fieldName) =>
|
||||||
name.IsBeebyted() ? name : name.ToSnakeCaseUpper();
|
enumName.IsBeebyted()
|
||||||
|
? enumName + '_' + fieldName.ToSnakeCaseUpper()
|
||||||
|
: (enumName + fieldName).ToSnakeCaseUpper();
|
||||||
|
|
||||||
private bool TryParseWriteToMethod(Type targetClass)
|
private bool TryParseWriteToMethod(Type targetClass)
|
||||||
{
|
{
|
||||||
|
|
10
README.md
10
README.md
|
@ -5,14 +5,14 @@ A tool to decompile protobuf parser/serializer classes compiled by [protoc](http
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
```
|
```
|
||||||
Usage: protodec(.exe) [options] <target_assembly_path> <out_path>
|
Usage: protodec(.exe) <target_assembly_path> <out_path> [options]
|
||||||
Options:
|
|
||||||
--skip_enums Skip parsing enums and replace references to then with int32.
|
|
||||||
--include_runtime_assemblies Add the assemblies of the current runtime to the search path.
|
|
||||||
Arguments:
|
Arguments:
|
||||||
target_assembly_path Either a single assembly or a directory of assemblies to be parsed.
|
target_assembly_path Either a single assembly or a directory of assemblies to be parsed.
|
||||||
out_path An existing directory to output into individual files, otherwise output to a single file.
|
out_path An existing directory to output into individual files, otherwise output to a single file.
|
||||||
```
|
Options:
|
||||||
|
--skip_enums Skip parsing enums and replace references to then with int32.
|
||||||
|
--include_runtime_assemblies Add the assemblies of the current runtime to the search path.
|
||||||
|
```
|
||||||
|
|
||||||
Limitations
|
Limitations
|
||||||
-----------
|
-----------
|
||||||
|
|
Loading…
Reference in New Issue