57 lines
1.2 KiB
C#
57 lines
1.2 KiB
C#
using System;
|
|
using System.Text;
|
|
|
|
namespace Microsoft.Win32
|
|
{
|
|
// Token: 0x02000079 RID: 121
|
|
internal class ExpandString
|
|
{
|
|
// Token: 0x06000734 RID: 1844 RVA: 0x00015EBC File Offset: 0x000140BC
|
|
public ExpandString(string s)
|
|
{
|
|
this.value = s;
|
|
}
|
|
|
|
// Token: 0x06000735 RID: 1845 RVA: 0x00015ECC File Offset: 0x000140CC
|
|
public override string ToString()
|
|
{
|
|
return this.value;
|
|
}
|
|
|
|
// Token: 0x06000736 RID: 1846 RVA: 0x00015ED4 File Offset: 0x000140D4
|
|
public string Expand()
|
|
{
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
for (int i = 0; i < this.value.Length; i++)
|
|
{
|
|
if (this.value[i] == '%')
|
|
{
|
|
int j;
|
|
for (j = i + 1; j < this.value.Length; j++)
|
|
{
|
|
if (this.value[j] == '%')
|
|
{
|
|
string text = this.value.Substring(i + 1, j - i - 1);
|
|
stringBuilder.Append(Environment.GetEnvironmentVariable(text));
|
|
i += j;
|
|
break;
|
|
}
|
|
}
|
|
if (j == this.value.Length)
|
|
{
|
|
stringBuilder.Append('%');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
stringBuilder.Append(this.value[i]);
|
|
}
|
|
}
|
|
return stringBuilder.ToString();
|
|
}
|
|
|
|
// Token: 0x04000101 RID: 257
|
|
private string value;
|
|
}
|
|
}
|