internal void AddHelper(string partition, object cursors, bool advanced, IntPtr info) { int cNumCursors = 0; if (advanced) { cNumCursors = ((DS_REPL_CURSORS_3)cursors).cNumCursors; } else { cNumCursors = ((DS_REPL_CURSORS)cursors).cNumCursors; } IntPtr zero = IntPtr.Zero; for (int i = 0; i < cNumCursors; i++) { if (advanced) { zero = (IntPtr)((((long)info) + (Marshal.SizeOf(typeof(int)) * 2)) + (i * Marshal.SizeOf(typeof(DS_REPL_CURSOR_3)))); DS_REPL_CURSOR_3 structure = new DS_REPL_CURSOR_3(); Marshal.PtrToStructure(zero, structure); ReplicationCursor cursor = new ReplicationCursor(this.server, partition, structure.uuidSourceDsaInvocationID, structure.usnAttributeFilter, structure.ftimeLastSyncSuccess, structure.pszSourceDsaDN); this.Add(cursor); } else { zero = (IntPtr)((((long)info) + (Marshal.SizeOf(typeof(int)) * 2)) + (i * Marshal.SizeOf(typeof(DS_REPL_CURSOR)))); DS_REPL_CURSOR ds_repl_cursor = new DS_REPL_CURSOR(); Marshal.PtrToStructure(zero, ds_repl_cursor); ReplicationCursor cursor2 = new ReplicationCursor(this.server, partition, ds_repl_cursor.uuidSourceDsaInvocationID, ds_repl_cursor.usnAttributeFilter); this.Add(cursor2); } } }
internal void AddHelper(string partition, object cursors, bool advanced, IntPtr info) { int num; IntPtr intPtr; if (!advanced) { num = ((DS_REPL_CURSORS)cursors).cNumCursors; } else { num = ((DS_REPL_CURSORS_3)cursors).cNumCursors; } for (int i = 0; i < num; i++) { if (!advanced) { intPtr = (IntPtr)((long)info + (long)(Marshal.SizeOf(typeof(int)) * 2) + (long)(i * Marshal.SizeOf(typeof(DS_REPL_CURSOR)))); DS_REPL_CURSOR dSREPLCURSOR = new DS_REPL_CURSOR(); Marshal.PtrToStructure(intPtr, dSREPLCURSOR); ReplicationCursor replicationCursor = new ReplicationCursor(this.server, partition, dSREPLCURSOR.uuidSourceDsaInvocationID, dSREPLCURSOR.usnAttributeFilter); this.Add(replicationCursor); } else { intPtr = (IntPtr)((long)info + (long)(Marshal.SizeOf(typeof(int)) * 2) + (long)(i * Marshal.SizeOf(typeof(DS_REPL_CURSOR_3)))); DS_REPL_CURSOR_3 dSREPLCURSOR3 = new DS_REPL_CURSOR_3(); Marshal.PtrToStructure(intPtr, dSREPLCURSOR3); ReplicationCursor replicationCursor1 = new ReplicationCursor(this.server, partition, dSREPLCURSOR3.uuidSourceDsaInvocationID, dSREPLCURSOR3.usnAttributeFilter, dSREPLCURSOR3.ftimeLastSyncSuccess, dSREPLCURSOR3.pszSourceDsaDN); this.Add(replicationCursor1); } } }
internal void AddHelper(string partition, object cursors, bool advanced, IntPtr info) { int cNumCursors = 0; if (advanced) { cNumCursors = ((DS_REPL_CURSORS_3) cursors).cNumCursors; } else { cNumCursors = ((DS_REPL_CURSORS) cursors).cNumCursors; } IntPtr zero = IntPtr.Zero; for (int i = 0; i < cNumCursors; i++) { if (advanced) { zero = (IntPtr) ((((long) info) + (Marshal.SizeOf(typeof(int)) * 2)) + (i * Marshal.SizeOf(typeof(DS_REPL_CURSOR_3)))); DS_REPL_CURSOR_3 structure = new DS_REPL_CURSOR_3(); Marshal.PtrToStructure(zero, structure); ReplicationCursor cursor = new ReplicationCursor(this.server, partition, structure.uuidSourceDsaInvocationID, structure.usnAttributeFilter, structure.ftimeLastSyncSuccess, structure.pszSourceDsaDN); this.Add(cursor); } else { zero = (IntPtr) ((((long) info) + (Marshal.SizeOf(typeof(int)) * 2)) + (i * Marshal.SizeOf(typeof(DS_REPL_CURSOR)))); DS_REPL_CURSOR ds_repl_cursor = new DS_REPL_CURSOR(); Marshal.PtrToStructure(zero, ds_repl_cursor); ReplicationCursor cursor2 = new ReplicationCursor(this.server, partition, ds_repl_cursor.uuidSourceDsaInvocationID, ds_repl_cursor.usnAttributeFilter); this.Add(cursor2); } } }
internal void AddHelper(string partition, object cursors, bool advanced, IntPtr info) { // get the count int count = 0; if (advanced) { count = ((DS_REPL_CURSORS_3)cursors).cNumCursors; } else { count = ((DS_REPL_CURSORS)cursors).cNumCursors; } IntPtr addr = (IntPtr)0; for (int i = 0; i < count; i++) { if (advanced) { addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR_3))); DS_REPL_CURSOR_3 cursor = new DS_REPL_CURSOR_3(); Marshal.PtrToStructure(addr, cursor); ReplicationCursor managedCursor = new ReplicationCursor(_server, partition, cursor.uuidSourceDsaInvocationID, cursor.usnAttributeFilter, cursor.ftimeLastSyncSuccess, cursor.pszSourceDsaDN); Add(managedCursor); } else { addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR))); DS_REPL_CURSOR cursor = new DS_REPL_CURSOR(); Marshal.PtrToStructure(addr, cursor); ReplicationCursor managedCursor = new ReplicationCursor(_server, partition, cursor.uuidSourceDsaInvocationID, cursor.usnAttributeFilter); Add(managedCursor); } } }
internal void AddHelper(string partition, object cursors, bool advanced, IntPtr info) { // get the count int count = 0; if (advanced) count = ((DS_REPL_CURSORS_3)cursors).cNumCursors; else count = ((DS_REPL_CURSORS)cursors).cNumCursors; IntPtr addr = (IntPtr)0; for (int i = 0; i < count; i++) { if (advanced) { addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR_3))); DS_REPL_CURSOR_3 cursor = new DS_REPL_CURSOR_3(); Marshal.PtrToStructure(addr, cursor); ReplicationCursor managedCursor = new ReplicationCursor(_server, partition, cursor.uuidSourceDsaInvocationID, cursor.usnAttributeFilter, cursor.ftimeLastSyncSuccess, cursor.pszSourceDsaDN); Add(managedCursor); } else { addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR))); DS_REPL_CURSOR cursor = new DS_REPL_CURSOR(); Marshal.PtrToStructure(addr, cursor); ReplicationCursor managedCursor = new ReplicationCursor(_server, partition, cursor.uuidSourceDsaInvocationID, cursor.usnAttributeFilter); Add(managedCursor); } } }