示例#1
0
    private IEnumerator LoadCompressedBinary(DataLoadRequest req, byte[] bytes, Action <DataTableLoadError> onEnd, bool useQueue)
    {
        bool wait = true;
        DataTableLoadError error = DataTableLoadError.None;
        Action             act   = delegate
        {
            try
            {
                if (((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).bytes != null)
                {
                    ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003Cerror_003E__1 = ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003C_003Ef__this.Save(((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).req, ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).bytes);
                }
                else
                {
                    ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).bytes = ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003C_003Ef__this.cache.Load(((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).req);
                }
                if (((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).bytes != null)
                {
                    if (((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003C_003Ef__this.Verify(((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).req, ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).bytes))
                    {
                        ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003Cerror_003E__1 = ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003C_003Ef__this.ProcessCompressedBinary(((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).req, ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/).bytes);
                    }
                    else
                    {
                        ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003Cerror_003E__1 = DataTableLoadError.VerifyError;
                    }
                }
                else
                {
                    ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003Cerror_003E__1 = DataTableLoadError.FileReadError;
                }
            }
            catch (Exception)
            {
                ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003Cerror_003E__1 = DataTableLoadError.FileReadError;
            }
            finally
            {
                ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0030: stateMachine*/)._003Cwait_003E__0 = false;
            }
        };

        if (useQueue)
        {
            taskRunner.Add(req.name, act);
        }
        else
        {
            ThreadPoolWrapper.QueueUserWorkItem(delegate
            {
                ((_003CLoadCompressedBinary_003Ec__Iterator236) /*Error near IL_0072: stateMachine*/)._003Cact_003E__2();
            });
        }
        while (wait)
        {
            yield return((object)null);
        }
        onEnd(error);
    }
示例#2
0
    private DataTableLoadError Save(DataLoadRequest req, byte[] bytes)
    {
        DataTableLoadError result = DataTableLoadError.None;

        try
        {
            cache.Save(req, bytes);
            return(result);
        }
        catch (Exception ex)
        {
            Log.Error(LOG.DATA_TABLE, "SaveError({0}): {1}", req.name, ex);
            return(DataTableLoadError.FileWriteError);
        }
    }
示例#3
0
    private DataTableLoadError ProcessCompressedBinary(DataLoadRequest req, byte[] bytes)
    {
        DataTableLoadError result = DataTableLoadError.None;

        try
        {
            req.processCompressedBinaryData(bytes);
            return(result);
        }
        catch (Exception ex)
        {
            Log.Error(LOG.DATA_TABLE, "DataLoadError({0}): {1}", req.name, ex);
            return(DataTableLoadError.FileReadError);
        }
    }
示例#4
0
    public void OnTableDownloadError(DataTableLoadError error, Action retry)
    {
        if (!showingTableLoadError)
        {
            showingTableLoadError = true;
            Error error2;
            switch (error)
            {
            case DataTableLoadError.AssetNotFoundError:
                error2 = Error.AssetNotFound;
                break;

            case DataTableLoadError.FileWriteError:
                error2 = Error.AssetSaveFailed;
                break;

            case DataTableLoadError.VerifyError:
                error2 = Error.AssetVerifyFailed;
                break;

            default:
                error2 = Error.AssetLoadFailed;
                break;
            }
            MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, StringTable.GetErrorMessage((uint)error2), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 110u), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 111u), null, null), delegate(string btn)
            {
                showingTableLoadError = false;
                if (btn == "YES")
                {
                    retry();
                }
                else
                {
                    MonoBehaviourSingleton <AppMain> .I.Reset();
                }
            }, true, (int)error2);
        }
    }
