Skip to content
This repository was archived by the owner on Jan 27, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Confuser.Core/ConfuserEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ static void EndModule(ConfuserContext context) {
else {
output = context.CurrentModule.Name;
}
var belongsToSubFolder = context.Annotations.Get<string>(context.CurrentModule, Marker.SubDirKey);
if(!String.IsNullOrWhiteSpace(belongsToSubFolder))
{
output = Path.Combine(Path.GetDirectoryName(output), belongsToSubFolder, Path.GetFileName(output));
}
context.OutputPaths[context.CurrentModuleIndex] = output;
}

Expand Down
6 changes: 6 additions & 0 deletions Confuser.Core/Marker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public class Marker {
/// </summary>
public static readonly object RulesKey = new object();

/// <summary>
/// Annotation key of subdirectories.
/// </summary>
public static readonly object SubDirKey = new object();

/// <summary>
/// The packers available to use.
/// </summary>
Expand Down Expand Up @@ -136,6 +141,7 @@ protected internal virtual MarkerResult MarkProject(ConfuserProject proj, Confus

context.Annotations.Set(module.Item2, SNKey, LoadSNKey(context, module.Item1.SNKeyPath == null ? null : Path.Combine(proj.BaseDirectory, module.Item1.SNKeyPath), module.Item1.SNKeyPassword));
context.Annotations.Set(module.Item2, RulesKey, rules);
context.Annotations.Set(module.Item2, SubDirKey, module.Item1.BelongsToSubFolder);

foreach (IDnlibDef def in module.Item2.FindDefinitions()) {
ApplyRules(context, def, rules);
Expand Down
1 change: 1 addition & 0 deletions Confuser.Core/Project/ConfuserPrj.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<xs:attribute name="external" type="xs:boolean" default="false" />
<xs:attribute name="snKey" type="xs:string" use="optional" />
<xs:attribute name="snKeyPass" type="xs:string" use="optional" />
<xs:attribute name="belongsToSubFolder" type="xs:string" use="optional" />
</xs:complexType>


Expand Down
15 changes: 15 additions & 0 deletions Confuser.Core/Project/ConfuserProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public ProjectModule() {
/// <value>The password of the strong name private key, or null if not necessary.</value>
public string SNKeyPassword { get; set; }

/// <summary>
/// Gets or sets the subfolder into which the resulting obfuscated file should be placed.
/// </summary>
public string BelongsToSubFolder { get; set; }

/// <summary>
/// Gets a list of protection rules applies to the module.
/// </summary>
Expand Down Expand Up @@ -102,6 +107,11 @@ internal XmlElement Save(XmlDocument xmlDoc) {
snKeyPassAttr.Value = SNKeyPassword;
elem.Attributes.Append(snKeyPassAttr);
}
if (BelongsToSubFolder != null) {
XmlAttribute toSubFolderAttr = xmlDoc.CreateAttribute("belongsToSubFolder");
toSubFolderAttr.Value = BelongsToSubFolder;
elem.Attributes.Append(toSubFolderAttr);
}


foreach (Rule i in Rules)
Expand Down Expand Up @@ -132,6 +142,11 @@ internal void Load(XmlElement elem) {
else
SNKeyPassword = null;

if (elem.Attributes["belongsToSubFolder"] != null)
BelongsToSubFolder = elem.Attributes["belongsToSubFolder"].Value.NullIfEmpty();
else
BelongsToSubFolder = null;

Rules.Clear();
foreach (XmlElement i in elem.ChildNodes.OfType<XmlElement>()) {
var rule = new Rule();
Expand Down