Exemple #1
0
        public bool startSceneWithRange(int transLen, int totalLen, bool singleMode = false)
        {
            if (transLen >= totalLen)
            {
                return(false);
            }
            this.mSpeedSceneId = 0;
            this.mStartDataPos = transLen;
            this.mEndDataPos   = totalLen;
            if (singleMode)
            {
                Log.i("DownContextBase", "start singel-scene for cdn down .. ");
                this.mSingleScene = this.createDownSceneInstance();
                return(this.mSingleScene.doScene((DownloadContextBase <TRequest, TResponse, TBuilder>) this, 0, this.mStartDataPos, this.mEndDataPos, false));
            }
            if (this.mBlockInfo.hasInfo)
            {
                return(this.startSceneWithResumeBlock());
            }
            this.mSingleScene = this.createDownSceneInstance();
            if (!this.needMultiBlock())
            {
                Log.i("DownContextBase", "start singel-scene for down .. ");
                return(this.mSingleScene.doScene((DownloadContextBase <TRequest, TResponse, TBuilder>) this, 0, this.mStartDataPos, this.mEndDataPos, false));
            }
            bool flag = this.mSingleScene.doScene((DownloadContextBase <TRequest, TResponse, TBuilder>) this, 0, this.mStartDataPos, this.mStartDataPos + (this.BLOCK_MIN_SIZE * 2), false);

            this.mSpeedSceneId = this.mSingleScene.mSceneID;
            return(flag);
        }
Exemple #2
0
 public void closeAllScene()
 {
     if (this.mMultiSceneList != null)
     {
         Log.i("DownContextBase", string.Concat(new object[] { "[*]multi scenes(", this.mMultiSceneList.Length, ") finished ,run time = ", Util.getNowMilliseconds() - this.creaeteTimestamp, ",rate = ", (int)(((double)(this.mEndDataPos - this.mStartDataPos)) / (Util.getNowMilliseconds() - this.creaeteTimestamp)), "KBps" }));
         for (int i = 0; i < this.mMultiSceneList.Length; i++)
         {
             this.mMultiSceneList[i].doCompleted();
             this.mMultiSceneList[i] = null;
         }
         this.mMultiSceneList = null;
     }
     if (this.mSingleScene != null)
     {
         Log.i("DownContextBase", string.Concat(new object[] { "[*]single scene finished ,run time = ", Util.getNowMilliseconds() - this.creaeteTimestamp, ",rate = ", (int)(((double)(this.mEndDataPos - this.mStartDataPos)) / (Util.getNowMilliseconds() - this.creaeteTimestamp)), "KBps" }));
         this.mSingleScene.doCompleted();
         this.mSingleScene = null;
     }
     if (this.mSaveFileStream != null)
     {
         this.mSaveFileStream.Close();
         this.mSaveFileStream.Dispose();
         this.mSaveFileStream = null;
     }
 }
Exemple #3
0
 public void onBlockCompleted(int sceneID)
 {
     if ((sceneID == this.mSpeedSceneId) && (this.mSingleScene != null))
     {
         this.startSceneFromNewBlock(this.mStartDataPos + (this.BLOCK_MIN_SIZE * 2), this.mEndDataPos, this.mSingleScene.mMiniRTT);
         Log.i("DownContextBase", string.Concat(new object[] { "[*]single scene finished ,run time = ", Util.getNowMilliseconds() - this.creaeteTimestamp, ",rate = ", (int)(((double)(this.BLOCK_MIN_SIZE * 2)) / (Util.getNowMilliseconds() - this.creaeteTimestamp)), "KBps" }));
         this.mSingleScene.doCompleted();
         this.mSingleScene = null;
     }
 }