public static ExplorerNode GetListFileFolder(ExplorerNode node, bool folderonly = false, bool read_only = false) { bool uri = false; ExplorerNode root = node.GetRoot; string Email = root.NodeType.Email; string parent_ID = null; string url = null; Regex rg; Match match; if (string.IsNullOrEmpty(Email)) { Email = AppSetting.settings.GetDefaultCloud(CloudType.GoogleDrive); uri = true; } //Find id folder if (uri)//folder url { if (root.NodeType.uri != null) { url = root.NodeType.uri.ToString(); rg = new Regex(Rg_url_idFolder); match = rg.Match(url); if (match.Success) { parent_ID = match.Value; } else { rg = new Regex(Rg_url_idFolderOpen); match = rg.Match(url); if (match.Success) { parent_ID = match.Value; } } } } else//explorer node { parent_ID = "root";//root if (!string.IsNullOrEmpty(node.Info.ID)) { parent_ID = node.Info.ID; //id root or id node } } //if found id is folder if (!string.IsNullOrEmpty(parent_ID)) { GD_Files_list list_ = Search("'" + parent_ID + "' in parents and trashed=false", Email); if (parent_ID == "root")//save root id { foreach (GD_item item in list_.items) { foreach (GD_parent parent in item.parents) { if (parent.isRoot) { parent_ID = parent.id; break; } } if (parent_ID != "root") { break; } } node.Info.ID = parent_ID; AppSetting.settings.SetRootID(Email, CloudType.GoogleDrive, parent_ID); } node.RenewChilds(list_.Convert(node)); return(node); } else if (string.IsNullOrEmpty(url)) { rg = new Regex(Rg_url_idFile); match = rg.Match(url); if (match.Success) { ExplorerNode n = new ExplorerNode(); n.Info.ID = match.Value; n.NodeType.Email = Email; GD_item item = GoogleDrive.GetMetadataItem(n); n.Info.Size = item.fileSize; n.Info.Name = item.title; n.Info.MimeType = item.mimeType; AppSetting.UIMain.FileSaveDialog(PCPath.Mycomputer, item.title, PCPath.FilterAllFiles, n); return(null); } } throw new Exception("Can't Analyze Data Input."); }