Exemplo n.º 1
0
        //List item in folder
        public IItemNode GetItemsList(IItemNode node)
        {
            CheckThread(false);
            switch (node.GetRoot.RootType.Type)
            {
            case CloudType.Dropbox:
                return(Dropbox.GetListFileFolder(node));

            case CloudType.GoogleDrive:
                return(GoogleDrive.GetListFileFolder(node));

            case CloudType.LocalDisk:
                return(LocalDisk.GetListFileFolder(node));

            case CloudType.Mega:
                return(MegaNz.GetListFileFolder(node));

            default:
                throw new UnknowCloudNameException("Error Unknow Cloud Type: " + node.GetRoot.RootType.Type.ToString());
            }
        }
		public bool VisitEnter(IItemNode item)
		{
			if (filterItem(item))
				return false;

			var parent = stack.Peek();

			var targetItem = parent
				.Nodes
				.OfType<IItemNode>()
				.FirstOrDefault(x => string.Equals(x.Name, item.Name, StringComparison.OrdinalIgnoreCase));

			// Delete the existing item in the target project
			if (targetItem != null)
				targetItem.Delete();

			// And add the new one
			parent.As<IProjectItemContainerNode>().AddItem(item.PhysicalPath);

			return false;
		}
Exemplo n.º 3
0
        public static bool Move(IItemNode node, IItemNode newparent, string newname = null)
        {
            if (node.GetRoot.RootType.Type != CloudType.LocalDisk && newparent.GetRoot.RootType.Type != CloudType.LocalDisk)
            {
                throw new Exception("CloudType is != LocalDisk.");
            }
            string   path_from = node.GetFullPathString();
            string   path_to   = newparent.GetFullPathString() + "\\" + newname == null ? node.Info.Name : newname;
            FileInfo info      = new FileInfo(path_from);

            if (info.Exists)
            {
                info.MoveTo(path_to); return(true);
            }
            DirectoryInfo dinfo = new DirectoryInfo(path_from);

            if (dinfo.Exists)
            {
                dinfo.MoveTo(path_to); return(true);
            }
            return(false);
        }
Exemplo n.º 4
0
        void UpdateData(IItemNode newnode)
        {
            int start_index = 0;

            if (node != null)
            {
                IItemNode sameparent = newnode.FindSameParent(node);
                if (sameparent == null)
                {
                    start_index = node.GetFullPath().IndexOf(node.GetFullPath().Find(n => n == sameparent)) + 1;
                }
                while (Source.Count - 1 >= start_index)
                {
                    Source.RemoveAt(start_index);
                }
            }
            newnode.GetFullPath().ForEach(n => { Source.Add(new ComboBoxData(n)); });
            if (Source.Count >= 0)
            {
                comboBox.SelectedIndex = Source.Count - 1;
            }
        }
Exemplo n.º 5
0
        public static string AutoCreateFolder(IItemNode node)
        {
            if (node.Info.Size > 0)
            {
                throw new Exception("Node is file.");
            }
            DropboxRequestAPIv2 client = GetAPIv2(node.GetRoot.RootType.Email);

            try
            {
                Monitor.Enter(sync_CreateFolder);

                List <IItemNode> pathlist = node.GetFullPath();
                int i;
                for (i = 1; i < pathlist.Count; i++)
                {
                    try
                    {
                        client.ListFolder(new Dropbox_Request_ListFolder(pathlist[i].GetFullPathString(false)));
                    }
                    catch (HttpException ex)
                    {
                        if (ex.ErrorCode == 409)
                        {
                            break;
                        }
                        throw ex;
                    }
                }
                for (; i < pathlist.Count; i++)
                {
                    client.create_folder(new Dropbox_path(pathlist[i].GetFullPathString(false)));
                }
                return(pathlist[i - 1].GetFullPathString(false));
            }
            finally { Monitor.Exit(sync_CreateFolder); }
        }
Exemplo n.º 6
0
        public IItemNode GetFileInfo(IItemNode node)
        {
            switch (node.GetRoot.RootType.Type)
            {
            case CloudType.Dropbox:
                return(Dropbox.GetMetaData(node));

            case CloudType.GoogleDrive:
                Drivev2_File item = GoogleDrive.GetMetadataItem(node);
                node.Info.Size    = item.fileSize ?? -1;
                node.Info.Name    = item.title;
                node.Info.DateMod = item.modifiedDate ?? DateTime.Now;
                return(node);

            case CloudType.LocalDisk:
                return(LocalDisk.GetFileInfo(node));

            case CloudType.Mega:
                return(MegaNz.GetItem(node));

            default:
                throw new UnknowCloudNameException("Error Unknow Cloud Type: " + node.GetRoot.RootType.Type.ToString());
            }
        }
