mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-25 23:48:13 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
44 lines
1.2 KiB
C#
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 );
|
|
}
|
|
}
|
|
}
|