internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
        {
            if (this.SyncFromAllServersCallback == null)
            {
                return(true);
            }
            DS_REPSYNCALL_UPDATE structure = new DS_REPSYNCALL_UPDATE();

            Marshal.PtrToStructure(update, structure);
            SyncFromAllServersEvent eventType = structure.eventType;
            IntPtr pErrInfo = structure.pErrInfo;
            SyncFromAllServersOperationException exception = null;

            if (pErrInfo != IntPtr.Zero)
            {
                exception = ExceptionHelper.CreateSyncAllException(pErrInfo, true);
                if (exception == null)
                {
                    return(true);
                }
            }
            string targetServer = null;
            string sourceServer = null;

            pErrInfo = structure.pSync;
            if (pErrInfo != IntPtr.Zero)
            {
                DS_REPSYNCALL_SYNC ds_repsyncall_sync = new DS_REPSYNCALL_SYNC();
                Marshal.PtrToStructure(pErrInfo, ds_repsyncall_sync);
                targetServer = Marshal.PtrToStringUni(ds_repsyncall_sync.pszDstId);
                sourceServer = Marshal.PtrToStringUni(ds_repsyncall_sync.pszSrcId);
            }
            return(this.SyncFromAllServersCallback(eventType, targetServer, sourceServer, exception));
        }
示例#2
0
 internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
 {
     if (this.SyncFromAllServersCallback != null)
     {
         DS_REPSYNCALL_UPDATE dSREPSYNCALLUPDATE = new DS_REPSYNCALL_UPDATE();
         Marshal.PtrToStructure(update, dSREPSYNCALLUPDATE);
         SyncFromAllServersEvent syncFromAllServersEvent = dSREPSYNCALLUPDATE.eventType;
         IntPtr intPtr = dSREPSYNCALLUPDATE.pErrInfo;
         SyncFromAllServersOperationException syncFromAllServersOperationException = null;
         if (intPtr != (IntPtr)0)
         {
             syncFromAllServersOperationException = ExceptionHelper.CreateSyncAllException(intPtr, true);
             if (syncFromAllServersOperationException == null)
             {
                 return(true);
             }
         }
         string stringUni = null;
         string str       = null;
         intPtr = dSREPSYNCALLUPDATE.pSync;
         if (intPtr != (IntPtr)0)
         {
             DS_REPSYNCALL_SYNC dSREPSYNCALLSYNC = new DS_REPSYNCALL_SYNC();
             Marshal.PtrToStructure(intPtr, dSREPSYNCALLSYNC);
             stringUni = Marshal.PtrToStringUni(dSREPSYNCALLSYNC.pszDstId);
             str       = Marshal.PtrToStringUni(dSREPSYNCALLSYNC.pszSrcId);
         }
         SyncUpdateCallback syncFromAllServersCallback = this.SyncFromAllServersCallback;
         return(syncFromAllServersCallback(syncFromAllServersEvent, stringUni, str, syncFromAllServersOperationException));
     }
     else
     {
         return(true);
     }
 }
示例#3
0
        internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
        {
            if (SyncFromAllServersCallback == null)
            {
                // user does not specify callback, resume the DsReplicaSyncAll execution
                return(true);
            }
            else
            {
                // user specifies callback
                // our callback is invoked, update should not be NULL, do assertion here
                Debug.Assert(update != (IntPtr)0);

                DS_REPSYNCALL_UPDATE syncAllUpdate = new DS_REPSYNCALL_UPDATE();
                Marshal.PtrToStructure(update, syncAllUpdate);

                // get the event type
                SyncFromAllServersEvent eventType = syncAllUpdate.eventType;

                // get the error information
                IntPtr temp = syncAllUpdate.pErrInfo;
                SyncFromAllServersOperationException exception = null;

                if (temp != (IntPtr)0)
                {
                    // error information is available
                    exception = ExceptionHelper.CreateSyncAllException(temp, true);
                    if (exception == null)
                    {
                        // this is the special case that we ingore the failure when SyncAllOptions.CheckServerAlivenessOnly is specified
                        return(true);
                    }
                }

                string targetName = null;
                string sourceName = null;

                temp = syncAllUpdate.pSync;
                if (temp != (IntPtr)0)
                {
                    DS_REPSYNCALL_SYNC sync = new DS_REPSYNCALL_SYNC();
                    Marshal.PtrToStructure(temp, sync);

                    targetName = Marshal.PtrToStringUni(sync.pszDstId);
                    sourceName = Marshal.PtrToStringUni(sync.pszSrcId);
                }

                // invoke the client callback
                SyncUpdateCallback clientCallback = SyncFromAllServersCallback;

                return(clientCallback(eventType, targetName, sourceName, exception));
            }
        }
 static bool SyncFromAllServersCallbackRoutine
 (
     SyncFromAllServersEvent eventType,
     string target,
     string source,
     SyncFromAllServersOperationException exception
 )
 {
     Console.WriteLine("\neventType is {0}", eventType);
     Console.WriteLine("target is {0}", target);
     Console.WriteLine("source is {0}", source);
     Console.WriteLine("exception is {0}", exception);
     return(true);
 }
        // This SyncUpdateCallback delegate receives event
        // notifications during replica synchronization
        private static bool SyncFromAllServersCallbackDelegate(
            SyncFromAllServersEvent eventType,
            string targetServer,
            string sourceServer,
            SyncFromAllServersOperationException e
            )
        {
            // return the type of synchronization event that occured
            Console.WriteLine("\neventType is {0}", eventType);

            // return the DN of the target nTDSDSA object for replication
            // this will be null when the eventType reports finished
            if (targetServer != null)
            {
                Console.WriteLine("target is {0}", targetServer);
            }

            // return the DN of the source nTDSDSA object for replication
            // this will be null when the eventType reports finished
            if (sourceServer != null)
            {
                Console.WriteLine("source is {0}", sourceServer);
            }

            // return any sync. operation exception
            // this will be null if there is no exception to report
            if (e != null)
            {
                Console.WriteLine("exception is {0}", e);
            }

            // return true to instruct the calling method to
            // continue its operation. The SyncUpdateCallback
            // delegate returns false when the eventType is finsihed.
            return(true);
        }
示例#6
0
 private bool SyncUpdateCallback(SyncFromAllServersEvent eventType, string targetServer, string sourceServer, SyncFromAllServersOperationException exception)
 {
     return(true);
 }
        // This SyncUpdateCallback delegate receives event
        // notifications during replica synchronization
        private static bool SyncFromAllServersCallbackDelegate(
                                SyncFromAllServersEvent eventType,
                                string targetServer,
                                string sourceServer,
                                SyncFromAllServersOperationException e
                            )
        {
            // return the type of synchronization event that occured
            Console.WriteLine("\neventType is {0}", eventType);

            // return the DN of the target nTDSDSA object for replication
            // this will be null when the eventType reports finished
            if (targetServer != null)
                Console.WriteLine("target is {0}", targetServer);

            // return the DN of the source nTDSDSA object for replication
            // this will be null when the eventType reports finished
            if (sourceServer != null)
                Console.WriteLine("source is {0}", sourceServer);

            // return any sync. operation exception
            // this will be null if there is no exception to report
            if (e != null)
                Console.WriteLine("exception is {0}", e);

            // return true to instruct the calling method to
            // continue its operation. The SyncUpdateCallback
            // delegate returns false when the eventType is finsihed.
            return true;
        }