Skip to content

Commit 09a6796

Browse files
committed
Merge branch 'hotfix-log4j'
2 parents 1cf3d0f + 0f55035 commit 09a6796

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

CmlLib/CmlLib.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
55
<LangVersion>8.0</LangVersion>
66
<Nullable>enable</Nullable>
7-
<Version>3.3.4</Version>
7+
<Version>3.3.5</Version>
88
<Description>Minecraft Launcher Library for .NET
99
Support all version, forge, optifine
1010
</Description>

CmlLib/Core/Installer/MForge.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ private bool checkProcessorOutputs(JObject outputs, Dictionary<string, string> m
285285
{
286286
foreach (var outitem in outputs)
287287
{
288-
var key = Mapper.Interpolation(outitem.Key, mapData);
289-
var value = Mapper.Interpolation(outitem.Value.ToString(), mapData);
288+
var key = Mapper.Interpolation(outitem.Key, mapData, true);
289+
var value = Mapper.Interpolation(outitem.Value.ToString(), mapData, true);
290290

291291
if (!File.Exists(key) || !IOUtil.CheckSHA1(key, value))
292292
return false;

CmlLib/Core/Launcher/MLaunch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public string[] CreateArg()
147147
args.Add(Mapper.Interpolation(version.LoggingClient?.Argument, new Dictionary<string, string?>()
148148
{
149149
{ "path", minecraftPath.GetLogConfigFilePath(version.LoggingClient?.Id ?? version.Id) }
150-
}));
150+
}, true));
151151

152152
// main class
153153
if (!string.IsNullOrEmpty(version.MainClass))

CmlLib/Core/Mapper.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public static string[] Map(string[] arg, Dictionary<string, string?> dicts, stri
1616
var args = new List<string>(arg.Length);
1717
foreach (string item in arg)
1818
{
19-
var a = Interpolation(item, dicts);
19+
var a = Interpolation(item, dicts, false);
2020
if (checkPath)
2121
a = ToFullPath(a, prepath);
22-
args.Add(handleEArg(a));
22+
args.Add(HandleEmptyArg(a));
2323
}
2424

2525
return args.ToArray();
@@ -30,8 +30,8 @@ public static string[] MapInterpolation(string[] arg, Dictionary<string, string?
3030
var args = new List<string>(arg.Length);
3131
foreach (string item in arg)
3232
{
33-
var a = Interpolation(item, dicts);
34-
args.Add(handleEArg(a));
33+
var a = Interpolation(item, dicts, true);
34+
args.Add(a);
3535
}
3636

3737
return args.ToArray();
@@ -43,15 +43,15 @@ public static string[] MapPathString(string[] arg, string prepath)
4343
foreach (string item in arg)
4444
{
4545
var a = ToFullPath(item, prepath);
46-
args.Add(handleEArg(a));
46+
args.Add(HandleEmptyArg(a));
4747
}
4848

4949
return args.ToArray();
5050
}
5151

52-
public static string Interpolation(string str, Dictionary<string, string?> dicts)
52+
public static string Interpolation(string str, Dictionary<string, string?> dicts, bool handleEmpty)
5353
{
54-
str = argBracket.Replace(str, new MatchEvaluator((match =>
54+
str = argBracket.Replace(str, (match =>
5555
{
5656
if (match.Groups.Count < 2)
5757
return match.Value;
@@ -66,9 +66,12 @@ public static string Interpolation(string str, Dictionary<string, string?> dicts
6666
}
6767

6868
return match.Value;
69-
})));
69+
}));
7070

71-
return str;
71+
if (handleEmpty)
72+
return HandleEmptyArg(str);
73+
else
74+
return str;
7275
}
7376

7477
public static string ToFullPath(string str, string prepath)
@@ -114,7 +117,7 @@ static string replaceByPos(StringBuilder sb, string replace, int startIndex, int
114117
// key="va l" => key="va l"
115118
// va lue => "va lue"
116119
// "va lue" => "va lue"
117-
static string handleEArg(string input)
120+
public static string HandleEmptyArg(string input)
118121
{
119122
if (input.Contains("="))
120123
{

0 commit comments

Comments
 (0)