示例#5
0
    private IEnumerator Load(DataLoadRequest req, bool downloadOnly, bool useQueue, bool forceDownload = false)
    {
        int i = 0;

        for (int len = req.depReqs.Count; i < len; i++)
        {
            while (!req.depReqs[i].isCompleted)
            {
                yield return((object)null);
            }
        }
        DataTableLoadError error = DataTableLoadError.None;

        byte[] bytes = null;
        if (!cache.IsCached(req) || forceDownload)
        {
            IEnumerator download = Download(req, delegate(byte[] b)
            {
                ((_003CLoad_003Ec__Iterator234) /*Error near IL_00f7: stateMachine*/)._003Cbytes_003E__3 = b;
            }, delegate(DataTableLoadError e)
            {
                ((_003CLoad_003Ec__Iterator234) /*Error near IL_0103: stateMachine*/)._003Cerror_003E__2 = e;
            });
            while (download.MoveNext())
            {
                yield return(download.Current);
            }
            if (error != 0)
            {
                if (useQueue)
                {
                    RemoveQueue(req);
                }
                if (req.enableLoadBinaryData)
                {
                    req.enableLoadBinaryData = false;
                    Request(req);
                }
                else
                {
                    req.OnError(error);
                }
                yield break;
            }
        }
        if (downloadOnly)
        {
            bool wait = true;
            ThreadPoolWrapper.QueueUserWorkItem(delegate
            {
                try
                {
                    if (((_003CLoad_003Ec__Iterator234) /*Error near IL_01cc: stateMachine*/)._003Cbytes_003E__3 != null)
                    {
                        ((_003CLoad_003Ec__Iterator234) /*Error near IL_01cc: stateMachine*/)._003Cerror_003E__2 = ((_003CLoad_003Ec__Iterator234) /*Error near IL_01cc: stateMachine*/)._003C_003Ef__this.Save(((_003CLoad_003Ec__Iterator234) /*Error near IL_01cc: stateMachine*/).req, ((_003CLoad_003Ec__Iterator234) /*Error near IL_01cc: stateMachine*/)._003Cbytes_003E__3);
                    }
                }
                catch (Exception)
                {
                    ((_003CLoad_003Ec__Iterator234) /*Error near IL_01cc: stateMachine*/)._003Cerror_003E__2 = DataTableLoadError.FileReadError;
                }
                finally
                {
                    ((_003CLoad_003Ec__Iterator234) /*Error near IL_01cc: stateMachine*/)._003Cwait_003E__6 = false;
                }
            });
            while (wait)
            {
                yield return((object)null);
            }
            if (error == DataTableLoadError.None)
            {
                req.OnComplete();
            }
            else
            {
                req.OnError(error);
            }
            if (useQueue)
            {
                RemoveQueue(req);
            }
        }
        else
        {
            Stopwatch   sw = Stopwatch.StartNew();
            IEnumerator loading;
            if (req.enableLoadBinaryData)
            {
                loading = LoadCompressedBinary(req, bytes, delegate(DataTableLoadError e)
                {
                    ((_003CLoad_003Ec__Iterator234) /*Error near IL_027b: stateMachine*/)._003Cerror_003E__2 = e;
                }, useQueue);
                while (loading.MoveNext())
                {
                    yield return(loading.Current);
                }
                if (error != 0)
                {
                    if (useQueue)
                    {
                        requestList.Remove(req);
                    }
                    req.enableLoadBinaryData = false;
                    Request(req);
                    yield break;
                }
            }
            else
            {
                loading = LoadCompressedTextWithSignature(req, bytes, delegate(DataTableLoadError e)
                {
                    ((_003CLoad_003Ec__Iterator234) /*Error near IL_0330: stateMachine*/)._003Cerror_003E__2 = e;
                }, useQueue);
            }
            while (loading.MoveNext())
            {
                yield return(loading.Current);
            }
            sw.Stop();
            if (error != 0)
            {
                req.OnError(error);
            }
            else
            {
                req.OnComplete();
            }
            if (useQueue)
            {
                RemoveQueue(req);
            }
        }
    }
示例#6
0
 public void OnError(DataTableLoadError error)
 {
     this.error = error;
     this.onError(error);
 }