示例#1
0
            protected internal void MoveItem(FileSystemItem item, FsContainer parent)
            {
                if (item.Parent != this)
                {
                    throw new ApplicationException(String.Format("Illegal call to MoveItem: '{0}' is owned by another container.", item.GetFullPath()));
                }

                if (parent._itemsById.ContainsKey(item.ID) || parent._itemsByName.ContainsKey(item.SearchedName))
                {
                    throw new ApplicationException(String.Format("Can't move '{0}' to '{1}': there is an duplicated item.", item.GetFullPath(), parent.GetFullPath()));
                }

                _itemsById.Remove(item.ID);
                _itemsByName.Remove(item.SearchedName);
                Owner.UnregisterItem(item);
                item.Parent = null;

                parent.AddItem(item, false);
            }
示例#2
0
            protected internal void CopyItem(FileSystemItem item, FsContainer parent)
            {
                if (item.Parent != this)
                {
                    throw new ApplicationException(String.Format("Illegal call to CopyItem: '{0}' is owned by another container.", item.GetFullPath()));
                }

                if (parent._itemsById.ContainsKey(item.ID) || parent._itemsByName.ContainsKey(item.SearchedName))
                {
                    throw new ApplicationException(String.Format("Can't copy '{0}' to '{1}': there is an duplicated item.", item.GetFullPath(), parent.GetFullPath()));
                }

                item = item.Clone();

                parent.AddItem(item, false);
            }