IMake.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Web;
  2. using Common;
  3. using Custom;
  4. using LitJson;
  5. namespace Feign
  6. {
  7. public class IMake
  8. {
  9. public static string makeFile(string data)
  10. {
  11. string url = Utils.FeignUrl["omega_make"] + "/v1/omega_make/vscode/makeFile";
  12. string content = Function.PostWebRequest(url, "{\"content\":\"" + HttpUtility.UrlEncode(data) + "\"}", "application/json");
  13. JsonData jsonObj = JsonMapper.ToObject(content);
  14. if(jsonObj["status"].ToString() == "1")
  15. {
  16. return jsonObj["data"].ToString();
  17. }
  18. return "";
  19. }
  20. public static List<Versions> versions(int serverId)
  21. {
  22. string url = Utils.FeignUrl["omega_make"] + "/v1/omega_make/vscode/versionList";
  23. string content = Function.GetWebRequest(url + "?serverId=" + serverId);
  24. JsonData jsonObj = JsonMapper.ToObject(content);
  25. if(jsonObj["status"].ToString() == "1")
  26. {
  27. return Newtonsoft.Json.JsonConvert.DeserializeObject<List<Versions>>(jsonObj["data"].ToJson());
  28. }
  29. return new List<Versions>();
  30. }
  31. public static void addVersion(int projectId, int serverId, int userId, string versionNo)
  32. {
  33. string url = Utils.FeignUrl["omega_make"] + "/v1/omega_make/vscode/addVersion";
  34. Function.PostWebRequest(url, "{\"projectId\":" + projectId + ",\"serverId\":" + serverId + ",\"userId\":" + userId + ",\"versionNo\":\"" + versionNo + "\"}", "application/json");
  35. }
  36. }
  37. }