private IList LoadFileInfo() { GameServer server = ServerDropDownList.SelectedGameServer; string fileInfoString = string.Empty; int tryTimes = 0; while (fileInfoString == string.Empty) { //10秒超时 ++tryTimes; if (tryTimes == 10) { break; } System.Threading.Thread.Sleep(1000); fileInfoString = server.GetPlugInData(CurrentUser.Id, GameServerControl.PlugInGuid, GameServerControl.DataKeyUploadDirInfo) as string; } if (fileInfoString == string.Empty) { //获取文件列表失败 LabelOpMsg.Text = StringDef.OperationFail; return(null); } ArrayList fileList = new ArrayList(); if (fileInfoString != null && fileInfoString.Length != 0) { string[] fileInfo = fileInfoString.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int index = 1; index != fileInfo.Length; ++index) { if (fileInfo[index].Length == 0) { continue; } try { GuardFile file = new GuardFile(); string[] fileUnits = fileInfo[index].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); file.attribute = fileUnits[0]; file.fileSize = fileUnits[2]; file.modifideTime = fileUnits[3] + ' ' + fileUnits[4] + ' ' + fileUnits[5]; //文件名有空格的情况 for (int nameIndex = 6; nameIndex < fileUnits.Length; ++nameIndex) { file.fileName += fileUnits[nameIndex] + ' '; } file.fileName = file.fileName.Substring(0, file.fileName.Length - 1); fileList.Add(file); } catch (Exception) { continue; } } } return(fileList); }
private IList LoadFileInfo() { GameServer server = ServerDropDownList.SelectedGameServer; string fileInfoString = string.Empty; int tryTimes = 0; while(fileInfoString == string.Empty) { //10秒超时 ++tryTimes; if (tryTimes == 10) break; System.Threading.Thread.Sleep(1000); fileInfoString = server.GetPlugInData(CurrentUser.Id, GameServerControl.PlugInGuid, GameServerControl.DataKeyUploadDirInfo) as string; } if (fileInfoString == string.Empty) { //获取文件列表失败 LabelOpMsg.Text = StringDef.OperationFail; return null; } ArrayList fileList = new ArrayList(); if (fileInfoString != null && fileInfoString.Length!=0) { string[] fileInfo = fileInfoString.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int index = 1;index!=fileInfo.Length;++index) { if (fileInfo[index].Length == 0) continue; try { GuardFile file = new GuardFile(); string[] fileUnits = fileInfo[index].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); file.attribute = fileUnits[0]; file.fileSize = fileUnits[2]; file.modifideTime = fileUnits[3] + ' ' + fileUnits[4] + ' ' + fileUnits[5]; //文件名有空格的情况 for (int nameIndex = 6; nameIndex < fileUnits.Length; ++nameIndex) file.fileName += fileUnits[nameIndex]+' '; file.fileName = file.fileName.Substring(0, file.fileName.Length - 1); fileList.Add(file); } catch (Exception) { continue; } } } return fileList; }