Ejemplo n.º 1
0
        private async void Process_OutputDataReceived()
        {
            StreamReader streamReader = process.StandardOutput;

            while (!streamReader.EndOfStream)
            {
                string read = await streamReader.ReadLineAsync();

                DownloadIntermation intermation = new DownloadIntermation();
                if (read == "Error")
                {
                    BuildAssetDownload(_NumThreads, _version);
                    return;
                }
                else
                {
                    string[] str = read.Split('|');
                    if (str.Length == 1)
                    {
                        continue;
                    }
                    intermation.FinishFile = Convert.ToInt32(str[0]);
                    FinishFile             = Convert.ToInt32(str[0]);
                    intermation.AllFile    = AllFile;
                    intermation.Progress   = (int)(Convert.ToDouble(intermation.FinishFile) * (double)(100) / Convert.ToDouble(AllFile));
                    intermation.Speed      = Convert.ToDouble(str[2]);
                    DownloadProgressChanged(intermation);
                }
            }
        }
Ejemplo n.º 2
0
        private void Process_OutputDataReceived()
        {
            DownloadIntermation intermation = new DownloadIntermation();

            while (!gacDownload.GetEndDownload())
            {
                intermation.FinishFile = gacDownload.EndDownload;
                intermation.AllFile    = AllFile;
                intermation.Progress   = gacDownload.Progress;
                intermation.Speed      = gacDownload.Speed;
                DownloadProgressChanged(intermation);
                Console.WriteLine(gacDownload.EndDownload + "|" + Math.Round(gacDownload.Progress, 1) + "|" + Math.Round(gacDownload.Speed, 1));
                Thread.Sleep(1000);
            }
            intermation.FinishFile = FinishFile;
            intermation.AllFile    = AllFile;
            intermation.Progress   = 100;
            intermation.Speed      = 2;
            DownloadProgressChanged(intermation);
        }