using System.Diagnostics; using System.Net; using System.Runtime.InteropServices; using System.Text; using Debug.ModelingMusic; namespace Debug; /// /// 主程序入口 参考 https://blog.csdn.net/oscar999/article/details/141370223 /// 在VS Code的终端中,使用dotnet build命令来编译项目。这将在项目目录中生成一个bin文件夹,其中包含编译后的程序集。 /// 使用dotnet run命令来运行项目。这将编译项目(如果尚未编译)并运行编译后的程序。 /// public class Program { public static void printf(object a) { Console.Write(a); } public static void printfLine(object a) { Console.WriteLine(a); } //开始计时 public static void Main(string[] args) { Console.Title = "Tools";//设置窗口标题 // 设置控制台输出编码,以支持复杂字符 Console.OutputEncoding = Encoding.UTF8; Console.Clear(); Console.CursorVisible = false; _ = new Program(); } //Y,X public static readonly Point[,] chars = new Point[10, 50]; public static bool IsWhile = true; public const char ShowChar = ' '; public static Random random = new(); public Program() { Console.Clear(); string[] str = ["退出", "抽卡", "搜索引擎", "下落字符", "小龙快跑", "贪吃蛇"]; var modeSwitch = new ModeSwitch("<--- 请选择你要执行的操作 --->", str, (a) => { switch (a) { case 0: Environment.Exit(0); break; case 1: _ = new ChouKa();//抽卡 break; case 2: _ = new Mod(); break; case 3: _ = new Music(); break; case 4: _ = new MinLong.Main(); break; case 5: _ = new Tanchishe.Main(); break; default: printfLine("还没有这个功能"); break; } }); } 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(); } /// /// 监听键盘事件 注意不要把此方法嵌套在循环里面 /// /// public static void KeyEnd(Action action) { ConsoleKeyInfo consoleKeyInfo = Console.ReadKey(true); action.Invoke(consoleKeyInfo); // 等待用户按下任意键后退出 } public static void ResetChars() { for (int i = 0; i < Program.chars.GetLength(0); i++) { for (int j = 0; j < Program.chars.GetLength(1); j++) { Program.chars[i, j] = new ModelingMusic.Point(); } } } }