Exemplo n.º 1
0
 private void ExecuteApplicationEnd(object sender, EventArgs e)
 {
     ADNotificationManager.Stop();
     DeviceClassCache.Instance.Stop();
     ADUserCache.Stop();
     MailboxSessionCache.Stop();
     DeviceBehaviorCache.Stop();
     ExchangeDiagnosticsHelper.UnRegisterDiagnosticsComponents();
     this.resetAutoBlockedDeviceCounterTimer.Dispose();
     GlobalSettings.SyncLog.Dispose();
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         AirSyncDiagnostics.LogEvent(AirSyncEventLogConstants.Tuple_AirSyncUnloaded, new string[]
         {
             currentProcess.Id.ToString(CultureInfo.InvariantCulture)
         });
     }
 }
Exemplo n.º 2
0
        public static Stream ConvertItemToMime(StoreObject xsoItem)
        {
            Item item = xsoItem as Item;

            if (item == null)
            {
                throw new UnexpectedTypeException("Item", xsoItem);
            }
            OutboundConversionOptions outboundConversionOptions = AirSyncUtility.GetOutboundConversionOptions();
            PolicyData policyData = ADNotificationManager.GetPolicyData(Command.CurrentCommand.User);

            if (policyData != null && !policyData.AttachmentsEnabled)
            {
                outboundConversionOptions.FilterAttachmentHandler = ((Item item1, Attachment attachment) => false);
            }
            item.Load(StoreObjectSchema.ContentConversionProperties);
            AirSyncStream airSyncStream = new AirSyncStream();

            try
            {
                if (BodyConversionUtilities.IsMessageRestrictedAndDecoded(item))
                {
                    ItemConversion.ConvertItemToMime(((RightsManagedMessageItem)item).DecodedItem, airSyncStream, outboundConversionOptions);
                }
                else
                {
                    ItemConversion.ConvertItemToMime(item, airSyncStream, outboundConversionOptions);
                }
            }
            catch (ConversionFailedException innerException)
            {
                throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "MIME conversion failed for Item {0}", new object[]
                {
                    item
                }), innerException);
            }
            return(airSyncStream);
        }