mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2024-09-19 12:18:48 -04:00
Added "%r" placeholder to wrap parts of the path. Wrapped parts will be set recursively. #1123. e.g.: "\%G\%r%P – %T%r\%p – %C.html"
This commit is contained in:
parent
174b92cbb0
commit
54dcf39981
1 changed files with 19 additions and 2 deletions
|
@ -153,8 +153,23 @@ public partial class ExportRequest
|
||||||
Channel channel,
|
Channel channel,
|
||||||
Snowflake? after,
|
Snowflake? after,
|
||||||
Snowflake? before
|
Snowflake? before
|
||||||
) =>
|
)
|
||||||
Regex.Replace(
|
{
|
||||||
|
var recursivePattern = Regex.Match(path, "%r(%.*)%r");
|
||||||
|
if (
|
||||||
|
channel.Parent?.Parent != null
|
||||||
|
&& recursivePattern.Success
|
||||||
|
&& recursivePattern.Groups.Count > 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
var groupValue = recursivePattern.Groups[1].Value;
|
||||||
|
path = path.Replace(
|
||||||
|
recursivePattern.Value,
|
||||||
|
FormatPath(groupValue, guild, channel.Parent, after, before)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Regex.Replace(
|
||||||
path,
|
path,
|
||||||
"%.",
|
"%.",
|
||||||
m =>
|
m =>
|
||||||
|
@ -187,10 +202,12 @@ public partial class ExportRequest
|
||||||
.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
|
.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
|
||||||
|
|
||||||
"%%" => "%",
|
"%%" => "%",
|
||||||
|
"%r" => string.Empty,
|
||||||
_ => m.Value
|
_ => m.Value
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetOutputBaseFilePath(
|
private static string GetOutputBaseFilePath(
|
||||||
Guild guild,
|
Guild guild,
|
||||||
|
|
Loading…
Reference in a new issue