private void CreateControllersTreeFromBinding(ExplorerNode parent, Binding binding)
 {
     foreach (Bistro.Methods.Controller item in binding.Controllers)
     {
         new ControllerNode(parent, item.Type, ControllerNode.ControllerNodeType.None);
     }
 }
 internal void ReportError(ExplorerNode node, Errors error)
 {
     ErrorNode parent = (ErrorNode)this[error.ToString()];
     if (parent == null)
         parent = new ErrorNode(this, error.ToString(), getMessage(error));
     Activator.CreateInstance(node.GetType(), (ExplorerNode)parent, node);
 }
示例#3
0
        public static bool Delete(ExplorerNode node, bool PernamentDelete)
        {
            string path = node.GetFullPathString();

            if (PernamentDelete)//delete
            {
                FileInfo info = new FileInfo(path);
                if (info.Exists)
                {
                    info.Delete();
                    return(true);
                }
                else
                {
                    DirectoryInfo dinfo = new DirectoryInfo(path);
                    if (dinfo.Exists)
                    {
                        dinfo.Delete(true);
                        return(true);
                    }
                }
                return(false);
            }
            else//trash
            {
                return(FileOperationAPIWrapper.SendRecycleBin(path));
            }
        }
示例#4
0
        static void GetItems(MegaApiClient client, INode node, ExplorerNode Enode)
        {
            foreach (INode child in client.GetNodes(node))
            {
                ExplorerNode c = new ExplorerNode();
                c.Info.ID         = child.Id;
                c.Info.Name       = child.Name;
                c.Info.DateMod    = child.LastModificationDate;
                c.Info.MegaCrypto = new MegaKeyCrypto(child as INodeCrypto);
                switch (child.Type)
                {
                case NodeType.File:
                    c.Info.Size = child.Size;
                    Enode.AddChild(c);
                    break;

                case NodeType.Directory:
                    c.Info.Size = -1;
                    Enode.AddChild(c);
                    break;

                default: break;
                }
            }
        }
示例#5
0
 public LabelNode(ExplorerNode node) : base()
 {
     this.Node        = node;
     this.MouseEnter += C_MouseEnter;
     this.MouseLeave += C_MouseLeave;
     C_MouseLeave(null, EventArgs.Empty);
 }
示例#6
0
        public ExplorerNode GetCloudRootNode(string Email, CloudType cloudname)
        {
            foreach (XmlNode node in GetCloudDataList())
            {
                TypeNode root = new TypeNode();
                root.Email = node.Attributes["Email"].Value;
                root.Type  = (CloudType)Enum.Parse(typeof(CloudType), node.Attributes["CloudName"].Value);
                if (root.Email == Email && root.Type == cloudname)
                {
                    NodeInfo info = new NodeInfo();
                    try
                    {
                        info.ID = node.Attributes["RootID"].Value;
                    }
                    catch
                    {
#if DEBUG
                        Console.WriteLine("{Settings} Can't Get RootID [" + root.Type.ToString() + ":" + root.Email + "]");
#endif
                    }

                    ExplorerNode e_node = new ExplorerNode();
                    e_node.NodeType = root;
                    e_node.Info     = info;
                    return(e_node);
                }
            }
            return(null);
        }
示例#7
0
        public static ExplorerNode GetListFileFolder(ExplorerNode node)
        {
            string path = node.GetFullPathString();

            node.Child.Clear();
            foreach (string item in Directory.GetDirectories(path))
            {
                DirectoryInfo info = new DirectoryInfo(item);
                if (CheckAttribute(info.Attributes, FileAttributes.System) | CheckAttribute(info.Attributes, FileAttributes.Offline))
                {
                    continue;
                }
                ExplorerNode f = new ExplorerNode();
                f.Info.Name    = info.Name;
                f.Info.Size    = -1;
                f.Info.DateMod = info.LastWriteTime;
                node.AddChild(f);
            }
            foreach (string item in Directory.GetFiles(path))
            {
                FileInfo info = new FileInfo(item);
                if (CheckAttribute(info.Attributes, FileAttributes.System) | CheckAttribute(info.Attributes, FileAttributes.Offline))
                {
                    continue;
                }
                ExplorerNode f = new ExplorerNode();
                f.Info.Name    = info.Name;
                f.Info.Size    = info.Length;
                f.Info.DateMod = info.LastWriteTime;
                node.AddChild(f);
            }
            return(node);
        }
