mirror of
https://github.com/zs-yg/MCSJ.git
synced 2025-12-06 19:00:43 +08:00
Compare commits
10 Commits
v0.0.3
...
ddc6aa4e95
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddc6aa4e95 | ||
|
|
487212c6eb | ||
|
|
b0cd76dbc1 | ||
|
|
73c32eac51 | ||
|
|
3350b1798e | ||
|
|
ddc0d1d9e0 | ||
|
|
adaa360265 | ||
|
|
e2219d5042 | ||
|
|
8982aa9bcc | ||
|
|
0b6f66304b |
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
bin/
|
||||
obj/
|
||||
logs/
|
||||
profiles/
|
||||
14
Program.cs
14
Program.cs
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MCSJ.Tools;
|
||||
using MCSJ.Tools.LogSystem;
|
||||
|
||||
namespace MCSJ
|
||||
{
|
||||
@@ -8,8 +9,15 @@ namespace MCSJ
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
// 验证日志目录
|
||||
string logDir = LogCreator.GetLogDirectory();
|
||||
Console.WriteLine($"日志目录: {logDir}");
|
||||
LogMain.Debug($"日志文件: {LogCreator.GetLogFilePath()}");
|
||||
|
||||
LogMain.Info("MC服务器下载工具启动");
|
||||
var versionManager = new VersionManager();
|
||||
var downloadService = new DownloadService(versionManager);
|
||||
LogMain.Debug("服务初始化完成");
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -20,21 +28,27 @@ namespace MCSJ
|
||||
Console.Write("请选择操作: ");
|
||||
|
||||
var input = Console.ReadLine();
|
||||
LogMain.Debug($"用户选择操作: {input}");
|
||||
|
||||
switch (input)
|
||||
{
|
||||
case "1":
|
||||
versionManager.DisplayAllVersions();
|
||||
LogMain.Info("显示所有版本列表");
|
||||
break;
|
||||
case "2":
|
||||
Console.Write("请输入要下载的版本名称: ");
|
||||
var version = Console.ReadLine();
|
||||
LogMain.Info($"开始下载版本: {version}");
|
||||
await downloadService.DownloadVersion(version);
|
||||
LogMain.Info($"版本下载完成: {version}");
|
||||
break;
|
||||
case "3":
|
||||
LogMain.Info("程序正常退出");
|
||||
return;
|
||||
default:
|
||||
Console.WriteLine("无效输入,请重新选择");
|
||||
LogMain.Warn($"无效的用户输入: {input}");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,11 +43,17 @@ MCSJ 项目由 [zs-yg](https://github.com/zs-yg) 开发,欢迎提交 issue 和
|
||||
|
||||
qq群:1043867176
|
||||
|
||||
[b站号]:(https://space.bilibili.com/1698250734)
|
||||
b站号:https://space.bilibili.com/1698250734
|
||||
|
||||
|
||||
## 开源协议
|
||||
|
||||
MIT协议
|
||||
本项目已在 GitHub 开源,欢迎贡献代码与建议。
|
||||
|
||||
# 恰饭awa
|
||||
|
||||
不用捐款,使用这个链接注册服务器就行了awa
|
||||
性能不错,可以免费白嫖
|
||||
|
||||
服务器:https://www.rainyun.com/Nzk2NDEy_
|
||||
|
||||
29
Tools/log_systeam/log_creator.cs
Normal file
29
Tools/log_systeam/log_creator.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MCSJ.Tools.LogSystem
|
||||
{
|
||||
public static class LogCreator
|
||||
{
|
||||
public static string GenerateLogFileName()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
return $"{now:yyyy-MM-dd-HH-mm-ss}.log";
|
||||
}
|
||||
|
||||
public static string GetLogDirectory()
|
||||
{
|
||||
string logDir = Path.Combine(Directory.GetCurrentDirectory(), "logs");
|
||||
if (!Directory.Exists(logDir))
|
||||
{
|
||||
Directory.CreateDirectory(logDir);
|
||||
}
|
||||
return logDir;
|
||||
}
|
||||
|
||||
public static string GetLogFilePath()
|
||||
{
|
||||
return Path.Combine(GetLogDirectory(), GenerateLogFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Tools/log_systeam/log_main.cs
Normal file
37
Tools/log_systeam/log_main.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace MCSJ.Tools.LogSystem
|
||||
{
|
||||
public static class LogMain
|
||||
{
|
||||
private static readonly object _lock = new object();
|
||||
|
||||
public enum LogLevel
|
||||
{
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARN,
|
||||
ERROR,
|
||||
FATAL
|
||||
}
|
||||
|
||||
public static void Log(LogLevel level, string message)
|
||||
{
|
||||
string logEntry = $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] [{level}] {message}";
|
||||
string logPath = LogCreator.GetLogFilePath();
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
File.AppendAllText(logPath, logEntry + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Debug(string message) => Log(LogLevel.DEBUG, message);
|
||||
public static void Info(string message) => Log(LogLevel.INFO, message);
|
||||
public static void Warn(string message) => Log(LogLevel.WARN, message);
|
||||
public static void Error(string message) => Log(LogLevel.ERROR, message);
|
||||
public static void Fatal(string message) => Log(LogLevel.FATAL, message);
|
||||
}
|
||||
}
|
||||
7
build.bat
Normal file
7
build.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
dotnet publish MCSJ.csproj -c Release -r win-x86 --self-contained false /p:Optimize=true /p:DebugType=None
|
||||
dotnet publish MCSJ.csproj -c Release -r win-x64 --self-contained false /p:Optimize=true /p:DebugType=None
|
||||
cd bin\Release\net8.0
|
||||
ren win-x64 MCSJ-x64
|
||||
ren win-x86 MCSJ-x86
|
||||
rmdir /s /q MCSJ-x64\publish
|
||||
rmdir /s /q MCSJ-x86\publish
|
||||
5
resources/jrelist.txt
Normal file
5
resources/jrelist.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
jre8:https://pan.tenire.com/down.php/2dd2a856cdb549dce5b557026e20b36a.zip
|
||||
jre11:https://pan.tenire.com/down.php/3ec613e667f35e364d921aeb0315272a.zip
|
||||
jre17:https://pan.tenire.com/down.php/f28009799fca1c62f4c37a5ab4759db3.zip
|
||||
jre21:https://pan.tenire.com/down.php/253e308ecfce3be809f2e85d6513791d.zip
|
||||
jre25:https://pan.tenire.com/down.php/e3ae0f146ce3fa1d27a805f86b138058.zip
|
||||
@@ -1,3 +1,7 @@
|
||||
25w46a:https://piston-data.mojang.com/v1/objects/e61a72ec98fae895ef3e80b05269ae343c42fc0b/server.jar
|
||||
25w45a:https://piston-data.mojang.com/v1/objects/4c0fe96ca002d7049226a740194c8d7114bd5059/server.jar
|
||||
25w44a:https://piston-data.mojang.com/v1/objects/1ade1ebd6affbfed6dbfb2ce8864cf19efed07ba/server.jar
|
||||
25w43a:https://piston-data.mojang.com/v1/objects/dac322a1091905430e2a6ade129a4915552455d0/server.jar
|
||||
25w42a:https://piston-data.mojang.com/v1/objects/d9c6cfd4ba84f5080206259d2563f75796f14470/server.jar
|
||||
25w41a:https://piston-data.mojang.com/v1/objects/804aefaf397b417479e89144834e277ebde2ce71/server.jar
|
||||
1.21.10:https://piston-data.mojang.com/v1/objects/95495a7f485eedd84ce928cef5e223b757d2f764/server.jar
|
||||
@@ -735,8 +739,8 @@
|
||||
13w38b:https://launcher.mojang.com/v1/objects/82588f79a6a61c4c4289a9dc60b7b7b3fedaead9/server.jar
|
||||
13w38a:https://launcher.mojang.com/v1/objects/627585cdb9386e7f05cdfb8f092e5a303d4fd5f3/server.jar
|
||||
1.6.4:https://launcher.mojang.com/v1/objects/050f93c1f3fe9e2052398f7bd6aca10c63d64a87/server.jar
|
||||
1.6.3:https://launcher.mojang.com/v1/objects/5a4c69bdf7c4a9aa9580096805d8497ba7721e05/server.jar
|
||||
13w37b:https://launcher.mojang.com/v1/objects/f6322a6791bbeabac94cbaa1cf9b779ad88b120f/server.jar
|
||||
1.6.3:https://launcher.mojang.com/v1/objects/5a4c69bdf7c4a9aa9580096805d8497ba7721e05/server.jar
|
||||
13w37a:https://launcher.mojang.com/v1/objects/c3d3d936394b35f20b871b140f5a8e6079822e51/server.jar
|
||||
13w36b:https://launcher.mojang.com/v1/objects/2b6cdcd2df82ca8f04c1c2c7d77faf4cd25151ea/server.jar
|
||||
13w36a:https://launcher.mojang.com/v1/objects/8453f031175bac1a92db000befd14f70c8df8fb7/server.jar
|
||||
@@ -765,8 +769,8 @@
|
||||
1.5.1:https://launcher.mojang.com/v1/objects/d07c71ee2767dabb79fb32dad8162e1b854d5324/server.jar
|
||||
1.5:https://launcher.mojang.com/v1/objects/aedad5159ef56d69c5bcf77ed141f53430af43c3/server.jar
|
||||
1.4.7:https://launcher.mojang.com/v1/objects/2f0ec8efddd2f2c674c77be9ddb370b727dec676/server.jar
|
||||
1.4.6:https://launcher.mojang.com/v1/objects/a0aeb5709af5f2c3058c1cf0dc6b110a7a61278c/server.jar
|
||||
1.4.5:https://launcher.mojang.com/v1/objects/c12fd88a8233d2c517dbc8196ba2ae855f4d36ea/server.jar
|
||||
1.4.6:https://launcher.mojang.com/v1/objects/a0aeb5709af5f2c3058c1cf0dc6b110a7a61278c/server.jar
|
||||
1.4.4:https://launcher.mojang.com/v1/objects/4215dcadb706508bf9d6d64209a0080b9cee9e71/server.jar
|
||||
1.4.3:https://launcher.mojang.com/v1/objects/9be68adf6e80721975df12f2445fa24617328d18/server.jar
|
||||
1.4.2:https://launcher.mojang.com/v1/objects/5be700523a729bb78ef99206fb480a63dcd09825/server.jar
|
||||
|
||||
Reference in New Issue
Block a user