Skip to content

Commit

Permalink
fix encoding null issue #82
Browse files Browse the repository at this point in the history
  • Loading branch information
UlyssesWu committed Jun 9, 2022
1 parent 75a54c3 commit 134e3d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion FreeMote.PsBuild/PsbCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace FreeMote.PsBuild
/// </summary>
public static class PsbCompiler
{
public static Encoding Encoding { get; set; } = null;
public static Encoding Encoding { get; set; } = Encoding.UTF8;

/// <summary>
/// Compile to file
Expand Down
5 changes: 4 additions & 1 deletion FreeMote.Tools.PsBuild/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ PsBuild link -o Order sample.psb tex000.png tex001.bmp
try
{
_encoding = Encoding.GetEncoding(optEncoding.ParsedValue);
PsbCompiler.Encoding = _encoding;
}
catch (ArgumentException e)
{
Expand Down Expand Up @@ -134,6 +135,7 @@ PsBuild port -p win sample.psb
try
{
_encoding = Encoding.GetEncoding(optEncoding.ParsedValue);
PsbCompiler.Encoding = _encoding;
}
catch (ArgumentException e)
{
Expand Down Expand Up @@ -217,6 +219,7 @@ PsBuild port -p win sample.psb
try
{
_encoding = Encoding.GetEncoding(optEncoding.ParsedValue);
PsbCompiler.Encoding = _encoding;
}
catch (ArgumentException e)
{
Expand Down Expand Up @@ -273,6 +276,7 @@ PsBuild replace sample.psb sample.json
try
{
_encoding = Encoding.GetEncoding(optEncoding.ParsedValue);
PsbCompiler.Encoding = _encoding;
}
catch (ArgumentException e)
{
Expand Down Expand Up @@ -387,7 +391,6 @@ private static void Compile(string s, ushort? version, uint? key, PsbSpec? spec,
Console.WriteLine($"Compiling {name} ...");
try
{
PsbCompiler.Encoding = _encoding;
//var filename = name + (_key == null ? _noRename ? ".psb" : "-pure.psb" : "-impure.psb");
var filename = name + ".psb"; //rename later //TODO: support set output path
PsbCompiler.CompileToFile(s, filename, null, version, key, spec, canRename, canPackShell);
Expand Down

0 comments on commit 134e3d2

Please sign in to comment.