protected string BuildLongReply(string [] asFiles) { string sDirectory = GetPath(""); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); for (int nIndex = 0; nIndex < asFiles.Length; nIndex++) { string sFile = asFiles[nIndex]; sFile = Path.Combine(sDirectory, sFile); FileSystem.IFileInfo info = ConnectionObject.FileSystemObject.GetFileInfo(sFile); if (info != null) { string sAttributes = info.GetAttributeString(); stringBuilder.Append(sAttributes); stringBuilder.Append(" 1 owner group"); if (info.IsDirectory()) { stringBuilder.Append(" 1 "); } else { string sFileSize = info.GetSize().ToString(); stringBuilder.Append(General.TextHelpers.RightAlignString(sFileSize, 13, ' ')); stringBuilder.Append(" "); } System.DateTime fileDate = info.GetModifiedTime(); string sDay = fileDate.Day.ToString(); stringBuilder.Append(General.TextHelpers.Month(fileDate.Month)); stringBuilder.Append(" "); if (sDay.Length == 1) { stringBuilder.Append(" "); } stringBuilder.Append(sDay); stringBuilder.Append(" "); stringBuilder.Append(string.Format("{0:hh}", fileDate)); stringBuilder.Append(":"); stringBuilder.Append(string.Format("{0:mm}", fileDate)); stringBuilder.Append(" "); stringBuilder.Append(asFiles[nIndex]); stringBuilder.Append("\r\n"); } } return(stringBuilder.ToString()); }
protected override string OnProcess(string sMessage) { string sFile = GetPath(sMessage); ConnectionObject.FileToRename = sFile; FileSystem.IFileInfo info = ConnectionObject.FileSystemObject.GetFileInfo(sFile); if (info == null) { return(GetMessage(550, string.Format("File does not exist ({0}).", sFile))); } ConnectionObject.RenameDirectory = info.IsDirectory(); return(GetMessage(350, string.Format("Rename file started ({0}).", sFile))); }
protected override Task <string> OnProcess(string sMessage) { string sPath = GetPath(sMessage); if (!ConnectionObject.FileSystemObject.FileExists(sPath)) { return(GetMessage(550, string.Format("File doesn't exist ({0})", sPath))); } FileSystem.IFileInfo info = ConnectionObject.FileSystemObject.GetFileInfo(sPath); if (info == null) { return(GetMessage(550, "Error in getting file information")); } return(GetMessage(220, info.GetSize().ToString())); }