Exemplo n.º 7
0
		public RemovableProjectItemNode(IItemNode node)
		{
			hierarchyNode = new Lazy<IVsHierarchyItem>(() => node.AsVsHierarchyItem());
		}
Exemplo n.º 8
0
		/// <summary>
		/// Begins visiting a project item.
		/// </summary>
		/// <param name="item">The project item being visited.</param>
		/// <returns>
		///   <see langword="true" /> if the project item children should be visited; <see langword="false" /> otherwise.
		/// </returns>
		public virtual bool VisitEnter (IItemNode item) => true;
Exemplo n.º 9
0
 /// <summary>
 /// Adapts a <see cref="IItemNode"/> to an <see cref="VSProjectItem"/>.
 /// </summary>
 /// <returns>The <see cref="VSProjectItem"/> or <see langword="null"/> if conversion is not possible.</returns>
 public static VSProjectItem AsVsLangProjectItem(this IItemNode item) => item.As <VSProjectItem>();
Exemplo n.º 10
0
 /// <summary>
 /// Adapts a <see cref="IItemNode"/> to an <see cref="IVsHierarchyItem"/>.
 /// </summary>
 /// <returns>The <see cref="IVsHierarchyItem"/> or <see langword="null"/> if conversion is not possible.</returns>
 public static IVsHierarchyItem AsVsHierarchyItem(this IItemNode item) => item.As <IVsHierarchyItem>();
Exemplo n.º 11
0
 /// <summary>
 /// Ends visiting a project item.
 /// </summary>
 /// <param name="item">The project item being visited.</param>
 /// <returns>
 ///   <see langword="true" /> if the project item siblings should be visited; <see langword="false" /> otherwise.
 /// </returns>
 public virtual bool VisitLeave(IItemNode item)
 {
     return(true);
 }
Exemplo n.º 12
0
        /// <summary>
        /// Visists the given visitor with the specified item.
        /// </summary>
        public static bool Accept(IItemNode item, ISolutionVisitor visitor)
        {
            if (visitor.VisitEnter(item))
            {
                foreach (var node in item.Nodes)
                {
                    if (!node.Accept(visitor))
                        break;
                }
            }

            return visitor.VisitLeave(item);
        }
Exemplo n.º 13
0
 public ComboBoxData(IItemNode Node)
 {
     this.Node = Node;
 }
Exemplo n.º 14
0
 public TreeviewDataItem(IItemNode Node)
 {
     this.Node = Node;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Ends visiting a project item.
 /// </summary>
 /// <param name="item">The project item being visited.</param>
 /// <returns>
 ///   <see langword="true" /> if the project item siblings should be visited; <see langword="false" /> otherwise.
 /// </returns>
 public virtual bool VisitLeave(IItemNode item)
 {
     return true;
 }
Exemplo n.º 16
0
		public bool VisitEnter (IItemNode item)
		{
			throw new NotSupportedException ();
		}
Exemplo n.º 17
0
 /// <summary>
 /// Begins visiting a project item.
 /// </summary>
 /// <param name="item">The project item being visited.</param>
 /// <returns>
 ///   <see langword="true" /> if the project item children should be visited; <see langword="false" /> otherwise.
 /// </returns>
 public virtual bool VisitEnter(IItemNode item)
 {
     return true;
 }
Exemplo n.º 18
0
        public void FileSaveDialog(string InitialDirectory, string FileName, string Filter, IItemNode node)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.InitialDirectory = InitialDirectory;
            sfd.FileName         = FileName;
            sfd.Filter           = Filter;
            Invoke(new Action(() =>
            {
                DialogResult rs = sfd.ShowDialog();
                if (rs == DialogResult.OK || rs == DialogResult.Yes)
                {
                    IItemNode filesave = ItemNode.GetNodeFromDiskPath(sfd.FileName, node.Info.Size);
                    Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(new List <IItemNode>()
                    {
                        node
                    }, node.Parent, filesave.Parent, false);
                }
            }));
        }
Exemplo n.º 19
0
 void AddNewCloudToTV_(IItemNode newnode)
 {
     TV_item.Nodes.Add(new TreeNode_(newnode));
 }
Exemplo n.º 20
0
 /// <summary>
 /// Create folder node
 /// </summary>
 /// <returns></returns>
 public void CreateFolder(IItemNode node)
 {
     EventCreateFolder(node);
 }
Exemplo n.º 21
0
 public ItemNode(NodeInfo info, IItemNode parent)
 {
     this.Info = info;
     parent.AddChild(this);
 }
 public virtual void Visit(IItemNode node)
 {
    DefaultVisit(node);
 }