示例#8
0
        public static ExplorerNode GetListFileFolder(ExplorerNode node)
        {
            node.Child.Clear();
            ExplorerNode  root   = node.GetRoot;
            MegaApiClient client = GetClient(root.NodeType.Email);

            if (root == node)
            {
                string ID = node.Info.ID;
                INode  n  = null;
                if (!string.IsNullOrEmpty(ID))
                {
                    n = new MegaNzNode(ID);
                }
                else
                {
                    n = GetRoot(root.NodeType.Email, NodeType.Root);
                    AppSetting.settings.SetRootID(root.NodeType.Email, CloudType.Mega, n.Id);
                }
                GetItems(client, n, node);
            }
            else
            {
                if (node.Info.Size != -1)
                {
                    throw new Exception("Can't explorer,this item is not folder.");
                }
                MegaNzNode inode = new MegaNzNode(node.Info.Name, node.Info.ID, node.Parent.Info.ID, -1, NodeType.Directory, node.Info.DateMod);
                GetItems(client, inode, node);
            }
            return(node);
        }
示例#9
0
        private void uploadFolderToHereToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.MyComputer;
            fbd.ShowNewFolderButton = true;
            DialogResult result = fbd.ShowDialog(MainForm);

            if (result == DialogResult.OK | result == DialogResult.Yes)
            {
                List <ExplorerNode> list_item_from = new List <ExplorerNode>();
                ExplorerNode        node           = ExplorerNode.GetNodeFromDiskPath(fbd.SelectedPath.TrimEnd('\\'));
                list_item_from.Add(node);

                ExplorerNode rootto = managerexplorernodes.NodeWorking();
                if (LV_item.SelectedItems.Count == 1)
                {
                    ExplorerNode find = FindNodeLV(LV_item.SelectedItems[0]);
                    if (find != null && find.Info.Size <= 0)
                    {
                        rootto = find;
                    }
                }
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(list_item_from, node.Parent, rootto, false);
            }
        }
示例#10
0
 public void AddNewCloudToTV(ExplorerNode newnode)
 {
     Dispatcher.Invoke(new Action(() => TreeObservableCollection.Add(new TreeViewDataModel(null)
     {
         DisplayData = new TreeviewDataItem(newnode)
     })));
 }
示例#11
0
        public void ShowDataToLV(ExplorerNode parent)
        {
            lv_data.Clear();
            foreach (ExplorerNode item in parent.Child)
            {
                LV_data dt = new LV_data();
                dt.Node = item;

                if (item.Info.DateMod != time_default)
                {
                    dt.d_mod = item.Info.DateMod.ToString(timeformat);
                }
                if (item.Info.Size >= 0)
                {
                    dt.SizeString = UnitConventer.ConvertSize(item.Info.Size, 2, UnitConventer.unit_size);

                    string extension = item.GetExtension();
                    dt.ImgSource = Setting_UI.GetImage(
                        item.GetRoot.NodeType.Type == CloudType.LocalDisk ?
                        IconReader.GetFileIcon(item.GetFullPathString(), IconReader.IconSize.Small, false) :    //some large file make slow.
                        IconReader.GetFileIcon("." + extension, IconReader.IconSize.Small, false)
                        ).Source;
                }
                else
                {
                    dt.SizeString = "-1";
                    dt.ImgSource  = Setting_UI.GetImage(IconReader.GetFolderIcon(IconReader.IconSize.Small, IconReader.FolderType.Closed)).Source;
                }
                lv_data.Add(dt);
            }
        }
示例#12
0
        public void CreateFolder(ExplorerNode node)
        {
            CheckThread(false);
            switch (node.GetRoot.NodeType.Type)
            {
            case CloudType.Dropbox:
                Dropbox.CreateFolder(node);
                break;

            case CloudType.GoogleDrive:
                GoogleDrive.CreateFolder(node);
                break;

            case CloudType.LocalDisk:
                LocalDisk.CreateFolder(node);
                break;

            case CloudType.Mega:
                MegaNz.CreateFolder(node);
                break;

            default:
                throw new UnknowCloudNameException("Error Unknow Cloud Type: " + node.GetRoot.NodeType.Type.ToString());
            }
        }
