public void RecvPkg(NetPkg pkg) { EPkgType type = pkg.PkgType; switch (type) { case EPkgType.TRANS: this.SyncTrans((TransPkg)pkg); break; default: Debug.LogWarningFormat("无法处理的pkg类型: {0} ", type); break; } }
public void Start() { Console.WriteLine("start process " + currentDownload.TitleName); timer.Start(); //isRunning = true; status = WorkerStatus.Running; pkgType = GetPackageType(currentDownload); SetDownloadOutputDirectory(); if (!Directory.Exists(pkgOutputDirectory)) { Directory.CreateDirectory(pkgOutputDirectory); } Task.Run(() => { DownloadFile(currentDownload.pkg, pkgOutputPath); }); }