Skip to content

Commit

Permalink
Fixed unchecked problem and plugin issues
Browse files Browse the repository at this point in the history
  • Loading branch information
heinermann committed Oct 9, 2022
1 parent d31e9f0 commit 6d4eb0e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ValheimExportHelper/FixCodeFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ private string FixEvents(string file)
return Regex.Replace(file, EventRegex, @"$1;", RegexOptions.Multiline);
}

const string UncheckedRegex = @"override int GetHashCode\(\)\r?\n\s+\{\r?\n\s+return ";
const string UncheckedRegex = @"(override int GetHashCode\(\)\r?\n\s+\{\r?\n\s+return) \(";
private string FixUncheckedHashCode(string file)
{
return Regex.Replace(file, UncheckedRegex, @"$0 unchecked ", RegexOptions.Multiline);
return Regex.Replace(file, UncheckedRegex, @"$1 unchecked (", RegexOptions.Multiline);
}

private void FixupFile(string filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ValheimExportHelper
{
class FixSteam : PostExporterEx
class FixPlugins : PostExporterEx
{
PlatformGameStructure GameStructure { get; set; }

Expand All @@ -25,12 +25,25 @@ private void CopyAppId()

private void CopyPlugins()
{
string dstPath = Path.Join(CurrentRipper.Settings.AssetsPath, "Plugins", "x86_64");
string pluginsPath = Path.Join(GameStructure.GameDataPath, "Plugins");
string dstPath = Path.Join(CurrentRipper.Settings.AssetsPath, "Plugins");

// Recreate subdirectory tree
Directory.CreateDirectory(dstPath);

string srcFilename = Path.Join(GameStructure.GameDataPath, "Plugins", "x86_64", "steam_api64.dll");
string dstFilename = Path.Join(dstPath, "steam_api64.dll");
File.Copy(srcFilename, dstFilename, overwrite: true);
var directories = Directory.GetDirectories(pluginsPath, "*", SearchOption.AllDirectories);
foreach (string dir in directories)
{
string dirToCreate = dir.Replace(pluginsPath, dstPath);
Directory.CreateDirectory(dirToCreate);
}

// Copy all files recursively
var pluginFiles = Directory.EnumerateFiles(pluginsPath, "*.*", SearchOption.AllDirectories);
foreach (var pluginFile in pluginFiles)
{
string dstFile = pluginFile.Replace(pluginsPath, dstPath);
File.Copy(pluginFile, dstFile, overwrite: true);
}
}
}
}
2 changes: 1 addition & 1 deletion ValheimExportHelper/ValheimExportHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void OnFinishExporting()
new AddPostProcessingPackage(),
new FixCodeFiles(),
new FixCursor(),
new FixSteam(),
new FixPlugins(),
new FixUnityProjectSettings(),
new FixWAVs(),
new RenameExportDir() // THIS MUST BE LAST
Expand Down

0 comments on commit 6d4eb0e

Please sign in to comment.