/// <summary>
        /// Rename repository-managed user directory.
        /// </summary>
        /// <param name="destination">New name of the directory</param>
        /// <returns>RRepositoryDirectory object</returns>
        /// <remarks></remarks>
        public RRepositoryDirectory rename(String destination)
        {
            RRepositoryDirectory returnValue = default(RRepositoryDirectory);
            StringBuilder        data        = new StringBuilder();

            //set the url
            String uri = Constants.RREPOSITORYDIRECTORYRENAME;

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&directory=" + HttpUtility.UrlEncode(m_directoryDetails.name));
            data.Append("&destination=" + HttpUtility.UrlEncode(destination.Trim()));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client);

            if (!(jresponse.JSONMarkup["repository"] == null))
            {
                JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>();
                if (!(jrepo["directory"] == null))
                {
                    JObject jdir = jrepo["directory"].Value <JObject>();
                    returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), m_client);
                }
            }

            return(returnValue);
        }
        /// <summary>
        /// Archive files found in repository-managed user directory.
        /// </summary>
        /// <param name="archiveDirectoryName">Name to be given to the archive directory</param>
        /// <param name="files">List of Repository file to archive</param>
        /// <returns>RRepositoryDirectory object</returns>
        /// <remarks></remarks>
        public RRepositoryDirectory archive(String archiveDirectoryName, List <RRepositoryFile> files)
        {
            RRepositoryDirectory returnValue = default(RRepositoryDirectory);
            StringBuilder        data        = new StringBuilder();
            StringBuilder        filenames   = new StringBuilder();

            //set the url
            String uri = Constants.RREPOSITORYDIRECTORYARCHIVE;

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&archive=" + HttpUtility.UrlEncode(archiveDirectoryName));
            data.Append("&directory=" + HttpUtility.UrlEncode(m_directoryDetails.name));

            if (!(files == null))
            {
                foreach (var file in files)
                {
                    if (filenames.Length != 0)
                    {
                        filenames.Append(",");
                        filenames.Append(file.about().filename);
                    }
                    else
                    {
                        filenames.Append(file.about().filename);
                    }
                }
            }
            data.Append("&filename=" + HttpUtility.UrlEncode(filenames.ToString()));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client);

            if (!(jresponse.JSONMarkup["repository"] == null))
            {
                JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>();
                if (!(jrepo["directory"] == null))
                {
                    JObject jdir = jrepo["directory"].Value <JObject>();
                    returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), m_client);
                }
            }

            return(returnValue);
        }
        public static RRepositoryDirectory createDirectory(String directory, RClient client, String uri)
        {
            RRepositoryDirectory returnValue = default(RRepositoryDirectory);

            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&directory=" + HttpUtility.UrlEncode(directory.Trim()));
            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            if (!(jresponse.JSONMarkup["repository"] == null))
            {
                JObject jrepo = jresponse.JSONMarkup["repository"].Value<JObject>();
                if (!(jrepo["directory"] == null))
                {
                    JObject jdir = jrepo["directory"].Value<JObject>();
                    returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), client);
                }
            }

            return returnValue;
        }
Ejemplo n.º 4
0
        static public RRepositoryDirectory createDirectory(String directory, RClient client, String uri)
        {
            RRepositoryDirectory returnValue = default(RRepositoryDirectory);

            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&directory=" + HttpUtility.UrlEncode(directory.Trim()));
            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            if (!(jresponse.JSONMarkup["repository"] == null))
            {
                JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>();
                if (!(jrepo["directory"] == null))
                {
                    JObject jdir = jrepo["directory"].Value <JObject>();
                    returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), client);
                }
            }

            return(returnValue);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a new repository-managed custom user directory.
        /// </summary>
        /// <param name="directory">Name of new directory to create</param>
        /// <returns>RRepositoryDirectory object</returns>
        /// <remarks></remarks>
        public RRepositoryDirectory createDirectory(String directory)
        {
            RRepositoryDirectory returnValue = RUserRepositoryDirectoryImpl.createDirectory(directory, m_client, Constants.RREPOSITORYDIRECTORYCREATE);

            return(returnValue);
        }
        /// <summary>
        /// Archive files found in repository-managed user directory.
        /// </summary>
        /// <param name="archiveDirectoryName">Name to be given to the archive directory</param>
        /// <param name="files">List of Repository file to archive</param>
        /// <returns>RRepositoryDirectory object</returns>
        /// <remarks></remarks>
        public RRepositoryDirectory archive(String archiveDirectoryName, List<RRepositoryFile> files)
        {
            RRepositoryDirectory returnValue = default(RRepositoryDirectory);
            StringBuilder data = new StringBuilder();
            StringBuilder filenames = new StringBuilder();

            //set the url
            String uri = Constants.RREPOSITORYDIRECTORYARCHIVE;
            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&archive=" + HttpUtility.UrlEncode(archiveDirectoryName));
            data.Append("&directory=" + HttpUtility.UrlEncode(m_directoryDetails.name));

            if (!(files == null))
            {
                foreach (var file in files)
                {
                    if (filenames.Length != 0)
                    {
                        filenames.Append(",");
                        filenames.Append(file.about().filename);
                    }
                    else
                    {
                        filenames.Append(file.about().filename);
                    }
                }
            }
            data.Append("&filename=" + HttpUtility.UrlEncode(filenames.ToString()));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client);

            if (!(jresponse.JSONMarkup["repository"] == null))
            {
                JObject jrepo = jresponse.JSONMarkup["repository"].Value<JObject>();
                if (!(jrepo["directory"] == null))
                {
                    JObject jdir = jrepo["directory"].Value<JObject>();
                    returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), m_client);
                }
            }

            return returnValue;
        }
        /// <summary>
        /// Rename repository-managed user directory.
        /// </summary>
        /// <param name="destination">New name of the directory</param>
        /// <returns>RRepositoryDirectory object</returns>
        /// <remarks></remarks>
        public RRepositoryDirectory rename(String destination)
        {
            RRepositoryDirectory returnValue = default(RRepositoryDirectory);
            StringBuilder data = new StringBuilder();

            //set the url
            String uri = Constants.RREPOSITORYDIRECTORYRENAME;
            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&directory=" + HttpUtility.UrlEncode(m_directoryDetails.name));
            data.Append("&destination=" + HttpUtility.UrlEncode(destination.Trim()));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client);

            if (!(jresponse.JSONMarkup["repository"] == null))
            {
                JObject jrepo = jresponse.JSONMarkup["repository"].Value<JObject>();
                if (!(jrepo["directory"] == null))
                {
                    JObject jdir = jrepo["directory"].Value<JObject>();
                    returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), m_client);
                }
            }

            return returnValue;
        }