Files
sbox-public/engine/Tools/MenuBuild/Program.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

44 lines
1.2 KiB
C#

using Sandbox;
using Sandbox.Tasks;
using System;
using System.IO;
using System.Threading.Tasks;
namespace Facepunch.MenuBuild;
class Program
{
[STAThread]
public static int Main( string[] args )
{
using ( new ToolAppSystem() )
{
var baseProject = Project.AddFromFileBuiltIn( "addons/base/.sbproj" );
Project.AddFromFileBuiltIn( "addons/tools/.sbproj" );
Project.AddFromFileBuiltIn( "editor/ActionGraph/.sbproj" );
Project.AddFromFileBuiltIn( "editor/ShaderGraph/.sbproj" );
Project.AddFromFileBuiltIn( "editor/MovieMaker/.sbproj" );
Project.AddFromFileBuiltIn( "editor/Hammer/.sbproj" );
var menuProject = Project.AddFromFile( "addons/menu/.sbproj" );
SyncContext.RunBlocking( Project.CompileAsync() );
CopyCompilerOutput( baseProject );
CopyCompilerOutput( menuProject );
}
return 0;
}
static void CopyCompilerOutput( Project project )
{
foreach ( var assembly in project.AssemblyFileSystem.FindFile( "", "*.dll", true ) )
{
var bytes = project.AssemblyFileSystem.ReadAllBytes( assembly ).ToArray();
var outputPath = Path.Combine( project.GetRootPath(), assembly );
System.IO.Directory.CreateDirectory( Path.GetDirectoryName( outputPath ) );
System.IO.File.WriteAllBytes( outputPath, bytes );
}
}
}