private ICollection CreateDataSourceServerFiles(IList fileList) { try { DataTable dataTable = new DataTable(); DataRow dataRow; dataTable.Columns.Add(new DataColumn("Name", typeof(String))); dataTable.Columns.Add(new DataColumn("Size", typeof(String))); dataTable.Columns.Add(new DataColumn("Type", typeof(String))); dataTable.Columns.Add(new DataColumn("Modified", typeof(String))); dataTable.Columns.Add(new DataColumn("Attribute", typeof(String))); dataTable.Columns.Add(new DataColumn("Owner", typeof(String))); if (fileList != null) { foreach (ServerFileInfo info in fileList) { dataRow = dataTable.NewRow(); dataRow[0] = info.Name; dataRow[1] = WebUtil.BetterSizeText(info.Size); dataRow[2] = info.Directory ? StringDef.Directory : StringDef.File; dataRow[3] = info.ModifyTime; dataRow[4] = info.Attribute; dataRow[5] = info.Owner; dataTable.Rows.Add(dataRow); } } dataTable.DefaultView.Sort = "Type, Name"; return(dataTable.DefaultView); } catch (Exception ex) { FSEye.Util.DebugLog(ex.ToString()); return(null); } }
private void ListUploadedFiles() { CheckBoxListUploadedFile.Items.Clear(); FileInfo[] fileInfos; TheAdminServer.ListUploadedFiles(out fileInfos); long totleFileLength = 0; if (fileInfos != null && fileInfos.Length > 0) { LabelUploadedNoFile.Visible = false; foreach (FileInfo fi in fileInfos) { fi.Refresh(); totleFileLength += fi.Length; StringBuilder fileInfoText = new StringBuilder(); fileInfoText.Append(fi.Name); fileInfoText.Append(" "); fileInfoText.AppendFormat("[{0}]", WebUtil.BetterSizeText(fi.Length)); fileInfoText.AppendFormat(" [{0}] ", fi.LastWriteTime); fileInfoText.Append(string.Format("[<a href = 'GameServerHandler.ashx?{0}={1}&{2}={3}' target='_blank'>", WebConfig.ParamOperation, "GetFSEyeFile", WebConfig.ParamFileName, Convert.ToBase64String(Encoding.Default.GetBytes(fi.Name))) + StringDef.Download + "</a>]"); CheckBoxListUploadedFile.Items.Add(new ListItem(fileInfoText.ToString(), fi.Name)); } } else { LabelUploadedNoFile.Visible = true; } string totleFileLengthText = WebUtil.BetterSizeText(totleFileLength); LabelUploadedFilesInfo.Text = String.Format(StringDef.UploadFileDirSummary, fileInfos.Length, totleFileLengthText); }