Skip to content

Commit

Permalink
Update decompiler submodule and settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
ElektroKill committed Dec 24, 2023
1 parent 8881ad9 commit a5d4e65
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 71 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,39 @@
<data name="DecompilerSettings_AddUsingDeclarations" xml:space="preserve">
<value>Add using declarations</value>
</data>
<data name="DecompilerSettings_AggressiveInlining" xml:space="preserve">
<value>Always inline local variables if possible</value>
</data>
<data name="DecompilerSettings_AllowFieldInitializers" xml:space="preserve">
<value>Allow field initializers</value>
</data>
<data name="DecompilerSettings_AlwaysCastTargetsOfExplicitInterfaceImplementationCalls" xml:space="preserve">
<value>Always cast targets of explicit interface implementation calls</value>
</data>
<data name="DecompilerSettings_AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject" xml:space="preserve">
<value>Always generate exception variables in catch blocks unless type is Object</value>
</data>
<data name="DecompilerSettings_AlwaysQualifyMemberReferences" xml:space="preserve">
<value>Always qualify member references</value>
</data>
<data name="DecompilerSettings_AlwaysShowEnumMemberValues" xml:space="preserve">
<value>Always show enum member values</value>
</data>
<data name="DecompilerSettings_AlwaysUseBraces" xml:space="preserve">
<value>Always use braces</value>
</data>
<data name="DecompilerSettings_AlwaysUseGlobal" xml:space="preserve">
<value>Always fully qualify namespaces using the "global::" prefix</value>
</data>
<data name="DecompilerSettings_CodeStyle" xml:space="preserve">
<value>Code style</value>
</data>
<data name="DecompilerSettings_DecompilerBehavior" xml:space="preserve">
<value>Decompiler behavior</value>
</data>
<data name="DecompilerSettings_MemberOrderingAndSorting" xml:space="preserve">
<value>Member ordering and sorting</value>
</data>
<data name="DecompilerSettings_DecompilationOrder" xml:space="preserve">
<value>Decompilation order</value>
</data>
Expand Down Expand Up @@ -177,6 +204,9 @@
<data name="DecompilerSettings_SparseIntegerSwitch" xml:space="preserve">
<value>Detect switch on integer even if IL code does not use a jump table</value>
</data>
<data name="DecompilerSettings_SeparateLocalVariableDeclarations" xml:space="preserve">
<value>Separate local variable declarations and initializers (int x = 5; -&gt; int x; x = 5;), if possible</value>
</data>
<data name="DecompilerSettings_ArrayInitializerExpressions" xml:space="preserve">
<value>Array initializer expressions</value>
</data>
Expand Down Expand Up @@ -363,6 +393,12 @@
<data name="DecompilerSettings_OneCustomAttributePerLine" xml:space="preserve">
<value>Show one custom attribute per line</value>
</data>
<data name="DecompilerSettings_RemoveDeadCode" xml:space="preserve">
<value>Remove dead and side effect free code (use with caution!)</value>
</data>
<data name="DecompilerSettings_RemoveDeadStores" xml:space="preserve">
<value>Remove dead stores (use with caution!)</value>
</data>
<data name="DecompilerSettings_RemoveEmptyDefaultCtors" xml:space="preserve">
<value>Remove empty default constructors</value>
</data>
Expand Down Expand Up @@ -396,6 +432,9 @@
<data name="DecompilerSettings_SortSystemFirst" xml:space="preserve">
<value>Place 'System' directives first when sorting usings</value>
</data>
<data name="DecompilerSettings_SortSwitchCasesByILOffset" xml:space="preserve">
<value>Sort switch cases by IL instruction offset</value>
</data>
<data name="DecompilerSettings_TypeAddInternalModifier" xml:space="preserve">
<value>Add 'internal' modifier to types</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ IEnumerable<IDecompilerOption> CreateOptions() {
Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_DecompileQueryExpr,
Name = DecompilerOptionConstants.QueryExpressions_NAME,
};
// yield return new DecompilerOption<bool>(DecompilerOptionConstants.FullyQualifyAmbiguousTypeNames_GUID,
// () => decompilerSettings.FullyQualifyAmbiguousTypeNames, a => decompilerSettings.FullyQualifyAmbiguousTypeNames = a) {
// Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_FullyQualifyAmbiguousTypeNames,
// Name = DecompilerOptionConstants.FullyQualifyAmbiguousTypeNames_NAME,
// };
// yield return new DecompilerOption<bool>(DecompilerOptionConstants.FullyQualifyAllTypes_GUID,
// () => decompilerSettings.FullyQualifyAllTypes, a => decompilerSettings.FullyQualifyAllTypes = a) {
// Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_FullyQualifyAllTypes,
// Name = DecompilerOptionConstants.FullyQualifyAllTypes_NAME,
// };
yield return new DecompilerOption<bool>(DecompilerOptionConstants.FullyQualifyAmbiguousTypeNames_GUID,
() => decompilerSettings.FullyQualifyAmbiguousTypeNames, a => decompilerSettings.FullyQualifyAmbiguousTypeNames = a) {
Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_FullyQualifyAmbiguousTypeNames,
Name = DecompilerOptionConstants.FullyQualifyAmbiguousTypeNames_NAME,
};
yield return new DecompilerOption<bool>(DecompilerOptionConstants.FullyQualifyAllTypes_GUID,
() => decompilerSettings.FullyQualifyAllTypes, a => decompilerSettings.FullyQualifyAllTypes = a) {
Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_FullyQualifyAllTypes,
Name = DecompilerOptionConstants.FullyQualifyAllTypes_NAME,
};
yield return new DecompilerOption<bool>(DecompilerOptionConstants.UseDebugSymbols_GUID,
() => decompilerSettings.UseDebugSymbols, a => decompilerSettings.UseDebugSymbols = a) {
Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_UseLocalNameFromSyms,
Expand Down Expand Up @@ -155,11 +155,11 @@ IEnumerable<IDecompilerOption> CreateOptions() {
Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_MakeAssignmentExpressions,
Name = DecompilerOptionConstants.MakeAssignmentExpressions_NAME,
};
// yield return new DecompilerOption<bool>(DecompilerOptionConstants.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject_GUID,
// () => decompilerSettings.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject, a => decompilerSettings.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject = a) {
// Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject,
// Name = DecompilerOptionConstants.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject_NAME,
// };
yield return new DecompilerOption<bool>(DecompilerOptionConstants.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject_GUID,
() => decompilerSettings.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject, a => decompilerSettings.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject = a) {
Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject,
Name = DecompilerOptionConstants.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject_NAME,
};
yield return new DecompilerOption<bool>(DecompilerOptionConstants.ShowTokenAndRvaComments_GUID,
() => decompilerSettings.ShowTokenAndRvaComments, a => decompilerSettings.ShowTokenAndRvaComments = a) {
Description = dnSpy_Decompiler_ILSpy_Core_Resources.DecompilerSettings_ShowTokensRvasOffsets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ public void OnApply(IAppRefreshSettings appRefreshSettings) {
if (g.HexadecimalNumbers != d.HexadecimalNumbers) flags |= RefreshFlags.CSharp;
if (g.SortSwitchCasesByILOffset != d.SortSwitchCasesByILOffset) flags |= RefreshFlags.ILAst;
if (g.InsertParenthesesForReadability != d.InsertParenthesesForReadability) flags |= RefreshFlags.CSharp;

// if (g.FullyQualifyAmbiguousTypeNames != d.FullyQualifyAmbiguousTypeNames) flags |= RefreshFlags.CSharp;
// if (g.FullyQualifyAllTypes != d.FullyQualifyAllTypes) flags |= RefreshFlags.CSharp;
if (g.FullyQualifyAmbiguousTypeNames != d.FullyQualifyAmbiguousTypeNames) flags |= RefreshFlags.CSharp;
if (g.FullyQualifyAllTypes != d.FullyQualifyAllTypes) flags |= RefreshFlags.CSharp;
if (g.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject != d.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject) flags |= RefreshFlags.CSharp;

if ((flags & RefreshFlags.ShowMember) != 0)
appRefreshSettings.Add(AppSettingsConstants.REFRESH_LANGUAGE_SHOWMEMBER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ sealed class DecompilerSettingsImpl : DecompilerSettings {
HexadecimalNumbers = sect.Attribute<bool?>(nameof(HexadecimalNumbers)) ?? HexadecimalNumbers;
SortSwitchCasesByILOffset = sect.Attribute<bool?>(nameof(SortSwitchCasesByILOffset)) ?? SortSwitchCasesByILOffset;
InsertParenthesesForReadability = sect.Attribute<bool?>(nameof(InsertParenthesesForReadability)) ?? InsertParenthesesForReadability;
FullyQualifyAmbiguousTypeNames = sect.Attribute<bool?>(nameof(FullyQualifyAmbiguousTypeNames)) ?? FullyQualifyAmbiguousTypeNames;
FullyQualifyAllTypes = sect.Attribute<bool?>(nameof(FullyQualifyAllTypes)) ?? FullyQualifyAllTypes;
AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject = sect.Attribute<bool?>(nameof(AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject)) ?? AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject;

//FullyQualifyAmbiguousTypeNames = sect.Attribute<bool?>(nameof(FullyQualifyAmbiguousTypeNames)) ?? FullyQualifyAmbiguousTypeNames;
//FullyQualifyAllTypes = sect.Attribute<bool?>(nameof(FullyQualifyAllTypes)) ?? FullyQualifyAllTypes;
//TODO: CSharpFormattingOptions
disableSave = false;
}
Expand Down Expand Up @@ -277,9 +278,10 @@ protected override void OnModified() {
sect.Attribute(nameof(HexadecimalNumbers), HexadecimalNumbers);
sect.Attribute(nameof(SortSwitchCasesByILOffset), SortSwitchCasesByILOffset);
sect.Attribute(nameof(InsertParenthesesForReadability), InsertParenthesesForReadability);
sect.Attribute(nameof(FullyQualifyAmbiguousTypeNames), FullyQualifyAmbiguousTypeNames);
sect.Attribute(nameof(FullyQualifyAllTypes), FullyQualifyAllTypes);
sect.Attribute(nameof(AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject), AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject);


//sect.Attribute(nameof(FullyQualifyAmbiguousTypeNames), FullyQualifyAmbiguousTypeNames);
//sect.Attribute(nameof(FullyQualifyAllTypes), FullyQualifyAllTypes);
//TODO: CSharpFormattingOptions
}
Expand Down
Loading

0 comments on commit a5d4e65

Please sign in to comment.