コード例 #1
0
        static public RProjectFile uploadFile(RProjectDetails details, String file, DirectoryUploadOptions options, RClient client, String uri)
        {
            RProjectFile  returnValue = default(RProjectFile);
            StringBuilder data        = new StringBuilder();
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("format", "json");
            parameters.Add("project", HttpUtility.UrlEncode(details.id));

            //create the input String
            if (!(options == null))
            {
                parameters.Add("filename", HttpUtility.UrlEncode(options.filename));
                parameters.Add("descr", HttpUtility.UrlEncode(options.descr));
                parameters.Add("overwrite", options.overwrite.ToString());
            }
            else
            {
                parameters.Add("filename", HttpUtility.UrlEncode(Path.GetFileName(file)));
            }
            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTFileUploadPost(uri, parameters, file, ref client);

            if (!(jresponse.JSONMarkup["directory"] == null))
            {
                JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>();
                if (!(jdir["file"] == null))
                {
                    JObject jfile = jdir["file"].Value <JObject>();
                    returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id);
                }
            }

            return(returnValue);
        }
コード例 #2
0
        static public RProjectFile writeFile(RProjectDetails details, String text, DirectoryUploadOptions options, RClient client, String uri)
        {
            RProjectFile  returnValue = default(RProjectFile);
            StringBuilder data        = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&text=" + HttpUtility.UrlEncode(text));
            if (!(options == null))
            {
                data.Append("&filename=" + HttpUtility.UrlEncode(options.filename));
                data.Append("&descr=" + HttpUtility.UrlEncode(options.descr));
                data.Append("&overwrite=" + options.overwrite.ToString());
            }

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

            if (!(jresponse.JSONMarkup["directory"] == null))
            {
                JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>();
                if (!(jdir["file"] == null))
                {
                    JObject jfile = jdir["file"].Value <JObject>();
                    returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id);
                }
            }

            return(returnValue);
        }
コード例 #3
0
        /// <summary>
        /// Write a file to project directory
        /// </summary>
        /// <param name="text">text to write to a file in the project directory</param>
        /// <param name="options">DirectoryUploadOptions object specifying behavior of the transfer</param>
        /// <returns>RProjectFile object created</returns>
        /// <remarks></remarks>
        public RProjectFile writeFile(String text, DirectoryUploadOptions options)
        {
            RProjectFile returnValue = RProjectDirectoryImpl.writeFile(m_projectDetails, text, options, m_client, Constants.RPROJECTDIRECTORYWRITE);

            return returnValue;
        }
コード例 #4
0
        /// <summary>
        /// Upload a file to project directory
        /// </summary>
        /// <param name="file">complete path to the file to upload</param>
        /// <param name="options">DirectoryUploadOptions object specifying behavior of the transfer</param>
        /// <returns>RProjectFile object created</returns>
        /// <remarks></remarks>
        public RProjectFile uploadFile(String file, DirectoryUploadOptions options)
        {
            RProjectFile returnValue = RProjectDirectoryImpl.uploadFile(m_projectDetails, file, options, m_client, Constants.RPROJECTDIRECTORYUPLOAD);

            return returnValue;
        }
コード例 #5
0
        /// <summary>
        /// Transfer file to project directory
        /// </summary>
        /// <param name="url">url of file to transfer</param>
        /// <param name="options">DirectoryUploadOptions object specifying behavior of the transfer</param>
        /// <returns>RProjectFile object created</returns>
        /// <remarks></remarks>
        public RProjectFile transferFile(String url, DirectoryUploadOptions options)
        {
            RProjectFile returnValue = RProjectDirectoryImpl.transferFile(m_projectDetails, url, options, m_client, Constants.RPROJECTDIRECTORYTRANSFER);

            return returnValue;
        }
コード例 #6
0
        /// <summary>
        /// Write a file to project directory
        /// </summary>
        /// <param name="text">text to write to a file in the project directory</param>
        /// <param name="options">DirectoryUploadOptions object specifying behavior of the transfer</param>
        /// <returns>RProjectFile object created</returns>
        /// <remarks></remarks>
        public RProjectFile writeFile(String text, DirectoryUploadOptions options)
        {
            RProjectFile returnValue = RProjectDirectoryImpl.writeFile(m_projectDetails, text, options, m_client, Constants.RPROJECTDIRECTORYWRITE);

            return(returnValue);
        }
コード例 #7
0
        /// <summary>
        /// Upload a file to project directory
        /// </summary>
        /// <param name="file">complete path to the file to upload</param>
        /// <param name="options">DirectoryUploadOptions object specifying behavior of the transfer</param>
        /// <returns>RProjectFile object created</returns>
        /// <remarks></remarks>
        public RProjectFile uploadFile(String file, DirectoryUploadOptions options)
        {
            RProjectFile returnValue = RProjectDirectoryImpl.uploadFile(m_projectDetails, file, options, m_client, Constants.RPROJECTDIRECTORYUPLOAD);

            return(returnValue);
        }
コード例 #8
0
        /// <summary>
        /// Transfer file to project directory
        /// </summary>
        /// <param name="url">url of file to transfer</param>
        /// <param name="options">DirectoryUploadOptions object specifying behavior of the transfer</param>
        /// <returns>RProjectFile object created</returns>
        /// <remarks></remarks>
        public RProjectFile transferFile(String url, DirectoryUploadOptions options)
        {
            RProjectFile returnValue = RProjectDirectoryImpl.transferFile(m_projectDetails, url, options, m_client, Constants.RPROJECTDIRECTORYTRANSFER);

            return(returnValue);
        }
コード例 #9
0
        public static RProjectFile writeFile(RProjectDetails details, String text, DirectoryUploadOptions options, RClient client, String uri)
        {
            RProjectFile returnValue = default(RProjectFile);
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&text=" + HttpUtility.UrlEncode(text));
            if (!(options == null))
            {
                data.Append("&filename=" + HttpUtility.UrlEncode(options.filename));
                data.Append("&descr=" + HttpUtility.UrlEncode(options.descr));
                data.Append("&overwrite=" + options.overwrite.ToString());
            }

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

            if (!(jresponse.JSONMarkup["directory"] == null))
            {
                JObject jdir = jresponse.JSONMarkup["directory"].Value<JObject>();
                if (!(jdir["file"] == null))
                {
                    JObject jfile = jdir["file"].Value<JObject>();
                    returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id);
                }
            }

            return returnValue;
        }
コード例 #10
0
        public static RProjectFile uploadFile(RProjectDetails details, String file, DirectoryUploadOptions options, RClient client, String uri)
        {
            RProjectFile returnValue = default(RProjectFile);
            StringBuilder data = new StringBuilder();
            Dictionary<String, String> parameters = new Dictionary<String, String>();

            parameters.Add("format", "json");
            parameters.Add("project", HttpUtility.UrlEncode(details.id));

            //create the input String
            if (!(options == null))
            {
                parameters.Add("filename", HttpUtility.UrlEncode(options.filename));
                parameters.Add("descr", HttpUtility.UrlEncode(options.descr));
                parameters.Add("overwrite", options.overwrite.ToString());
            }
            else
            {
                parameters.Add("filename", HttpUtility.UrlEncode(Path.GetFileName(file)));
            }
            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTFileUploadPost(uri, parameters, file, ref client);

            if (!(jresponse.JSONMarkup["directory"] == null))
            {
                JObject jdir = jresponse.JSONMarkup["directory"].Value<JObject>();
                if (!(jdir["file"] == null))
                {
                    JObject jfile = jdir["file"].Value<JObject>();
                    returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id);
                }
            }

            return returnValue;
        }