private void GetNextItem(object o)
        {
            if (doneRemote)
            {
                return;
            }
            string item = o as string;

            if (item.StartsWith("-"))
            {
                var errItem = item.Substring(1);
                var err     = errItem.Split('|');
                RecordEvent(new ErrorItemData {
                    Id = Guid.Parse(err[0]), Path = err[1]
                }, "Error", "");
            }
            else
            {
                TimeSpan  tmp   = sw.Elapsed;
                IItemData idata = GetResources.GetRemoteItemData(_args, item);
                _installerQueue.Enqueue(idata);
                if (_args.children)
                {
                    QueueChildren(item);
                }
            }
        }
        private void Init()
        {
            using (new SecurityDisabler())
            {
                IItemData idata = GetResources.GetRemoteItemData(_args, _args.id);

                Item      parent  = db.GetItem(new ID(idata.ParentId));
                IItemData tmpData = idata;
                root = db.GetItem(new ID(idata.Id));
                if (_args.mirror && root != null)
                {
                    Stack <Item> items = new Stack <Item>();
                    items.Push(root);
                    while (items.Any())
                    {
                        var curItem = items.Pop();
                        allowedItems.Add(curItem.ID.Guid);
                        foreach (Item child in curItem.Children)
                        {
                            items.Push(child);
                        }
                    }
                }

                if (_args.pullParent && parent == null)
                {
                    Stack <IItemData> path = new Stack <IItemData>();
                    var tmp = _args.children;
                    _args.children = false;
                    while (parent == null)
                    {
                        parent = db.GetItem(new ID(tmpData.ParentId));
                        path.Push(tmpData);
                        _args.id = tmpData.ParentId.ToString();
                        tmpData  = GetResources.GetRemoteItemData(_args, tmpData.ParentId.ToString());
                    }
                    while (path.Any())
                    {
                        var cur = path.Pop();

                        InstallItem(cur);
                    }
                    _args.children = tmp;
                }

                RootNode = new ContentTreeNode(parent.Database.GetItem(new ID(idata.Id)));
                if (RootNode.Icon == "")
                {
                    RootNode = new ContentTreeNode(parent.Database.GetItem(new ID(idata.TemplateId)))
                    {
                        Id          = new ID(idata.Id).ToString(),
                        DisplayName = idata.Name
                    };
                }
                RootNode.Server = _args.server;
            }
        }
        private void QueueChildren(object item)
        {
            var list = GetResources.GetRemoteItemChildren(_args, item.ToString()).ToList();

            foreach (string id in list)
            {
                tp.Queue(GetNextItem, id);
            }
        }
Example #4
0
        /// <summary>
        /// returns the content tree level for the given id
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private static object GetContentTree(HttpContextBase context)
        {
            var data = GetPostData(context);

            try
            {
                var args = new RemoteContentTreeArgs(data);
                if (args.server != null)
                {
                    return(GetResources.GetRemoteItem(args, args.id));
                }
            }
            catch (RuntimeBinderException)
            {
            }
            using (new SecurityDisabler())
                return(string.IsNullOrWhiteSpace(data.id.ToString()) ? Root : new ContentTreeNode(Factory.GetDatabase(data.database.ToString()).GetItem(new ID(data.id))));
        }