Removed WebServer
This commit is contained in:
-18
@@ -1,18 +0,0 @@
|
|||||||
if ($args[0] -ieq "/?" -or $args[1] -ieq "/?") { Write-Host "Usage: ./Compile [/B] [/A]`n`n /B`t`tCompiles WebServer for release.`n /A`t`tCreates/updates zip archives in Output folder."; exit 0 }
|
|
||||||
if ($args[0] -ieq "/B" -or $args[1] -ieq "/B")
|
|
||||||
{
|
|
||||||
Set-Location .\WebServer
|
|
||||||
dotnet publish -r win-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:TrimMode=link -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true
|
|
||||||
dotnet publish -r linux-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:TrimMode=link -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true
|
|
||||||
dotnet publish -r osx-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:TrimMode=link -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true
|
|
||||||
Set-Location ..
|
|
||||||
}
|
|
||||||
xcopy "$PSScriptRoot\WebServer\bin\Release\net9.0\win-x64\publish" "$PSScriptRoot\Output\Windows\" /Y
|
|
||||||
xcopy "$PSScriptRoot\Game" "$PSScriptRoot\Output\Windows\Game\" /Y /S
|
|
||||||
if ($args[0] -ieq "/A" -or $args[1] -ieq "/A") { Compress-Archive "$PSScriptRoot\Output\Windows\" "$PSScriptRoot\Output\Windows.zip" -Force }
|
|
||||||
xcopy "$PSScriptRoot\WebServer\bin\Release\net9.0\linux-x64\publish" "$PSScriptRoot\Output\Linux\" /Y
|
|
||||||
xcopy "$PSScriptRoot\Game" "$PSScriptRoot\Output\Linux\Game\" /Y /S
|
|
||||||
if ($args[0] -ieq "/A" -or $args[1] -ieq "/A") { Compress-Archive "$PSScriptRoot\Output\Linux\" "$PSScriptRoot\Output\Linux.zip" -Force }
|
|
||||||
xcopy "$PSScriptRoot\WebServer\bin\Release\net9.0\osx-x64\publish" "$PSScriptRoot\Output\MacOS\" /Y
|
|
||||||
xcopy "$PSScriptRoot\Game" "$PSScriptRoot\Output\MacOS\Game\" /Y /S
|
|
||||||
if ($args[0] -ieq "/A" -or $args[1] -ieq "/A") { Compress-Archive "$PSScriptRoot\Output\MacOS\" "$PSScriptRoot\Output\MacOS.zip" -Force }
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2025 retr0volkov
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
|
||||||
<RootNamespace>AE</RootNamespace>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.3.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.8" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.FileProviders;
|
|
||||||
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static async Task Main()
|
|
||||||
{
|
|
||||||
string url = "http://localhost:80";
|
|
||||||
string game = "";
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
game = "\\Game\\";
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
{
|
|
||||||
game = "/Game/";
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
||||||
{
|
|
||||||
game = "/Game/";
|
|
||||||
}
|
|
||||||
string contentRoot = Directory.GetCurrentDirectory() + game;
|
|
||||||
Console.WriteLine(contentRoot);
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder();
|
|
||||||
builder.Services.AddDirectoryBrowser();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
app.UseDefaultFiles(new DefaultFilesOptions
|
|
||||||
{
|
|
||||||
DefaultFileNames = new[] { "index.html" },
|
|
||||||
FileProvider = new PhysicalFileProvider(contentRoot),
|
|
||||||
});
|
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
|
||||||
{
|
|
||||||
FileProvider = new PhysicalFileProvider(contentRoot),
|
|
||||||
RequestPath = ""
|
|
||||||
});
|
|
||||||
app.UseDirectoryBrowser(new DirectoryBrowserOptions
|
|
||||||
{
|
|
||||||
FileProvider = new PhysicalFileProvider(contentRoot)
|
|
||||||
});
|
|
||||||
|
|
||||||
var serverTask = app.RunAsync(url);
|
|
||||||
|
|
||||||
await Task.Delay(2000);
|
|
||||||
OpenBrowser("http://localhost/");
|
|
||||||
|
|
||||||
await serverTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void OpenBrowser(string url)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Process.Start(new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = url,
|
|
||||||
UseShellExecute = true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Failed to open browser: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user