diff --git a/ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml b/ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml index ad3e3b093..492f58104 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml +++ b/ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml @@ -1,7 +1,7 @@ - - - public static string CleanUpDirectoryName(string text) + { + return CleanUpName(text, separateAtDots: false, treatAsFileName: false); + } + + public static string CleanUpPath(string text) { return CleanUpName(text, separateAtDots: true, treatAsFileName: false) .Replace('.', Path.DirectorySeparatorChar); diff --git a/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs b/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs index 23223a805..ba010a45d 100644 --- a/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs +++ b/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs @@ -66,7 +66,10 @@ namespace ICSharpCode.Decompiler.DebugInfo string BuildFileNameFromTypeName(TypeDefinitionHandle handle) { var typeName = handle.GetFullTypeName(reader).TopLevelTypeName; - return Path.Combine(WholeProjectDecompiler.CleanUpDirectoryName(typeName.Namespace), WholeProjectDecompiler.CleanUpFileName(typeName.Name) + ".cs"); + string ns = settings.UseNestedDirectoriesForNamespaces + ? WholeProjectDecompiler.CleanUpPath(typeName.Namespace) + : WholeProjectDecompiler.CleanUpDirectoryName(typeName.Namespace); + return Path.Combine(ns, WholeProjectDecompiler.CleanUpFileName(typeName.Name) + ".cs"); } foreach (var sourceFile in reader.GetTopLevelTypeDefinitions().GroupBy(BuildFileNameFromTypeName)) diff --git a/ICSharpCode.Decompiler/DecompilerSettings.cs b/ICSharpCode.Decompiler/DecompilerSettings.cs index d76921cac..b7888ad30 100644 --- a/ICSharpCode.Decompiler/DecompilerSettings.cs +++ b/ICSharpCode.Decompiler/DecompilerSettings.cs @@ -1777,7 +1777,7 @@ namespace ICSharpCode.Decompiler /// Gets or sets a value indicating whether the new SDK style format /// shall be used for the generated project files. /// - [Category("DecompilerSettings.Other")] + [Category("DecompilerSettings.ProjectExport")] [Description("DecompilerSettings.UseSdkStyleProjectFormat")] public bool UseSdkStyleProjectFormat { get { return useSdkStyleProjectFormat; } @@ -1790,6 +1790,25 @@ namespace ICSharpCode.Decompiler } } + bool useNestedDirectoriesForNamespaces; + + /// + /// Gets/sets whether namespaces and namespace-like identifiers should be split at '.' + /// and each part should produce a new level of nesting in the output directory structure. + /// + [Category("DecompilerSettings.ProjectExport")] + [Description("DecompilerSettings.UseNestedDirectoriesForNamespaces")] + public bool UseNestedDirectoriesForNamespaces { + get { return useNestedDirectoriesForNamespaces; } + set { + if (useNestedDirectoriesForNamespaces != value) + { + useNestedDirectoriesForNamespaces = value; + OnPropertyChanged(); + } + } + } + bool aggressiveScalarReplacementOfAggregates = false; [Category("DecompilerSettings.Other")] diff --git a/ILSpy/Options/MiscSettingsPanel.xaml b/ILSpy/Options/MiscSettingsPanel.xaml index ab5a84a8e..09a9c5485 100644 --- a/ILSpy/Options/MiscSettingsPanel.xaml +++ b/ILSpy/Options/MiscSettingsPanel.xaml @@ -6,9 +6,13 @@ xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> - - - -