private void ReadData() { string[] files = Directory.GetFiles(Environment.CurrentDirectory + "\\data", "*.*", SearchOption.AllDirectories); var fileList = new List <string>(files); if (fileList.BinarySearch(Environment.CurrentDirectory + "\\data\\config.ini") < 0) { FileStream fs = new FileStream(Environment.CurrentDirectory + "\\data\\config.ini", FileMode.Create); StreamWriter sw = new StreamWriter(fs); sw.Write("//请使用英文逗号隔开选手ID" + "[Match]\r\n" + "Stage = 小组赛\r\n" + "Time = 2019-7-22 19:43\r\n" + "[Blue]\r\n" + "Name = UNITED KINGDOM\r\n" + "Player = Bubbleman,Doomsday\r\n" + "[Red]\r\n" + "Name = UNITED STATES\r\n" + "Player = Apraxia,Toy\r\n" ); sw.Flush(); sw.Close(); fs.Close(); } fileList.ForEach(file => { if (file.ToLower().EndsWith("match.png")) { Constant.MatchLogo = LoadImage(file); } if (file.ToLower().EndsWith("red_logo.png")) { Constant.RedLogo = LoadImage(file); } if (file.ToLower().EndsWith("blue_logo.png")) { Constant.BlueLogo = LoadImage(file); } if (file.ToLower().EndsWith("schedule.png")) { Constant.Schedule = LoadImage(file); } if (file.ToLower().EndsWith("xls") || file.ToLower().EndsWith("xlsx")) { Constant.MapPoolSet = Mp5MapPoolReadUtil.Read(file); } }); Constant.Stage = IniUtil.ReadIniData("Match", "Stage"); Constant.Time = IniUtil.ReadIniData("Match", "Time"); Constant.BlueTeamName = (IniUtil.ReadIniData("Blue", "Name")); Constant.RedTeamName = (IniUtil.ReadIniData("Red", "Name")); Constant.BluePlayers = (IniUtil.ReadIniData("Blue", "Player")); Constant.RedPlayers = (IniUtil.ReadIniData("Red", "Player")); //根据图池表格中的谱面ID读取子文件夹下的图片文件 fileList.ForEach(file => { Constant.MapPoolSet.Pool.ForEach( pool => { pool.Map.ForEach( map => { if (file.ToLower().EndsWith(map.BeatmapId + ".png")) { Constant.BgImages.Add(map.BeatmapId, LoadImage(file)); } } ); } ); } ); }