Beispiel #1
0
        public static HttpByteInfo Allocate(string m_srcUrl, WebRequestByteEvent webRequestTextEvent, string m_savePath = "",
                                            WebRequestProcessEvent processEvent = null)
        {
            HttpByteInfo httpByteInfo = new HttpByteInfo();

            httpByteInfo.m_srcUrl            = m_srcUrl;
            httpByteInfo.webRequestByteEvent = webRequestTextEvent;
            httpByteInfo.m_savePath          = m_savePath;
            httpByteInfo.processEvent        = processEvent;
            return(httpByteInfo);
        }
Beispiel #2
0
 public void StartByteDown(string m_srcUrl, WebRequestByteEvent webRequestTextEvent, string m_savePath = "",
                           WebRequestProcessEvent processEvent = null)
 {
     if (JudgeNetworkState())
     {
         if (!URLToHttpBase.ContainsKey(m_srcUrl))
         {
             HttpByte httpTxt = new HttpByte(HttpByteInfo.Allocate(m_srcUrl, webRequestTextEvent, m_savePath, processEvent));
             AddRequest(m_srcUrl, httpTxt);
         }
     }
     else
     {
         webRequestTextEvent(default(byte[]), DownStatus.NoNetwork, "");
     }
 }
Beispiel #3
0
        public override void DownloadFinish()
        {
            base.DownloadFinish();
            HttpByteInfo httpByteInfo = (HttpByteInfo)httpInfo;

            if (httpByteInfo.webRequestByteEvent != null)
            {
                if (downResult == DownStatus.Fail || downResult == DownStatus.NoNetwork)
                {
                    httpByteInfo.webRequestByteEvent.Invoke(default(byte[]), downResult, downError);
                }
                else
                {
                    httpByteInfo.webRequestByteEvent.Invoke(FileHelper.ReadByteArray(m_saveFilePath), downResult, downError);
                }
            }
        }
Beispiel #4
0
 public HttpByte(HttpByteInfo httpByteInfo) : base(httpByteInfo)
 {
 }