Example #1
0
    /// <summary>
    /// 检查远程resVer,并存储下来
    /// </summary>
    private void CheckRemoteResVer()
    {
        //从remote读取resVer
        Utils.SB.Append(UpdateMgr.RemoteCdnUrl);
        Utils.SB.Append("/");
        Utils.SB.Append(UnityUtil.CurPlatform);
        Utils.SB.Append("/resVer.txt");
        string remoteResVerPath = Utils.SB.ToString();

        Utils.ClearSB();
        Action <byte[]> onSuccess = (bs) =>
        {
            UpdateMgr.RemoteResVer = TypeConvertUtils.Bytes2String(bs);
            LogMgr.I("DownloadRes", "CheckRemoteResVer", "获取remote resVer成功 resVer;" + UpdateMgr.RemoteResVer, BeShowLog);
            SetState(DownloadResState.checkPersistDownloadingRes);
        };

        Action <string> onFaile = (error) =>
        {
            LogMgr.E("DownloadRes", "CheckRemoteResVer", "下载流程中断,获取remote resVer失败;" + remoteResVerPath, BeShowLog);
        };

        LogMgr.I("DownloadRes", "CheckRemoteResVer", "开始获取remote resVer url;" + remoteResVerPath, BeShowLog);

        FileHelper.GetIns().ReadBytesFromApkFile(remoteResVerPath, onSuccess, onFaile);
    }
Example #2
0
        public override void VisitInExpression(InExpression inExpression)
        {
            if (inExpression.Values == null)
            {
                throw new SqlErrorException("IN predicate only supports a list of values right now");
            }

            Expression memberExpression;

            if (inExpression.Expression is ColumnReference columnReferenceExpression)
            {
                //Check here if any index can be used aswell

                var identifiers = columnReferenceExpression.Identifiers;

                identifiers      = MemberUtils.RemoveAlias(_previousStage, identifiers);
                memberExpression = MemberUtils.GetMember(_previousStage, identifiers, _visitorMetadata.OperationsProvider, out var property);
                AddUsedProperty(property);
                AddNameToStack(string.Join(".", identifiers));
            }
            else
            {
                throw new SqlErrorException("IN predicate can only be used against column names");
            }

            IList list = ListUtils.GetNewListFunction(memberExpression.Type)();

            foreach (var value in inExpression.Values)
            {
                if (value is Literal literal)
                {
                    list.Add(TypeConvertUtils.ConvertToType(literal.GetValue(), memberExpression.Type));
                }
                else if (value is VariableReference variableReference)
                {
                    var sqlParameter  = _visitorMetadata.Parameters.GetParameter(variableReference.Name);
                    var variableValue = sqlParameter.GetValue(memberExpression.Type);
                    list.Add(variableValue);
                }
                else
                {
                    throw new SqlErrorException("IN predicate only supports literal or parameter values.");
                }
            }
            var inPredicate = _visitorMetadata.OperationsProvider.GetListContains(memberExpression, list);

            AddExpressionToStack(inPredicate);
        }
Example #3
0
    /// <summary>
    /// 读取stream中resVer
    /// </summary>
    private void CheckStreamResVer()
    {
        Utils.SB.Append(UnityUtil.StreamingAssetsPath);
        Utils.SB.Append("/resVer.txt");
        string streamResVerPath = Utils.SB.ToString();

        Utils.ClearSB();

        LogMgr.I("UnCompress", "CheckStreamResVer", "开始读取包内resVer path:" + streamResVerPath, BeShowLog);

        Action <byte[]> onSuccess = (bs) =>
        {
            UpdateMgr.StreamResVer = TypeConvertUtils.Bytes2String(bs);
            LogMgr.I("UnCompress", "CheckStreamResVer", "读取到包内resVer:" + UpdateMgr.StreamResVer, BeShowLog);
            SetState(UnCompressState.compareResVerPersist_Stream);
        };

        Action <string> onFaile = (error) =>
        {
            LogMgr.E("UnCompress", "CheckStreamResVer", " 解压流程中断 onFaile error:" + error, BeShowLog);
        };

        FileHelper.GetIns().ReadBytesFromApkFile(streamResVerPath, onSuccess, onFaile);
    }