Exemple #1
0
        internal static WatermarkMap Parse(string rawstring)
        {
            WatermarkMap empty = WatermarkMap.Empty;

            string[] array = rawstring.Split(new string[]
            {
                ";"
            }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string text in array)
            {
                string[] array3 = text.Split(new string[]
                {
                    ":"
                }, StringSplitOptions.None);
                if (array3.Length != 2)
                {
                    throw new FormatException();
                }
                Guid key   = new Guid(array3[0]);
                long value = long.Parse(array3[1]);
                if (!empty.ContainsKey(key))
                {
                    empty.Add(key, value);
                }
            }
            return(empty);
        }
        internal static WatermarkMap GetReplicationCursors(ITopologyConfigurationSession configSession, bool useConfigNC = false, bool includeRetiredDCs = false)
        {
            WatermarkMap empty        = WatermarkMap.Empty;
            bool         useConfigNC2 = configSession.UseConfigNC;
            ADObjectId   id           = useConfigNC ? configSession.GetConfigurationNamingContext() : configSession.GetDomainNamingContext();

            try
            {
                configSession.UseConfigNC = useConfigNC;
                MultiValuedProperty <ReplicationCursor> multiValuedProperty = configSession.ReadReplicationCursors(id);
                foreach (ReplicationCursor replicationCursor in multiValuedProperty)
                {
                    if (includeRetiredDCs || replicationCursor.SourceDsa != null)
                    {
                        empty.Add(replicationCursor.SourceInvocationId, replicationCursor.UpToDatenessUsn);
                    }
                }
            }
            finally
            {
                configSession.UseConfigNC = useConfigNC2;
            }
            return(empty);
        }