Esempio n. 1
0
        private string DownloadFile(string url, string fileId)
        {
            string path     = System.IO.Path.Combine(dirPath, url.Substring(url.LastIndexOf('/') + 1));
            string fileName = path.Substring(path.LastIndexOf('/') + 1);
            string endName  = fileName.Substring(fileName.LastIndexOf('.'));

            path = path.Replace(fileName, fileId + endName);

            bool status = false;

            try
            {
                HttpSimpleMgr.DownloadHttp(url, path);
                status = true;
            }
            catch (NullReferenceException e)
            {
                LogAgent.LogError(e.ToString());
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }
            Interlocked.Exchange(ref isDownLoading, 0);

            if (status)
            {
                return(path);
            }
            else
            {
                return(string.Empty);
            }
        }
Esempio n. 2
0
 private string GetMsgFromHttpByPost(string url, Dictionary <string, string> param)
 {
     try
     {
         string content = HttpSimpleMgr.HttpGetStrContentByPost(url, param);
         return(content);
     }
     catch (NullReferenceException e)
     {
         LogAgent.LogError(e.ToString());
         return(string.Empty);
     }
 }