ModelingDebug/Program.cs

126 lines
3.8 KiB
C#
Raw Normal View History

2024-08-25 09:55:05 +00:00

using System.Diagnostics;
using System.Runtime.InteropServices;
2024-08-25 23:51:27 +00:00
using System.Text;
2024-08-25 09:55:05 +00:00
using Debug.ModelingMusic;
namespace Debug;
/// <summary>
/// 主程序入口 参考 https://blog.csdn.net/oscar999/article/details/141370223
/// 在VS Code的终端中使用dotnet build命令来编译项目。这将在项目目录中生成一个bin文件夹其中包含编译后的程序集。
/// 使用dotnet run命令来运行项目。这将编译项目如果尚未编译并运行编译后的程序。
/// </summary>
public class Program
{
public static void printf(object a)
{
Console.Write(a);
}
public static void printfLine(object a)
{
Console.WriteLine(a);
}
[DllImport("kernel32.dll")]
private static extern bool SetConsoleTitle(string title);
//开始计时
public static void Main(string[] args)
{
// 设置控制台标题为一个独特的字符串
SetConsoleTitle("Tools");
2024-08-25 23:51:27 +00:00
// 设置控制台输出编码,以支持复杂字符
Console.OutputEncoding = Encoding.UTF8;
2024-08-25 09:55:05 +00:00
_ = new Program();
}
2024-08-25 23:51:27 +00:00
2024-08-25 23:58:04 +00:00
//Y,X
public static readonly Point[,] chars = new Point[10, 50];
2024-08-25 23:51:27 +00:00
public static bool IsWhile = true;
2024-08-25 23:58:04 +00:00
public static char ShowChar = ' ';
2024-08-25 09:55:05 +00:00
public Program()
{
2024-08-25 23:51:27 +00:00
// new Thread(MusicDebug.MusicRhythm).Start();
// return;
// new Debug.MinLong.KongLong();
// return;
2024-08-25 23:58:04 +00:00
Console.Clear();
int y = 0;
printfLine("请选择你要执行的操作:");
// printfLine(" 0.退出 ");
// printfLine(" 1.抽拉 ");
// printfLine(" 2.铁锈位置搜索引擎 ");
// printfLine(" 3.音乐调试 ");
// printfLine(" 4.小龙快跑 ");
string[] str = ["0 退出", "1 抽卡", "2 铁锈位置搜索引擎", "3 音乐调试", "4 小龙快跑"];
for (int i = 0; i < str.Length; i++)
{
printfLine(str[i]);
}
Console.SetCursorPosition(0, y);
2024-08-25 09:55:05 +00:00
do
{
Console.WriteLine();
2024-08-25 23:58:04 +00:00
var v = Console.ReadKey(true);
switch (v.Key)
2024-08-25 09:55:05 +00:00
{
2024-08-25 23:58:04 +00:00
case ConsoleKey.UpArrow:
//设置光标位置
y = y == 0 ? y : y - 1;
break;
case ConsoleKey.DownArrow:
y = y + 1 == str.Length ? y : y + 1;
break;
case ConsoleKey.Enter:
switch (y)
{
case 0:
Environment.Exit(0);
break;
case 1:
_ = new ChouKa();
break;
case 2:
_ = new Mod();
break;
case 3:
_ = new Music();
return;
default:
printfLine("还没有这个功能");
break;
}
break;
}
// Console.WriteLine(v.Key);
Console.SetCursorPosition(0, y);
// {
} while (true);
}
public static void KeyEndThread()
{
new Thread(() =>
{
while (IsWhile)
{
ConsoleKeyInfo consoleKeyInfo = Console.ReadKey(true);
if (consoleKeyInfo.Key == ConsoleKey.Escape)
2024-08-25 09:55:05 +00:00
{
2024-08-25 23:58:04 +00:00
IsWhile = false;
Thread.Sleep(500);
Console.Clear();
Environment.Exit(0);
return;
2024-08-25 09:55:05 +00:00
}
2024-08-25 23:58:04 +00:00
Thread.Sleep(500);
2024-08-25 09:55:05 +00:00
}
2024-08-25 23:58:04 +00:00
// 等待用户按下任意键后退出
}).Start();
2024-08-25 09:55:05 +00:00
}
}