示例#13
0
        public async Task PrepareLightningAsync()
        {
            // Activate segwit
            var blockCount = ExplorerNode.GetBlockCountAsync();
            // Fetch node info, but that in cache
            var merchantInfo = MerchantCharge.Client.GetInfoAsync();
            var customer     = CustomerEclair.GetNodeInfoAsync();
            var channels     = CustomerEclair.RPC.ChannelsAsync();

            var info       = await merchantInfo;
            var clightning = new NodeInfo(info.Id, MerchantCharge.P2PHost, info.Port);
            var connect    = CustomerEclair.RPC.ConnectAsync(clightning);
            await Task.WhenAll(blockCount, customer, channels, connect);

            // Mine until segwit is activated
            if (blockCount.Result <= 432)
            {
                ExplorerNode.Generate(433 - blockCount.Result);
            }

            if (channels.Result.Length == 0)
            {
                await CustomerEclair.RPC.OpenAsync(clightning, Money.Satoshis(16777215));

                while ((await CustomerEclair.RPC.ChannelsAsync())[0].State != "NORMAL")
                {
                    ExplorerNode.Generate(1);
                }
            }
        }
示例#14
0
        public List <ExplorerNode> GetListAccountCloud()
        {
#if DEBUG
            //Console.WriteLine("Check event handle multi?");
#endif
            List <ExplorerNode> list = new List <ExplorerNode>();
            foreach (XmlNode node in GetCloudDataList())
            {
                TypeNode root = new TypeNode();
                root.Email = node.Attributes["Email"].Value;
                root.Type  = (CloudType)Enum.Parse(typeof(CloudType), node.Attributes["CloudName"].Value);

                NodeInfo info = new NodeInfo();
                try
                {
                    info.ID = node.Attributes["RootID"].Value;
                }
                catch
                {
#if DEBUG
                    Console.WriteLine("{Settings} Can't Get RootID [" + root.Type.ToString() + ":" + root.Email + "]");
#endif
                }

                ExplorerNode e_node = new ExplorerNode();
                e_node.NodeType = root;
                e_node.Info     = info;
                list.Add(e_node);
            }
            return(list);
        }
示例#15
0
        public bool MoveItem(ExplorerNode node, ExplorerNode newparent, string newname = null, bool Copy = false)
        {
            CheckThread(false);
            if (node.GetRoot == newparent.GetRoot)
            {
                bool flag = false;
                switch (node.GetRoot.NodeType.Type)
                {
                case CloudType.Dropbox: flag = Dropbox.Move(node, newparent, newname); break;

                case CloudType.GoogleDrive: GoogleDrive.MoveItem(node, newparent, newname).parents.ForEach(s => { if (!flag && s.id == newparent.Info.ID)
                                                                                                                  {
                                                                                                                      flag = true;
                                                                                                                  }
                                                                                                           }); break;

                case CloudType.LocalDisk: flag = LocalDisk.Move(node, newparent, newname); break;

                case CloudType.Mega:
                default: throw new Exception("CloudType not support (" + node.GetRoot.NodeType.Type.ToString() + ").");
                }
                if (flag)
                {
                    node.Parent.RemoveChild(node);
                    newparent.AddChild(node);
                }
                return(flag);
            }
            else
            {
                throw new Exception("Root not match.");
            }
        }
示例#16
0
        public void CreateTreeNodes(Bistro.Methods.Binding binding)
        {
            root = new BistroNode(root, binding);
            
            this.PaintTreeNode(root);

        }
示例#17
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string item = "";
            List <ExplorerNode> item_arr = new List <ExplorerNode>();

            for (int i = 0; i < LV_item.SelectedItems.Count; i++)
            {
                ExplorerNode find = FindNodeLV(LV_item.SelectedItems[i]);
                if (find != null)
                {
                    item_arr.Add(find);
                    item += find.Info.Name + "\r\n";
                }
            }
            DeleteConfirmForm f = new DeleteConfirmForm();

            f.TB.Text = item;
            f.ShowDialog(this);
            if (f.Delete)
            {
                DeleteItems items = new DeleteItems()
                {
                    Items = item_arr, PernamentDelete = f.CB_pernament.Checked
                };
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.DeletePath(items);
            }
        }
