Пример #1
0
        static public RProjectFile loadFile(RProjectDetails details, RRepositoryFile file, 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("&filename=" + HttpUtility.UrlEncode(file.about().filename));
            data.Append("&directory=" + HttpUtility.UrlEncode(file.about().directory));
            data.Append("&author=" + HttpUtility.UrlEncode(file.about().author));
            data.Append("&version=" + HttpUtility.UrlEncode(file.about().version));
            //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);
        }
        static public void loadObject(RProjectDetails details, RRepositoryFile file, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            if (!(file == null))
            {
                data.Append("&filename=" + HttpUtility.UrlEncode(file.about().filename));
                data.Append("&directory=" + HttpUtility.UrlEncode(file.about().directory));
                data.Append("&author=" + HttpUtility.UrlEncode(file.about().author));
                data.Append("&version=" + HttpUtility.UrlEncode(file.about().version));
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        public static void loadObject(RProjectDetails details, RRepositoryFile file, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            if (!(file == null))
            {
                data.Append("&filename=" + HttpUtility.UrlEncode(file.about().filename));
                data.Append("&author=" + HttpUtility.UrlEncode(file.about().author));
                data.Append("&version=" + HttpUtility.UrlEncode(file.about().version));
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        public static RProjectFile loadFile(RProjectDetails details, RRepositoryFile file, 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("&filename=" + HttpUtility.UrlEncode(file.about().filename));
            data.Append("&author=" + HttpUtility.UrlEncode(file.about().author));
            data.Append("&version=" + HttpUtility.UrlEncode(file.about().version));
            //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;
        }