示例#1
0
        MessageRec IMailbox.SaveSyncState(byte[] key, string syncState)
        {
            MrsTracer.ProxyClient.Function("RemoteMailbox.SaveSyncState", new object[0]);
            if (!(this is RemoteDestinationMailbox))
            {
                throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IMailbox_SaveSyncState");
            }
            this.VerifyMailboxConnection();
            IDataExport     dataExport      = new PagedTransmitter(syncState, base.MrsProxyClient.UseCompression);
            DataExportBatch dataExportBatch = dataExport.ExportData();
            long            handle          = base.MrsProxy.IDestinationMailbox_SaveSyncState2(base.Handle, key, dataExportBatch);

            if (!dataExportBatch.IsLastBatch)
            {
                using (IDataImport dataImport = new RemoteDataImport(base.MrsProxy, handle, null))
                {
                    do
                    {
                        dataExportBatch = dataExport.ExportData();
                        IDataMessage message = DataMessageSerializer.Deserialize(dataExportBatch.Opcode, dataExportBatch.Data, base.MrsProxyClient.UseCompression);
                        dataImport.SendMessage(message);
                    }while (!dataExportBatch.IsLastBatch);
                }
            }
            return(null);
        }
        void ISourceMailbox.SetMailboxSyncState(string syncState)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.SetMailboxSyncState", new object[0]);
            base.VerifyMailboxConnection();
            IDataExport     dataExport      = new PagedTransmitter(syncState, base.MrsProxyClient.UseCompression);
            DataExportBatch dataExportBatch = dataExport.ExportData();
            long            handle          = base.MrsProxy.ISourceMailbox_SetMailboxSyncState(base.Handle, dataExportBatch);

            if (!dataExportBatch.IsLastBatch)
            {
                using (IDataImport dataImport = new RemoteDataImport(base.MrsProxy, handle, null))
                {
                    do
                    {
                        dataExportBatch = dataExport.ExportData();
                        IDataMessage message = DataMessageSerializer.Deserialize(dataExportBatch.Opcode, dataExportBatch.Data, base.MrsProxyClient.UseCompression);
                        dataImport.SendMessage(message);
                    }while (!dataExportBatch.IsLastBatch);
                }
            }
        }