示例#18
0
        void uploadfile()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect      = true;
            ofd.Filter           = PCPath.FilterAllFiles;
            ofd.InitialDirectory = PCPath.Mycomputer;
            DialogResult result = ofd.ShowDialog();

            if (result != DialogResult.OK | result != DialogResult.Yes)
            {
                return;
            }
            List <ExplorerNode> items = new List <ExplorerNode>();
            ExplorerNode        root  = ExplorerNode.GetNodeFromDiskPath(System.IO.Path.GetDirectoryName(ofd.FileNames[0]));

            foreach (string s in ofd.SafeFileNames)
            {
                ExplorerNode n = new ExplorerNode();
                n.Info.Name = s;
                root.AddChild(n);
                FileInfo info = new FileInfo(n.GetFullPathString());
                n.Info.Size    = info.Length;
                n.Info.DateMod = info.LastWriteTime;
                items.Add(n);
            }
            Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(items, root, managerexplorernodes.NodeWorking(), false);
        }
示例#19
0
        public static ExplorerNode GetListFileFolder(ExplorerNode node)
        {
            DropboxRequestAPIv2 client = GetAPIv2(node.GetRoot.NodeType.Email);

            IDropbox_Response_ListFolder response = client.ListFolder(new Dropbox_Request_ListFolder(node.GetFullPathString(false)));

            node.Child.Clear();
            foreach (IDropbox_Response_MetaData metadata in response.entries)
            {
                if (metadata.tag == "folder")
                {
                    new ExplorerNode(
                        new NodeInfo()
                    {
                        Name = metadata.name, Size = -1, ID = metadata.id
                    }, node);
                }
            }

            foreach (IDropbox_Response_MetaData metadata in response.entries)
            {
                if (metadata.tag == "file")
                {
                    new ExplorerNode(
                        new NodeInfo()
                    {
                        Name = metadata.name, Size = metadata.size, ID = metadata.id, DateMod = DateTime.Parse(metadata.client_modified)
                    }, node);
                }
            }
            return(node);
        }
示例#20
0
        void ListAllItemInFolder(ExplorerNode node)
        {
            ExplorerNode list;

            try
            {
                list = AppSetting.ManageCloud.GetItemsList(node);
            }
            catch (UnauthorizedAccessException ex) { Console.WriteLine(ex.Message); return; }

            if (list.Child.Count == 0)//create empty folder
            {
            }
            else
            {
                foreach (ExplorerNode ffitem in list.Child)
                {
                    if (ffitem.Info.Size <= 0)
                    {
                        ListAllItemInFolder(ffitem);
                    }
                    else
                    {
                        LoadFile(ffitem);
                    }
                }
            }
        }
示例#21
0
        public List <ExplorerNode> Convert(ExplorerNode parent)
        {
            List <ExplorerNode> list = new List <ExplorerNode>();

            foreach (GD_item item in items)
            {
                bool add = true;
                GoogleDrive.mimeTypeGoogleRemove.ForEach(m => { if (item.mimeType == m)
                                                                {
                                                                    add = false;
                                                                }
                                                         });
                if (add)
                {
                    list.Add(
                        new ExplorerNode(
                            new NodeInfo()
                    {
                        Name = item.title, MimeType = item.mimeType, ID = item.id, Size = item.fileSize, DateMod = DateTime.Parse(item.modifiedDate)
                    },
                            parent)
                        );
                }
            }
            return(list);
        }
