public void _InternalOnly_ChangeStateSuccess()
        {
            this.wiState       = WWWItem.StateWI.SUCCESS;
            this.safeBundle    = null;
            this.safeBytes     = null;
            this.safeString    = null;
            this.safeAudioClip = null;
            if (this.useLoadFromCacheOrDownload)
            {
                this.safeSize = ((this.m_kItem == null) ? 0 : this.m_kItem.nFileSize);
            }
            else
            {
                this.safeSize = ((this.m_www == null) ? 0 : this.m_www.size);
            }
            bool flag = !this.isCacheHit && this.itemType == ItemType.UNDEFINED && this.UseCustomCache;

            if (flag)
            {
                if (Option.EnableTrace)
                {
                    TsLog.LogWarning("[TsBundle] set RawBytes => Cache Hit[{0}], Use[{1}] (AssetPath=\"{2}\", Stack=\"{3}\", Type={4})", new object[]
                    {
                        this.isCacheHit,
                        this.useLoadFromCacheOrDownload,
                        this.assetPath,
                        this.stackName,
                        this.itemType
                    });
                }
                this.rawBytes = this.m_www.bytes;
            }
            try
            {
                if (this.itemType == ItemType.USER_STRING)
                {
                    this.safeString = this.m_www.text;
                    if (this.safeString == null)
                    {
                        this._InternalOnly_ChangeStateErrorOrRetry("fail to access www.text.");
                    }
                }
                else if (this.itemType == ItemType.USER_BYTESA)
                {
                    this.safeBytes = ((this.rawBytes == null) ? this.m_www.bytes : this.rawBytes);
                    if (this.safeBytes == null)
                    {
                        this._InternalOnly_ChangeStateErrorOrRetry("fail to access www.bytes.");
                    }
                }
                else if (this.itemType == ItemType.USER_AUDIO)
                {
                    this.safeAudioClip = this.m_www.GetAudioClip(false, true);
                    if (null == this.safeAudioClip)
                    {
                        this._InternalOnly_ChangeStateErrorOrRetry("fail to access www.AudioClip.");
                    }
                }
                else if (this.itemType == ItemType.UNDEFINED)
                {
                    if (this.refCnt == 1)
                    {
                        this.Dispose();
                    }
                    if (this.m_kItem != null)
                    {
                        TsCaching.MarkAsUsed(this.assetPath, this.m_kItem.nVersion, this.m_kItem.bUseCustomCache);
                    }
                }
                else
                {
                    this.safeBundle = this.m_www.assetBundle;
                    if (null == this.safeBundle)
                    {
                        this._InternalOnly_ChangeStateErrorOrRetry("fail to access www.assetBundle.");
                        throw new NullReferenceException();
                    }
                    this.mainAsset = this.safeBundle.mainAsset;
                    TsFix.AudioSourceWarning(this.mainAsset as GameObject);
                    if (this.loadAll)
                    {
                        this.subBundles = this.safeBundle.LoadAll();
                        UnityEngine.Object[] subBundles = this.subBundles;
                        for (int i = 0; i < subBundles.Length; i++)
                        {
                            UnityEngine.Object @object = subBundles[i];
                            TsFix.AudioSourceWarning(@object as GameObject);
                        }
                    }
                }
                if (Option.EnableTrace)
                {
                    bool flag2 = false;
                    int  num   = -1;
                    if (this.m_kItem != null)
                    {
                        string url = Helper.FullURL(this.assetPath);
                        num   = this.m_kItem.nVersion;
                        flag2 = TsCaching.IsVersionCached(url, num, this.m_kItem.bUseCustomCache);
                    }
                    TsLog.Log("[TsBundle] download => success (AssetPath=\"{0}\", Stack=\"{1}\", Type={2}, Version={3}, RefCnt={4}, LoadFromCacheOrDownload={5}, Disposed={6}), Cached => {7}\r\nCallStack={8}", new object[]
                    {
                        this.assetPath,
                        this.stackName,
                        this.itemType,
                        num,
                        this.refCnt,
                        this.useLoadFromCacheOrDownload,
                        this.m_www == null,
                        (string.IsNullOrEmpty(this.anotherURL) || this.useLoadFromCacheOrDownload) ? flag2.ToString() : "(ignore)"
                    });
                }
            }
            catch (Exception ex)
            {
                TsLog.LogError("[TsBundle] Unity Assetbundle access exception! (Protocol=\"{0}\", AssetPath=\"{1}\", Stack=\"{2}\", Type={3}) => {4}\r\nCallStack={5}", new object[]
                {
                    Option.GetProtocolRootPath(this.m_protocol),
                    this.assetPath,
                    this.stackName,
                    this.itemType,
                    ex.ToString(),
                    this.RequestCallStack
                });
                this._InternalOnly_ChangeStateErrorOrRetry("Exception! Unity Assetbundle access violation!");
            }
            if (!this.useLoadFromCacheOrDownload && !this.isCacheHit && 0 < this.safeSize)
            {
                Holder.DbgAddWWWItemStat(this.assetPath, this.safeSize);
                if (WWWItem.OnIncreaseSizeOfDownload != null)
                {
                    WWWItem.OnIncreaseSizeOfDownload(this.safeSize);
                }
            }
        }
 public void _InternalOnly_ChangeStateRequest()
 {
     if (this.wiState != WWWItem.StateWI.UNLOADED)
     {
         if (this.wiState != WWWItem.StateWI.DESTROIED)
         {
             this.retryRequested = false;
             this.wiState        = WWWItem.StateWI.REQUESTED;
             string text;
             if (string.IsNullOrEmpty(this.anotherURL))
             {
                 if (Option.usePatchDir && this.m_protocol == Protocol.HTTP && this.m_kItem != null)
                 {
                     string protocolRootPath = Option.GetProtocolRootPath(this.m_protocol);
                     string format           = string.Empty;
                     if (protocolRootPath[protocolRootPath.Length - 1] == '/')
                     {
                         if (this.assetPath[0] == '/')
                         {
                             format = "{0}{1}{2}";
                         }
                         else
                         {
                             format = "{0}{1}/{2}";
                         }
                     }
                     else if (this.assetPath[0] == '/')
                     {
                         format = "{0}/{1}{2}";
                     }
                     else
                     {
                         format = "{0}/{1}/{2}";
                     }
                     text = string.Format(format, protocolRootPath, this.m_kItem.VersionDir, this.assetPath);
                 }
                 else
                 {
                     text = Option.GetProtocolRootPath(this.m_protocol) + this.assetPath;
                 }
             }
             else
             {
                 text = this.anotherURL;
             }
             if (this.m_protocol == Protocol.HTTP && 0 < this.retryCnt)
             {
                 if (text.Contains("?r="))
                 {
                     text = string.Format("{0}{1}", text, this.retryCnt);
                 }
                 else
                 {
                     text = string.Format("{0}?r={1}{2}", text, (int)(UnityEngine.Random.value * 1000000f), this.retryCnt);
                 }
                 TsLog.Log("[TsBundle] TsBundle:Retry = \"{0}\"", new object[]
                 {
                     text
                 });
             }
             if (Option.EnableTrace)
             {
                 TsLog.Log("[TsBundle] www loading (AssetPath=\"{0}\", Stack=\"{1}\", Type={2}, Size={3:#,###,###,###}, UnloadReserved={4}, RefCount={5} ) {6}", new object[]
                 {
                     this.assetPath,
                     this.stackName,
                     this.itemType,
                     (this.m_kItem != null) ? this.m_kItem.nFileSize : 0,
                     this.DebugUnloadReserved,
                     this.refCnt,
                     (this.m_kItem != null) ? ((!TsCaching.IsVersionCached(text, this.m_kItem.nVersion, this.m_kItem.bUseCustomCache)) ? "<<will download>>" : "<<Cached>>") : "<<not listed>>"
                 });
             }
             if (string.IsNullOrEmpty(this.anotherURL))
             {
                 UsingAssetRecorder.RecordFile(this.assetPath);
             }
             this._ReleaseLoadedAsset();
             if (this.useLoadFromCacheOrDownload)
             {
                 if (!this.inUndefinedStack)
                 {
                     this.m_www = Holder.CancelPreDownload(this.assetPath);
                 }
                 if (this.m_www == null)
                 {
                     this.m_www = TsCaching.LoadFromCacheOrDownload(text, this.m_kItem.nVersion, (long)this.m_kItem.nFileSize, this.m_kItem.bUseCustomCache, this);
                 }
                 if (!this.isCacheHit)
                 {
                     Holder.DbgAddWWWItemStat(this.assetPath, this.m_kItem.nFileSize);
                     if (0 < this.m_kItem.nFileSize && WWWItem.OnIncreaseSizeOfDownload != null)
                     {
                         WWWItem.OnIncreaseSizeOfDownload(this.m_kItem.nFileSize);
                     }
                 }
             }
             else
             {
                 Holder.DbgAddWWWItemStat(this.assetPath, 0);
                 this.m_www = new WWW(text);
             }
             this.retryCnt++;
             return;
         }
     }
     try
     {
         if (Option.EnableTrace)
         {
             TsLog.Log("[TsBundle] cannot request download, already unloaded bundle (AssetPath=\"{0}\", Stack=\"{1}\", Type={2}, SIze={3:#,###,###,###})\n\rCallStack={4}", new object[]
             {
                 this.assetPath,
                 this.stackName,
                 this.itemType,
                 (this.m_kItem != null) ? this.m_kItem.nFileSize : 0,
                 this.RequestCallStack
             });
         }
     }
     catch (Exception arg)
     {
         TsLog.Log("[TsBundle] " + arg, new object[0]);
     }
 }