Beispiel #1
0
	    private void CopyLargeAttachmentsImpl()
	    {
			try
			{
				foreach (var attachment in Request.Attachments)
				{
					Utilities.LargeAttachmentHelper helper = new Utilities.LargeAttachmentHelper(attachment.FileName);
					if (helper.IsLargeAttachment)
					{
						// Copy the original file the user selected using 'Add Large Attachment' to 
						// the tmp location of the '.wsl' file.	                
						// Use the same file name as the '.wsl' file but remove the '.wsl' extension. 
						// We could use the value of 'helper.ActualPath' but the file name could be to 
						// long for the tmp location.
						string displayName = Path.GetFileNameWithoutExtension(attachment.FileName);
						string path = Path.GetDirectoryName(attachment.FileName);
						string fileName = System.IO.Path.Combine(path, displayName);
						Copy(helper.ActualPath, fileName);

						// Update this Attachment object to point to the copy of the actual attachment.
						// The display name should be the original file display name, not the name of the copy.
						attachment.FileName = fileName;
						attachment.Name = Path.GetFileName(helper.ActualPath);
						attachment.File = new Workshare.FCS.Lite.Interface.File(attachment.FileName, attachment.Name);
					}
				}
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);

				StringBuilder sb = new StringBuilder(Resources.CRITICAL_EXCEPTION);
				sb.Append(' ');
				sb.Append(Resources.CONTACT_SYSTEM_ADMIN);

				m_errors.Add(sb.ToString());
				m_exceptions.Add(ex);

				m_processResult = ProcessResult.EXCEPTION;
			}
	    }
Beispiel #2
0
		static public List<FileType> GetFileTypesInZip(string zipFilename)
		{
			List<FileType> fileTypes = new List<FileType>();
            string actualZipFileName = zipFilename;

            Utilities.LargeAttachmentHelper helper = new Utilities.LargeAttachmentHelper(zipFilename);
            if (helper.IsLargeAttachment)
            {
                actualZipFileName = helper.ActualPath;
            }

            foreach (string filename in GetFileNames(actualZipFileName, false))
            {
                FileType fileType = FileTypeBridge.GetSupportedFileType(filename);
                if (fileType != FileType.Unknown)
                {
                    fileTypes.Add(fileType);
                }
            }

			return fileTypes;
		}