private string AreFolderName(string str) { if (string.IsNullOrEmpty(str)) { return("文件名为空"); } if (!VirtualFile.AreFileName(str)) { return("文件名不能存在\\/*:?\"<>|"); } return(""); }
private string AreFileName(NewFileDialog newFileDialog) { string str = ""; int size; if (string.IsNullOrEmpty(newFileDialog.FileName)) { str = "文件名为空"; } else if (!VirtualFile.AreFileName(newFileDialog.FileName)) { str = "文件名不能存在\\/*:?\"<>|"; } else if (string.IsNullOrEmpty(newFileDialog.Size)) { str = "文件大小为空"; } else if (!int.TryParse(newFileDialog.Size, out size)) { newFileDialog.Size = ""; str = "输入文件大小不是数字"; } return(str); }