示例#22
0
        private void OpenItemLV()
        {
            if (LV_item.SelectedItems.Count != 1)
            {
                return;
            }
            ExplorerNode find = FindNodeLV(LV_item.SelectedItems[0]);

            if (find != null)
            {
                if (find.Info.Size > 0)                                    //file
                {
                    if (find.GetRoot.NodeType.Type != CloudType.LocalDisk) //cloud
                    {
                        MessageBox.Show("Not support now.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                    else//disk
                    {
                        System.Diagnostics.Process.Start(find.GetFullPathString());
                    }
                }
                else//folder
                {
                    managerexplorernodes.Next(find);
                    ExplorerCurrentNode();
                }
            }
        }
示例#23
0
        public static void AutoCreateFolder(ExplorerNode node)
        {
            List <ExplorerNode> list = node.GetFullPath();

            if (list[0].NodeType.Type != CloudType.Mega)
            {
                throw new Exception("Mega only.");
            }
            MegaApiClient client = GetClient(list[0].NodeType.Email);

            list.RemoveAt(0);
            foreach (ExplorerNode child in list)
            {
                if (string.IsNullOrEmpty(child.Info.ID))
                {
                    MegaNzNode m_p_node = new MegaNzNode(child.Parent.Info.ID);
                    INode      c_node   = client.GetNodes(m_p_node).Where(n => n.Name == child.Info.Name).First();//find
                    if (c_node == null)
                    {
                        c_node = client.CreateFolder(child.Info.Name, m_p_node);               //if not found -> create
                    }
                    child.Info.ID = c_node.Id;
                }
            }
        }
示例#24
0
        private void uploadFileToHereToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect      = true;
            ofd.Filter           = PCPath.FilterAllFiles;
            ofd.InitialDirectory = PCPath.Mycomputer;

            DialogResult result = ofd.ShowDialog();

            if (result == DialogResult.OK | result == DialogResult.Yes)
            {
                List <ExplorerNode> list_item_from = new List <ExplorerNode>();

                string       root     = Path.GetDirectoryName(ofd.FileNames[0]);
                ExplorerNode rootnode = ExplorerNode.GetNodeFromDiskPath(root);
                foreach (string a in ofd.SafeFileNames)
                {
                    FileInfo     info = new FileInfo(root + "\\" + a);
                    ExplorerNode n    = new ExplorerNode();
                    n.Info.Name = a;
                    n.Info.Size = info.Length;
                    rootnode.AddChild(n);
                    list_item_from.Add(n);
                }
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(list_item_from, rootnode,
                                                                                       ((UC_LVitem)tabControl1.SelectedTab.Controls[0]).managerexplorernodes.NodeWorking(), false);
            }
        }
 /// <summary>
 /// Creates a controller node for a resource dependency as a child of the resource node
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="type"></param>
 public ControllerNode(ExplorerNode parent, ControllerType type, ControllerNodeType nodeType)
     : base(parent, type.Name, ACTIVITY_ICON, ACTIVITY_ICON)
 {
     //this.type = type;
     //type.Register(this);
     //this.nodeType = nodeType;
 }
示例#26
0
        public static void CreateFolder(ExplorerNode node)
        {
            MegaNzNode    parent_meganode = new MegaNzNode(node.Parent.Info.ID);
            MegaApiClient client          = GetClient(node.GetRoot.NodeType.Email);
            INode         folder_meganode = client.CreateFolder(node.Info.Name, parent_meganode);

            node.Info.ID = folder_meganode.Id;
        }
示例#27
0
 public FolderNode(ExplorerNode parent, string fileName)
     : base(parent, fileName)
 {
     this.Text = fileName;
     this.ImageIndex = 1;
     this.SelectedImageIndex = this.ImageIndex;
     this.NodeFont = new Font(ProjectExplorer.DefaultFont, FontStyle.Regular);
 }
示例#28
0
        public static ExplorerNode GetItem(ExplorerNode node)
        {
            MegaApiClient client = GetClient(node.GetRoot.NodeType.Email);
            MegaNzNode    inode  = new MegaNzNode(node.Info.ID);

            GetItems(client, inode, node);
            return(node);
        }
示例#29
0
        void CreateFolder()
        {
            ExplorerNode node = new ExplorerNode();

            node.Info.Name = textBox1.Text;
            this.parentnode.AddChild(node);
            Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.CreateFolder(node);
            Invoke(new Action(() => this.Close()));
        }
示例#30
0
        void CreateFolder(object obj)
        {
            ExplorerNode n = new ExplorerNode();

            n.Info.Name = (string)obj;
            parent.AddChild(n);
            Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.CreateFolder(n);
            Dispatcher.Invoke(new Action(() => this.Close()));
        }
示例#31
0
 internal void SetSelected(ExplorerNode node)
 {
     foreach (TreeNode treeNode in ControllerView.Nodes.Find(node.Name, true))
         if (treeNode == node.TreeNode)
         {
             treeNode.Expand();
             ControllerView.SelectedNode = treeNode;
         }
 }
示例#32
0
        public static void CreateFolder(ExplorerNode node)
        {
            DirectoryInfo dinfo = new DirectoryInfo(node.GetFullPathString());

            if (!dinfo.Exists)
            {
                dinfo.Create();
            }
        }
示例#33
0
        public ProjectNode(ExplorerNode parent, string title, string fileName)
            : base(parent, fileName)
        {
            this.Text = title;
            this.ImageIndex = 0;
            this.NodeFont = new Font(ProjectExplorer.DefaultFont, FontStyle.Bold);

            this.Nodes.Add("*DUMMY*");
            this.Expand();
        }
示例#34
0
        public void AddItems(List <ExplorerNode> items, ExplorerNode fromfolder, ExplorerNode savefolder, bool AreCut)
        {
            ItemsTransferManager gr = new ItemsTransferManager(items, fromfolder, savefolder, AreCut);

            GroupsWork.Add(gr);
            Thread thr = new Thread(GroupsWork[GroupsWork.IndexOf(gr)].LoadListItems);

            thr.Start();
            LoadGroupThreads.Add(thr);
        }
 public BindingNode(ExplorerNode parent, string verb, string methodUrl)
     : base(parent, buildBindingName(parent, verb, methodUrl), BINDERS_ICON, OPEN_FOLDER_ICON)
 {
     this.methodUrl = methodUrl;
     fullMethodUrl = methodUrl;
     if (parent is BindingNode && !(parent is MethodsNode))
         fullMethodUrl = ((BindingNode)parent).fullMethodUrl + fullMethodUrl;
     this.verb = verb;
                
 }
示例#36
0
        public static ExplorerNode GetMetaData(ExplorerNode node)
        {
            DropboxRequestAPIv2        client   = GetAPIv2(node.GetRoot.NodeType.Email);
            IDropbox_Response_MetaData metadata = client.GetMetadata(
                new Dropbox_Request_Metadata(string.IsNullOrEmpty(node.Info.ID) ? node.GetFullPathString(false, true) : "id:" + node.Info.ID));

            node.Info.Name    = metadata.name;
            node.Info.DateMod = DateTime.Parse(metadata.server_modified);
            node.Info.Size    = metadata.size;
            return(node);
        }
示例#37
0
        public static void CreateFolder(ExplorerNode node)
        {
            if (node == node.GetRoot)
            {
                throw new Exception("Node is root.");
            }
            DropboxRequestAPIv2        client   = GetAPIv2(node.GetRoot.NodeType.Email);
            IDropbox_Response_MetaData metadata = client.create_folder(new Dropbox_path(node.GetFullPathString(false)));

            node.Info.ID = metadata.id;
        }
示例#38
0
 public void AddNewCloudToTV(ExplorerNode newnode)
 {
     if (InvokeRequired)
     {
         Invoke(new Action(() => AddNewCloudToTV_(newnode)));
     }
     else
     {
         AddNewCloudToTV_(newnode);
     }
 }
        private static string buildBindingName(ExplorerNode parent, string verb, string methodUrl)
        {
            if (parent is MethodsNode)
                if (verb == "*")
                    return "[ANY] " + methodUrl;
                else
                    return "[" + verb + "] " + methodUrl;
            else
                return methodUrl;

        }
示例#40
0
        private void CreateMethodsTreeFromBinding(ExplorerNode parent, Binding binding)
        {
            foreach (Bistro.Methods.Binding item in binding.Bindings)
            {
                BindingNode newParent = new BindingNode(parent, item.Verb, item.BindingUrl);
                if (item.Bindings.Count > 0)
                {
                    CreateMethodsTreeFromBinding(new BindingNode(parent, item.Verb, item.BindingUrl), item);

                }
                
                if (item.Controllers.Count > 0)
                {
                    CreateControllersTreeFromBinding(newParent, item);
                }

            }
        }
示例#41
0
 private void CreateControllersTreeFromBinding(ExplorerNode parent, Binding binding)
 {
     foreach (Bistro.Methods.Controller item in binding.Controllers)
     {
         ControllerNode parent1 = new ControllerNode(parent, item.Type, ControllerNode.ControllerNodeType.None);
         
         if (parent1.Name.CompareTo("DataAccessControl")== 0){
             new ResourceNode(parent1, "Resource1", ControllerNode.ControllerNodeType.Consumer);
             new ResourceNode(parent1, "Resource2", ControllerNode.ControllerNodeType.Provider);
         }
         if (parent1.Name.CompareTo("AdDisplay") == 0)
         {
             new ResourceNode(parent1, "Resource3", ControllerNode.ControllerNodeType.Consumer);
             new ResourceNode(parent1, "Resource1", ControllerNode.ControllerNodeType.Provider);
         }
         if (parent1.Name.CompareTo("AdUpdate") == 0)
         {
             new ResourceNode(parent1, "Resource5", ControllerNode.ControllerNodeType.Consumer);
             new ResourceNode(parent1, "Resource1", ControllerNode.ControllerNodeType.Provider);
         }
     }
 }
示例#42
0
 public void CreateRootNode(TestDescriptor td)
 {
     this.Root = new Controls.Nodes.ApplicationNode(td);
     this.PaintTreeNode(root);
 }
 public ExpandableNode(ExplorerNode parent, string name, string imageKey)
     : base(parent, name, imageKey)
 {
 }
 public ExpandableNode(ExplorerNode parent, ExplorerNode source, string imageKey, string expandedImageKey)
     : base(parent, source, imageKey, expandedImageKey)
 {
 }
 public ReferenceNode(ExplorerNode parent)
     : base(parent, "reference", ERROR_ICON)
 { }
        /// <summary>
        /// Checks the file name to see if it is valid.
        /// </summary>
        /// <param name="filename">File name to check.</param>
        /// <returns>The error, if any.</returns>
        private string CheckFileName(string filename, ExplorerNode editedNode)
        {
            char[] invalidChars = System.IO.Path.GetInvalidFileNameChars();

            if (filename.IndexOfAny(invalidChars) > -1)
            {
                return string.Concat("Filename contains invalid characters!");
            }
            else if (filename.Length > 255)
            {
                return "Filename to long.";
            }
            else if (editedNode is FileNode & Path.GetExtension(filename) != ".prg")
            {
                return "Invaild RPGCode Program file extension!";
            }
            else
            {
                return null;
            }
        }
        /// <summary>
        /// Renames a file.
        /// </summary>
        /// <param name="e">Event information.</param>
        /// <param name="editedNode">The parentNode that was edited.</param>
        private void RenameNode(NodeLabelEditEventArgs e, ExplorerNode editedNode)
        {
            try
            {
                string oldFile = editedNode.AbsolutePath;
                string newFile = System.IO.Path.Combine(editedNode.ParentNode.AbsolutePath, e.Label);

                if (editedNode is FileNode)
                {
                    File.Move(oldFile, newFile);
                }
                else if (editedNode is FolderNode)
                {
                    Directory.Move(oldFile, newFile);

                    if (editedNode.Children.Count > 0)
                    {
                        UpdateChildren(editedNode.Children, oldFile + @"\", newFile + @"\");
                    }
                }

                editedNode.File = e.Label;

                NodeLabelRenameEventArgs args2 = new NodeLabelRenameEventArgs(oldFile, newFile);
                this.OnNodeRename(args2);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ExecutablePath, MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.CancelEdit = true;
            }
        }
 public ResourceNode(ExplorerNode parent, string name, Controls.Nodes.ControllerNode.ControllerNodeType nodeType)
     : base(parent, name, GetControllerNodeType(nodeType))
 {
 }
 /// <summary>
 /// required constructor for nodes displaying errors <see cref="M:ErrorsNode.ReportError"/>
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="source"></param>
 public ResourceNode(ExplorerNode parent, ResourceNode source)
     : base(parent, source, RESOURCE_ICON, RESOURCE_ICON)
 {
     
 }
示例#50
0
 public void PaintTreeNode(ExplorerNode node)
 {
     node.Paint(ControllerView);
 }
示例#51
0
 public BistroNode(ExplorerNode root, Binding binding)
     : base(root, BISTRO_NODE_NAME, BINDERS_ICON, OPEN_FOLDER_ICON)
 {
     methods = new MethodsNode(this);
     CreateMethodsTreeFromBinding(methods, binding);
 }
 protected BindingNode(ExplorerNode parent, string name, string imageKey, string expandedImageKey)
     : base(parent, name, imageKey, expandedImageKey)
 {
     verb = "*";
 }