|
|
@ -3,9 +3,15 @@ using System.IO;
|
|
|
|
using System.Net;
|
|
|
|
using System.Net;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
|
|
namespace nuget_cli
|
|
|
|
namespace nuget_cli
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
public class nugetdresp {
|
|
|
|
|
|
|
|
public int ecode {get; set; }
|
|
|
|
|
|
|
|
public string message {get; set; }
|
|
|
|
|
|
|
|
public string id { get; set; }
|
|
|
|
|
|
|
|
}
|
|
|
|
public class UploadFilesToServerUsingWebRequest
|
|
|
|
public class UploadFilesToServerUsingWebRequest
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -83,10 +89,17 @@ namespace nuget_cli
|
|
|
|
{
|
|
|
|
{
|
|
|
|
String json = re.ReadToEnd();
|
|
|
|
String json = re.ReadToEnd();
|
|
|
|
report.Message = json;
|
|
|
|
report.Message = json;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var res = JsonConvert.DeserializeObject<nugetdresp>(json);
|
|
|
|
|
|
|
|
report.AlreadyPresent = res.ecode == 1;
|
|
|
|
|
|
|
|
|
|
|
|
var hrep = resp as HttpWebResponse;
|
|
|
|
var hrep = resp as HttpWebResponse;
|
|
|
|
report.StatusCode = hrep.StatusCode.ToString();
|
|
|
|
report.StatusCode = hrep.StatusCode.ToString();
|
|
|
|
|
|
|
|
// ecode == 1 => package already present server side.
|
|
|
|
report.OK = hrep.StatusCode ==
|
|
|
|
report.OK = hrep.StatusCode ==
|
|
|
|
HttpStatusCode.Accepted || hrep.StatusCode == HttpStatusCode.OK;
|
|
|
|
HttpStatusCode.Accepted
|
|
|
|
|
|
|
|
|| hrep.StatusCode == HttpStatusCode.OK
|
|
|
|
|
|
|
|
|| res.ecode == 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else throw new Exception("Invalid server response type");
|
|
|
|
else throw new Exception("Invalid server response type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|