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); }
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, ""); } }
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); } } }
public HttpByte(HttpByteInfo httpByteInfo) : base(httpByteInfo) { }