Exemple #1
0
 public void Copy(IList <string> path, IGroupTreeItemProjection item, IList <string> newPath)
 {
     Copy(path, item.Name, item.Type, newPath);
 }
Exemple #2
0
 public void Rename(IList <string> path, IGroupTreeItemProjection item, string newName)
 {
     Rename(path, item.Name, item.Type, newName);
 }
        public bool Equals(IGroupTreeItemProjection projection)
        {
            var container = projection as ContainerProjection;

            if (container == null)
            {
                return(false);
            }

            if (Name != container.Name)
            {
                return(false);
            }
            if (Type != container.Type)
            {
                return(false);
            }
            if (IsActive != container.IsActive)
            {
                return(false);
            }
            if (!Size.Equals(container.Size))
            {
                return(false);
            }

            var myChildren   = GetChildren();
            var otheChildren = container.GetChildren();

            if ((myChildren == null && otheChildren != null) ||
                (myChildren != null && otheChildren == null))
            {
                return(false);
            }
            if (myChildren == null)
            {
                return(true);
            }

            if (myChildren.Count != otheChildren.Count)
            {
                return(false);
            }
            var myEnum    = myChildren.GetEnumerator();
            var otherEnum = otheChildren.GetEnumerator();

            bool canMyEnumNext    = myEnum.MoveNext();
            bool canOtherEnumNext = otherEnum.MoveNext();

            if (canOtherEnumNext != canMyEnumNext)
            {
                return(false);
            }

            while (canMyEnumNext)
            {
                if (!myEnum.Current.Equals(otherEnum.Current))
                {
                    return(false);
                }

                canMyEnumNext    = myEnum.MoveNext();
                canOtherEnumNext = otherEnum.MoveNext();
                if (canOtherEnumNext != canMyEnumNext)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #4
0
 public void Delete(IList <string> path, IGroupTreeItemProjection item)
 {
     Delete(path, item.Name, item.Type);
 }
        public bool Equals(IGroupTreeItemProjection projection)
        {
            var otherGroup = projection as GroupProjection;

            if (otherGroup == null)
            {
                return(false);
            }

            if (Name != otherGroup.Name)
            {
                return(false);
            }
            if (Type != otherGroup.Type)
            {
                return(false);
            }
            if (!Size.Equals(otherGroup.Size))
            {
                return(false);
            }

            var myAccounts   = GetAccountProjections();
            var otheAccounts = otherGroup.GetAccountProjections();

            if ((myAccounts == null && otheAccounts != null) ||
                (myAccounts != null && otheAccounts == null))
            {
                return(false);
            }
            if (myAccounts == null)
            {
                return(true);
            }

            if (myAccounts.Count != otheAccounts.Count)
            {
                return(false);
            }
            var myEnum    = myAccounts.GetEnumerator();
            var otherEnum = otheAccounts.GetEnumerator();

            bool canMyEnumNext    = myEnum.MoveNext();
            bool canOtherEnumNext = otherEnum.MoveNext();

            if (canOtherEnumNext != canMyEnumNext)
            {
                return(false);
            }

            while (canMyEnumNext)
            {
                if (myEnum.Current.Login != otherEnum.Current.Login)
                {
                    return(false);
                }

                canMyEnumNext    = myEnum.MoveNext();
                canOtherEnumNext = otherEnum.MoveNext();
                if (canOtherEnumNext != canMyEnumNext)
                {
                    return(false);
                }
            }
            return(true);
        }