private RWSMailAttachmentTransform()
		{
            string assemblyLocation = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            if (string.IsNullOrEmpty(assemblyLocation))
                throw new ArgumentNullException("Unable to get assembly location");

            assemblyLocation = new Uri(assemblyLocation).LocalPath;

            RedemptionLoader.DllLocation32Bit = Path.Combine(assemblyLocation, "redemption.dll");
			_mapIutils = RedemptionLoader.new_MAPIUtils();
		}
Esempio n. 2
0
		private RWSUtilities()
		{
			try
			{

                string assemblyLocation = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
                if (string.IsNullOrEmpty(assemblyLocation))
                    throw new ArgumentNullException("Unable to get assembly location");

                assemblyLocation = new Uri(assemblyLocation).LocalPath;

				//Redemption.RedemptionLoader.DllLocation64Bit = m_location + "\\redemption64.dll";
                RedemptionLoader.DllLocation32Bit = Path.Combine(assemblyLocation, "redemption.dll");
				m_mapiUtils = RedemptionLoader.new_MAPIUtils();
			}
			catch (Exception Ex)
			{
				throw Ex;
			}
		}
Esempio n. 3
0
 public void Dispose()
 {
     try
     {
         if (m_mapiUtils != null && Marshal.IsComObject(m_mapiUtils))
         {
             m_mapiUtils.Cleanup();
             Marshal.ReleaseComObject(m_mapiUtils);
             m_mapiUtils = null;
         }
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
     }
 }
	    private void Dispose(bool disposing)
	    {
	        // For embedded messages there may be circumstances where the msg file is
	        // still being accessed/deleted in other code so use try/catch to ensure
	        // that we don't fail the whole send process.
	        try
	        {
	            foreach (string s in _msgFileBackingCopies)
	            {
	                DeleteFile(s);
	            }
	            _msgFileBackingCopies.Clear();
	        }
    	    catch (Exception ex)
	        {
    	        Interop.Logging.Logger.LogError(ex);
	        }

	        try
	        {
	            foreach (string sFolder in _msgFileCreatedFolders)
	            {
	                Directory.Delete(sFolder);
	            }
	            _msgFileCreatedFolders.Clear();
	        }
	        catch (Exception ex)
	        {
	            Interop.Logging.Logger.LogError(ex);
	        }

	        CleanupTempCopies();

			_localFileManager = null;
			
			if (_mapIutils != null)
			{
				_mapIutils.Cleanup();
				
                if (Marshal.IsComObject(_mapIutils))
                {
                    Marshal.ReleaseComObject(_mapIutils);
                }
				_mapIutils = null;
			}

			if (_outlookApp != null)
			{
                if (Marshal.IsComObject(_outlookApp))
                {
				    Marshal.ReleaseComObject(_outlookApp);
                }
				_outlookApp = null;
			}
		}