Esempio n. 1
0
        private static bool GetUpdateFiles(Models.UrlInfo url, string path)
        {
            if (url.Type != "GET")
            {
                Console.WriteLine($"HTTP type not supported!  {url.Type}");
                return(false);
            }
            if (!HttpService.HttpGetDownloadFIle(url.Url, "file.zip"))
            {
                return(false);
            }

            Console.WriteLine($"Zip file downloaded successfully!");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            ZipFile.ExtractToDirectory("file.zip", path);

            Console.WriteLine($"file unziped successfully!");

            File.Delete("file.zip");

            return(true);
        }
Esempio n. 2
0
        private static string GetServerVersion(Models.UrlInfo url)
        {
            if (url.Type != "GET")
            {
                Console.WriteLine($"HTTP type not supported!  {url.Type}");
                return("");
            }
            var result = HttpService.HttpGet(url.Url);

            if (result == null || !result.IsSuccessStatusCode)
            {
                return(null);
            }
            var responseString = result.Content.ReadAsStringAsync();

            responseString.Wait();
            return(responseString.Result);
        }