Skip to content

Commit 64272fa

Browse files
committed
Update example code
1 parent ecebb05 commit 64272fa

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Example.cs

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Immutable;
3+
using System.Text;
34
using System.Xml;
45

56
namespace Schneegans.Unattend;
@@ -16,7 +17,7 @@ Configuration.Default with
1617
ImageLanguage: generator.Lookup<ImageLanguage>("en-US"),
1718
LocaleAndKeyboard: new LocaleAndKeyboard(
1819
generator.Lookup<UserLocale>("en-US"),
19-
generator.Lookup<KeyboardIdentifier>("0409:00000409")
20+
generator.Lookup<KeyboardIdentifier>("00000409")
2021
),
2122
LocaleAndKeyboard2: null,
2223
LocaleAndKeyboard3: null,
@@ -30,11 +31,16 @@ Configuration.Default with
3031
),
3132
}
3233
);
33-
using XmlWriter writer = XmlWriter.Create(Console.Out, new XmlWriterSettings()
34+
35+
string path = Environment.ExpandEnvironmentVariables(@"%TEMP%\autounattend.xml");
36+
using var writer = XmlWriter.Create(path, new XmlWriterSettings()
3437
{
35-
CloseOutput = false,
38+
Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
39+
CloseOutput = true,
3640
Indent = true,
41+
IndentChars = "\t",
42+
NewLineChars = "\r\n",
3743
});
38-
xml.WriteTo(writer);
44+
xml.Save(writer);
3945
}
4046
}

0 commit comments

Comments
 (0)