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; }
public static string AutoCreateFolder(ExplorerNode node) { if (node.Info.Size > 0) { throw new Exception("Node is file."); } DropboxRequestAPIv2 client = GetAPIv2(node.GetRoot.NodeType.Email); try { Monitor.Enter(sync_CreateFolder); List <ExplorerNode> 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); } }