/// <summary> /// Отправить сигнал - невозможно загружить загрузку /// </summary> /// <param name="hostName">Имя хоста</param> /// <param name="id">ID</param> public static void SignalCompleting(string hostName, int id, StateDownload Status, string uri, long size, long downsize,TimeSpan time) { ConnectionInfo connection = SearchConnection(hostName, id); //Не нашли на выход if (connection == null) return; //Если нашли, отправим соответствующую команду серверу connection.Writer.Write(MessageClientServer.INFO + " " + Status + " " + uri + " " + size + " " + downsize + " " + time.ToString()); }
private static IEnumerator Downloading(Canvas_Downloading canvas) { Screen.sleepTimeout = SleepTimeout.NeverSleep; canvas.gameObject.SetActive(true); canvas.PanelLoad_on(); while (!uwr.isDone && String.IsNullOrEmpty(uwr.error)) { float tempFill = 0.9f / (0.009f * 0.9f / uwr.downloadProgress); if (tempFill > 100f) { tempFill = 100f; } canvas.img_fillAmount.fillAmount = tempFill / 100f; canvas.txt_percent.text = (int)tempFill + " %"; yield return(null); } Screen.sleepTimeout = SleepTimeout.SystemSetting; State = string.IsNullOrEmpty(uwr.error) ? StateDownload.Success : StateDownload.Error; }
public static void Information(StateDownload st, string uri, long size,long downsize,TimeSpan time) { Uri tmp = new Uri(uri); for (int i = 0; i < downloaders.Count; i++) { if (downloaders[i].Uri == tmp) { downloaders[i].State = st; downloaders[i].BytesDownload = downsize; downloaders[i].Size = size; downloaders[i].time = time; downloaders[i].flagRefresh = true; } } }
public string NameState(StateDownload stateDownload) { if (stateDownload == StateDownload.Completed) return "Завершена"; else { if (stateDownload == StateDownload.Downloading) return "Загружается"; else { if (stateDownload == StateDownload.Created) return "Создана"; else { if (stateDownload == StateDownload.Stopped) return "Остановлена"; else { if (stateDownload == StateDownload.Paused) return "Пауза"; else return "Не известно"; } } } } }
public DownloadTread(string url, long startPoint, long endPoint, int bufferSize, int cacheSize, int bufferCountPerNotification) { this.StartPoint = startPoint; this.EndPoint = endPoint; this.BufferSize = bufferSize; this.MaxCacheSize = cacheSize; this.BufferCountPerNotification = bufferCountPerNotification; this.Url = new Uri(url, UriKind.Absolute); // Установить значения по умолчанию IsRangeSupported. this.IsRangeSupported = true; // Установить Created статус. this.status = StateDownload.Created; }