| | |
| | | public class RemoteFile
|
| | | {
|
| | | static bool m_ProcessErroring = false; |
| | | public static bool processErroring {
|
| | | public static bool processErroring
|
| | | {
|
| | | get { return m_ProcessErroring; }
|
| | | } |
| | | |
| | | public static int maxDownLoadTask = 48; |
| | | public static int MaxConnectLimit = 48; |
| | | static int gDownloadIsRunningCount; |
| | | public static int DownloadIsRunningCount { |
| | | public static int DownloadIsRunningCount
|
| | | {
|
| | | get { return gDownloadIsRunningCount; } |
| | | } |
| | | |
| | | public static int gStartTickcount = 0; |
| | | static long gTotalDownloadSize = 0L; //已下载的字节数 |
| | | static object lockObj = new object(); |
| | | public static long TotalDownloadedSize { |
| | | get { |
| | | public static long TotalDownloadedSize
|
| | | {
|
| | | get
|
| | | {
|
| | | return System.Threading.Interlocked.Read(ref gTotalDownloadSize); |
| | | } |
| | | set {
|
| | | set
|
| | | {
|
| | | gTotalDownloadSize = value;
|
| | | } |
| | | } |
| | |
| | | static float downloadSpeedRef = 0f; //字节/秒 |
| | | static long downloadSizeRef = 0L; |
| | | |
| | | public static string DownloadSpeed { |
| | | get { |
| | | public static string DownloadSpeed
|
| | | {
|
| | | get
|
| | | {
|
| | | float speed = downloadSpeedRef; |
| | | if (RemoteFile.gStartTickcount != 0)
|
| | | { |
| | |
| | | Action<bool, AssetVersion> onCompleted;
|
| | |
|
| | | protected bool mHadError = false; |
| | | public bool HaveError { |
| | | public bool HaveError
|
| | | {
|
| | | get { return mHadError; } |
| | | } |
| | | |
| | | bool m_Done = false; |
| | | public bool done { |
| | | public bool done
|
| | | {
|
| | | get { return m_Done; } |
| | | private set {
|
| | | private set
|
| | | {
|
| | | m_Done = value;
|
| | | if (value)
|
| | | {
|
| | |
| | | if (localFileSize == mRemoteFileSize && !outDated)
|
| | | { |
| | | gDownloadIsRunningCount--; |
| | | done = true; |
| | | mHadError = !Move(mLocalFileTemp, localFile);//把临时文件改名为正式文件 |
| | | done = true;
|
| | | yield break; // We already have the file, early out |
| | | } |
| | | else if (localFileSize > mRemoteFileSize || outDated)
|
| | |
| | | } |
| | | } |
| | | |
| | | bool IsOutdated { |
| | | get { |
| | | bool IsOutdated
|
| | | {
|
| | | get
|
| | | {
|
| | | if (File.Exists(mLocalFileTemp)) |
| | | return mRemoteLastModified > mLocalLastModified; |
| | | return false; |