126 lines
3.8 KiB
C#
126 lines
3.8 KiB
C#
|
||
|
||
using System.Diagnostics;
|
||
using System.Runtime.InteropServices;
|
||
using System.Text;
|
||
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");
|
||
// 设置控制台输出编码,以支持复杂字符
|
||
Console.OutputEncoding = Encoding.UTF8;
|
||
|
||
_ = new Program();
|
||
}
|
||
|
||
//Y,X
|
||
public static readonly Point[,] chars = new Point[10, 50];
|
||
public static bool IsWhile = true;
|
||
|
||
public static char ShowChar = ' ';
|
||
|
||
public Program()
|
||
{
|
||
// new Thread(MusicDebug.MusicRhythm).Start();
|
||
// return;
|
||
|
||
// new Debug.MinLong.KongLong();
|
||
// return;
|
||
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);
|
||
do
|
||
{
|
||
Console.WriteLine();
|
||
var v = Console.ReadKey(true);
|
||
switch (v.Key)
|
||
{
|
||
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)
|
||
{
|
||
IsWhile = false;
|
||
Thread.Sleep(500);
|
||
Console.Clear();
|
||
Environment.Exit(0);
|
||
return;
|
||
}
|
||
Thread.Sleep(500);
|
||
}
|
||
// 等待用户按下任意键后退出
|
||
}).Start();
|
||
}
|
||
} |