Exemplo n.º 23
0
 public void RemoveChild(IItemNode child)
 {
     this.Childs.Remove(child);
     child.Parent = null;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Begins visiting a project item.
 /// </summary>
 /// <param name="item">The project item being visited.</param>
 /// <returns>
 ///   <see langword="true" /> if the project item children should be visited; <see langword="false" /> otherwise.
 /// </returns>
 public virtual bool VisitEnter(IItemNode item)
 {
     return(true);
 }
Exemplo n.º 25
0
		/// <summary>
		/// Ends visiting a project item.
		/// </summary>
		/// <param name="item">The project item being visited.</param>
		/// <returns>
		///   <see langword="true" /> if the project item siblings should be visited; <see langword="false" /> otherwise.
		/// </returns>
		public virtual bool VisitLeave (IItemNode item) => true;
Exemplo n.º 26
0
 public DeletableProjectItemNode(IItemNode node)
 {
     hierarchyNode = new Lazy <IVsHierarchyItem>(() => node.AsVsHierarchyItem());
 }
Exemplo n.º 27
0
 public static GraphNodeId GetId(this IItemNode node)
 {
     return(GraphNodeId.GetNested(
                GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, GetProjectFileUri(node.OwningProject.As <Project>())),
                GraphNodeId.GetPartial(CodeGraphNodeIdName.File, new Uri(node.PhysicalPath, UriKind.RelativeOrAbsolute))));
 }
Exemplo n.º 28
0
 /// <summary>
 /// Adapts a <see cref="IItemNode"/> to an <see cref="IVsHierarchy"/>.
 /// </summary>
 /// <returns>The <see cref="IVsHierarchy"/> or <see langword="null"/> if conversion is not possible.</returns>
 public static IVsHierarchy AsVsHierarchy(this IItemNode item) => item.As <IVsHierarchy>();
		public bool VisitLeave(IItemNode item)
		{
			if (filterItem(item))
				return false;

			nodesToBeDeleted.Add(item);
			return false;
		}
Exemplo n.º 30
0
 /// <summary>
 /// Adapts a <see cref="IItemNode"/> to a <see cref="ProjectItem"/>.
 /// </summary>
 /// <returns>The <see cref="ProjectItem"/> or <see langword="null"/> if conversion is not possible.</returns>
 public static ProjectItem AsProjectItem(this IItemNode item) => item.As <ProjectItem>();
Exemplo n.º 31
0
 public bool VisitEnter(IItemNode item) => false;
Exemplo n.º 32
0
 public void AddChild(IItemNode child)
 {
     //this.Child.Add(child);
     child.Parent = (IItemNode)this;
 }
Exemplo n.º 33
0
 internal static IRemovableNode AsRemovableNode(this IItemNode folder) =>
 folder.As <IRemovableNode>();
Exemplo n.º 34
0
 private void PathUC1_EventNodePathClick(IItemNode nodeclick)
 {
     managerhistory_itemnodes.Next(nodeclick);
     ExplorerCurrentNode();
 }
Exemplo n.º 35
0
        void Paste()
        {
            IItemNode roottonode = managerehistory_itemnodes.NodeWorking();

            Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(AppClipboard.Items, AppClipboard.directory, roottonode, AppClipboard.AreCut);
        }
Exemplo n.º 36
0
 /// <summary>
 /// Add list item for download upload
 /// </summary>
 /// <param name="items">List Items</param>
 /// <param name="fromfolder">From</param>
 /// <param name="savefolder">To</param>
 /// <param name="AreCut">Cut or Copy (Cut will delete items in From folder)</param>
 public void TransferItems(List <IItemNode> items, IItemNode fromfolder, IItemNode savefolder, bool AreCut)
 {
     EventTransferItems(items, fromfolder, savefolder, AreCut);
 }
Exemplo n.º 37
0
 /// <summary>
 /// Explorer, return parent.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public IItemNode ListIteamRequest(IItemNode node)
 {
     return(EventGetChildNode(node));
 }
Exemplo n.º 38
0
 public IEnumerable <IItemNode> LoadChildren(IItemNode parentNode)
 {
     parentNode.SPNode.LoadChildren();
     return(parentNode.SPNode.Children.Select(spNode => ItemNode.Create(this, spNode)));
 }
Exemplo n.º 39
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="node"></param>
 /// <param name="newparent"></param>
 /// <param name="newname"></param>
 /// <param name="Copy"></param>
 /// <returns></returns>
 public bool RenameItem(IItemNode node, string newname)
 {
     return(EventMoveItem(node, null, newname, false));
 }
Exemplo n.º 40
0
 public bool VisitLeave(IItemNode item) => false;
Exemplo n.º 41
0
 public IEnumerable<IItemNode> LoadChildren(IItemNode parentNode)
 {
     parentNode.SPNode.LoadChildren();
     return parentNode.SPNode.Children.Select(spNode => ItemNode.Create(this, spNode));
 }