public bool CheckFileExtension(string[] extensions, File file, SystemInfoMessage infoMessage) { string fileExtension = null; if (SenderIsPep(infoMessage.SystemInfo.Sender)) { fileExtension = Path.GetExtension(file.ShepFile.Name); } else { fileExtension = Path.GetExtension(file.Name); } if (fileExtension == null) { return(false); } foreach (var extension in extensions) { if (fileExtension.Equals(extension, StringComparison.InvariantCultureIgnoreCase)) { return(true); } } return(false); }
public bool FileNameIsCorrect(File file, SystemInfoMessage infoMessage) { if (file == null) { return(false); } if (SenderIsPep(infoMessage.SystemInfo.Sender)) { if (file.ShepFile == null || !CheckFileNameCorrect(file.ShepFile.Name)) { return(false); } } else { if (file.Content == null || !CheckFileNameCorrect(file.Name)) { return(false); } } return(true); }
public bool FileIsEmpty(File file, SystemInfoMessage infoMessage) { if (file == null) { return(true); } if (SenderIsPep(infoMessage.SystemInfo.Sender)) { if (string.IsNullOrEmpty(file.ShepFile?.ID)) { return(true); } } else { if (file.Content == null || file.Content.Length == 0) { return(true); } } return(false); }