Esempio n. 1
0
        JsonResult IDriver.GetReceivedMailFiles(Guid fileGroupSendId)
        {
            List <OperationFile> operationFiles;

            try
            {
                Guid receivedFileGroupId = service.FileGroupReceive(fileGroupSendId, token);
                operationFiles = service.GetFileGroupFiles(receivedFileGroupId, token);
            }
            catch (Exception ex)
            {
                return(Error.Message(ex.Message));
            }

            List <ReceivedFile> files = new List <ReceivedFile>();

            foreach (OperationFile operationFile in operationFiles)
            {
                ReceivedFile file    = new ReceivedFile();
                DirInfo      dirInfo = client.GetInfo(operationFile.FileUri);
                if (dirInfo == null)
                {
                    throw new ElFinderFileNotExists();
                }
                string ext = Path.GetExtension(dirInfo.DisplayName);
                file.name = dirInfo.DisplayName;
                file.mime = string.IsNullOrEmpty(ext) ? "unknown" : Helper.GetMimeType(ext.ToLower().Substring(1));
                file.path = HttpUtility.UrlDecode(dirInfo.RelPath);
                DateTime.TryParse(dirInfo.LastModified, out file.lastChange);
                if (ext == ".enc")
                {
                    string name = dirInfo.DisplayName.Substring(0, dirInfo.DisplayName.LastIndexOf(".", System.StringComparison.Ordinal));
                    string ext2 = Path.GetExtension(name);
                    if (ext2 == ".sig")
                    {
                        file.Type = OperationType.DecryptSignverify;
                    }
                    else
                    {
                        file.Type = OperationType.Decrypt;
                    }
                }
                else if (ext == ".sig")
                {
                    file.Type = OperationType.SignVerify;
                }
                files.Add(file);
            }

            return(Json(new { Files = files }));
        }