예제 #1
0
        public static SyncLink ParseFromADString(string adString)
        {
            if (string.IsNullOrEmpty(adString))
            {
                throw new FormatException(DirectoryStrings.InvalidSyncLinkFormat(adString));
            }
            string[] array = adString.Split(new char[]
            {
                ','
            });
            if (array.Length != 4)
            {
                throw new FormatException(DirectoryStrings.InvalidSyncLinkFormat(adString));
            }
            SyncLink syncLink = null;

            try
            {
                LinkState linkState = (LinkState)Enum.Parse(typeof(LinkState), array[0]);
                if (!string.IsNullOrEmpty(array[0]))
                {
                    string @string = Encoding.UTF8.GetString(Convert.FromBase64String(array[1]));
                    syncLink = new SyncLink(@string, linkState);
                }
                else
                {
                    string     string2 = Encoding.UTF8.GetString(Convert.FromBase64String(array[2]));
                    ADObjectId link    = ADObjectId.ParseDnOrGuid(string2);
                    syncLink = new SyncLink(link, linkState);
                }
                syncLink.targetObjectClass = (DirectoryObjectClass)Enum.Parse(typeof(DirectoryObjectClass), array[3]);
            }
            catch (FormatException innerException)
            {
                throw new FormatException(DirectoryStrings.InvalidSyncLinkFormat(adString), innerException);
            }
            return(syncLink);
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            SyncLink syncLink = obj as SyncLink;

            return(syncLink != null && (this.targetId == syncLink.targetId && base.Link == syncLink.Link && base.State == syncLink.State) && this.targetObjectClass == syncLink.targetObjectClass);
        }