Ejemplo n.º 1
0
        public static Result UploadZipFile(MSettingInfo setting, ServiceInfo serviceInfo, string projType, string appId, string fullZipPath)
        {
            Result res = new Result();

            try
            {
                NameValueCollection dic = new NameValueCollection();
                dic.Add("Type", projType == "Library" ? "iis" : "exe");
                dic.Add("AppId", appId);

                if (serviceInfo == null || serviceInfo.ApiIpAdress.IsNullOrEmpty())
                {
                    serviceInfo = setting.GetCurrServiceInfo();
                }

                string url          = $"{serviceInfo?.GetApiUrl()}/UploadZip";
                string uploadResStr = HttpHelper.HttpPostData(url, 30000, Path.GetFileName(fullZipPath), fullZipPath, dic);
                var    uploadRes    = uploadResStr.DeserializeObject <Result>();
                return(uploadRes);
            }
            catch (Exception e)
            {
                res.Message = e.Message;
            }
            return(res);
        }
Ejemplo n.º 2
0
 public static bool Connect(ServiceInfo currService)
 {
     try
     {
         string    url    = $"{currService.GetApiUrl()}/CheckConnection?apiKey=" + currService.ApiKey;
         WebClient client = new WebClient();
         var       res    = client.DownloadString(url) == "OK";
         return(res);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public static List <AppView> GetAllIISAppNames(ServiceInfo currService)
 {
     try
     {
         string    url    = $"{currService.GetApiUrl()}/GetAllIISAppView";
         WebClient client = new WebClient();
         var       res    = client.DownloadString(url).DeserializeObject <List <AppView> >();
         return(res);
     }
     catch (Exception)
     {
         return(new List <AppView>());
     }
 }
Ejemplo n.º 4
0
        public static List <AppView> GetExeAppView(ServiceInfo currService, string appName)
        {
            try
            {
                string url = $"{currService.GetApiUrl()}/GetExeAppView?appName={appName}";

                var res = new HttpHelper().HttpGet(url, null, Encoding.UTF8, false, false, 10000);

                return(res.DeserializeObject <List <AppView> >());
            }
            catch (Exception)
            {
                return(new List <AppView>());
            }
        }