Пример #1
0
 public override void PrintTo(TextWriter wr, PrintCtx ctx, Boolean isLast)
 {
     PrintTabs(wr, ctx, isLast);
     wr.WriteLine(String.Format("{0}[{1}]", IsDynamic ? "dlink":"hlink", _itemTo.GetFullPath()));
 }
Пример #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);
            }
Пример #3
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);
            }
Пример #4
0
            protected internal void RemoveItem(FileSystemItem item)
            {
                if (item.HasHardLink)
                {
                    throw new ApplicationException(String.Format("Can't remove '{0}' because there are hard links pointing to.", item.GetFullPath()));
                }

                foreach (FsLink lnk in item.GetLinks())
                {
                    ((FsContainer)lnk.Parent).RemoveItem(lnk);
                }


                if (item is FsContainer)
                {
                    List <FileSystemItem> lstToRemove = new List <FileSystemItem>();
                    foreach (KeyValuePair <Int64, FileSystemItem> kv in ((FsContainer)item)._itemsById)
                    {
                        lstToRemove.Add(kv.Value);
                    }

                    foreach (FileSystemItem it in lstToRemove)
                    {
                        RemoveItem(it);
                    }
                }

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