internal QueryCacheResultBuilder(Loader.Loader loader) { _resultTypes = loader.ResultTypes; _cacheTypes = loader.CacheTypes; if (loader.EntityFetches != null) { for (var i = 0; i < loader.EntityFetches.Length; i++) { if (loader.EntityFetches[i]) { _entityFetchIndexes.Add(i); } } _hasFetches = _entityFetchIndexes.Count > 0; } if (loader.CollectionFetches == null) { return; } for (var i = 0; i < loader.CollectionFetches.Length; i++) { if (loader.CollectionFetches[i]) { _collectionFetchIndexes.Add(i); } } _hasFetches = _hasFetches || _collectionFetchIndexes.Count > 0; }
private void OnGetRemoteVersion(bool flag, Loader.Loader ld) { ResDataVersion remoteVers = default; if (flag) { //string data = ld.TextData; string data = System.Text.Encoding.UTF8.GetString(ld.ResultData); if (data.Contains("}{")) { Debug.Log("Match the '}{'"); data = data.Split(new string[] { "}{" }, System.StringSplitOptions.None)[0].Append("}"); } remoteVers = JsonUtility.FromJson <ResDataVersion>(data); if (remoteVers == default) { Debug.Log("Do not exists remote versions."); } ld.Dispose(); } else { Debug.Log("Do not get remote versions."); } BuildVersionConfig(ref remoteVers); }
/// <summary> /// Initialises SceneManager: /// </summary> public void Init() { // Create instance of Loader, used to load Scenes: _sceneLoader = new Loader.Loader(); // Create list of all scenes: _scenes = new List <Scene>(); }
internal QueryCacheResultBuilder(Loader.Loader loader) { _resultTypes = loader.ResultTypes; if (IsCacheWithFetches(loader)) { _cacheInfo = loader.CacheInfo; } }
private void OnLoadComplete(bool success, Loader.Loader target) { if (success) { string json = target.TextData; target.Dispose(); ResDataVersion remoteVersions = JsonUtility.FromJson <ResDataVersion>(json); remoteVersions.resVersionType = ResDataVersionType.Remote; CreateVersionsCached(ref remoteVersions); RemoteAppVersion = remoteVersions.app_version; if (VersionInvalidHandler != default) { bool flag = VersionInvalidHandler(); if (flag) { #if LOG_CLIENT_VERSIONING "warning:There have a newer App inistaller.".Log(); #endif return; } else { } } else { } mRemoteResVersion = remoteVersions.res_version; List <ResVersion> resUpdate = CachedVersion.CheckUpdates(Versions, ref remoteVersions); CachedVersion.WriteAsCached(); #if LOG_CLIENT_VERSIONING "log:Remote res update count is {0}".Log(resUpdate.Count.ToString()); "log:UpdateHandler is null: {0}".Log((UpdateHandler == default).ToString()); #endif if (resUpdate.Count == 0) { UpdateHandler?.Invoke(true, 1f); } else { StartLoadPatchRes(ref resUpdate); } } else { "error: Load remote version failed, url is {0}".Log(target.Url); } }
/// <summary> /// Charge une liste statique des DNSElement au démarage de la bibliothèque /// </summary> static DNSElement() { //Recherche tous les descripteurs de types DNS ResourceDetailsLoader = new Loader.Loader <DNSResourceDetails>(); Type defaultType = typeof(DNSDefaultResourceDetails); ResourceDetailsLoader.AddType(defaultType); ResourceDetailsLoader.DefaultElement = defaultType.FullName; //Ajoute un index sur le nom des services DNSServiceName = ResourceDetailsLoader.CreateIndex <string>("Name"); //ajoute un index sur le numéro des services DNSServiceNumber = ResourceDetailsLoader.CreateIndex <ushort>("Service"); }
/// <summary> /// 加载远端资源版本配置 /// </summary> /// <param name="handler"></param> public void LoadRemoteVersion(Action <bool, float> updateHandler, Func <bool> versionInvalidHandler, out int statu) { statu = 0; if (Application.internetReachability == NetworkReachability.NotReachable) { statu = 1;//无网络 updateHandler?.Invoke(true, 1f); } else { UpdateHandler = updateHandler; VersionInvalidHandler = versionInvalidHandler; Loader.Loader loader = new Loader.Loader(); loader.CompleteEvent.AddListener(OnLoadComplete); loader.Load(Versions.res_gateway.Append(ResDataVersion.FILE_RES_DATA_VERSIONS_NAME)); } }
/// <summary> /// Create a new <c>QueryInfo</c>. /// </summary> /// <param name="parameters">The query parameters.</param> /// <param name="loader">The loader.</param> /// <param name="querySpaces">The query spaces.</param> /// <param name="session">The session of the query.</param> public QueryInfo( QueryParameters parameters, Loader.Loader loader, ISet <string> querySpaces, ISessionImplementor session) { Parameters = parameters; Loader = loader; QuerySpaces = querySpaces; IsCacheable = loader.IsCacheable(parameters); if (!IsCacheable) { return; } CacheKey = Loader.GenerateQueryKey(session, Parameters); CanGetFromCache = Parameters.CanGetFromCache(session); CanPutToCache = Parameters.CanPutToCache(session); }
/// <summary> /// 创建资源版本 /// </summary> /// <param name="abNames">用于创建资源包的名称列表</param> /// <param name="resGateway">远程资源服务器网关</param> /// <param name="isIgnoreRemote">是否忽略基于线上的版本创建新的版本</param> public void CreateResDataVersion(bool isIgnoreRemote = false) { if (!isIgnoreRemote && string.IsNullOrEmpty(resRemoteGateWay)) { Debug.LogError("Remote gateway do not allow empty when non neglect remote versions."); return; } else { if (isIgnoreRemote) { OnGetRemoteVersion(false, default); } else { Loader.Loader loader = new Loader.Loader { ApplyLoom = false }; loader.CompleteEvent.AddListener(OnGetRemoteVersion); loader.Load(resRemoteGateWay.Append(ResDataVersion.FILE_RES_DATA_VERSIONS_NAME)); } } }
public IEnumerable <Func <DbDataReader, int> > GetResultSetHandler() { var dialect = Session.Factory.Dialect; List <object>[] hydratedObjects = new List <object> [_queryInfos.Count]; for (var i = 0; i < _queryInfos.Count; i++) { Loader.Loader loader = _queryInfos[i].Loader; var queryParameters = _queryInfos[i].Parameters; //Skip processing for items already loaded from cache if (_queryInfos[i].CacheKey?.ResultTransformer != null && _loaderResults[i] != null) { _loaderResults[i] = loader.TransformCacheableResults(queryParameters, _queryInfos[i].CacheKey.ResultTransformer, _loaderResults[i]); continue; } int entitySpan = loader.EntityPersisters.Length; hydratedObjects[i] = entitySpan == 0 ? null : new List <object>(entitySpan); EntityKey[] keys = new EntityKey[entitySpan]; RowSelection selection = queryParameters.RowSelection; bool createSubselects = loader.IsSubselectLoadingEnabled; _subselectResultKeys[i] = createSubselects ? new List <EntityKey[]>() : null; int maxRows = Loader.Loader.HasMaxRows(selection) ? selection.MaxRows : int.MaxValue; bool advanceSelection = !dialect.SupportsLimitOffset || !loader.UseLimit(selection, dialect); var index = i; yield return(reader => { if (advanceSelection) { Loader.Loader.Advance(reader, selection); } if (queryParameters.HasAutoDiscoverScalarTypes) { loader.AutoDiscoverTypes(reader, queryParameters, null); } LockMode[] lockModeArray = loader.GetLockModes(queryParameters.LockModes); EntityKey optionalObjectKey = Loader.Loader.GetOptionalObjectKey(queryParameters, Session); int rowCount = 0; var tmpResults = new List <object>(); int count; for (count = 0; count < maxRows && reader.Read(); count++) { rowCount++; object o = loader.GetRowFromResultSet( reader, Session, queryParameters, lockModeArray, optionalObjectKey, hydratedObjects[index], keys, true, _queryInfos[index].CacheKey?.ResultTransformer ); if (loader.IsSubselectLoadingEnabled) { _subselectResultKeys[index].Add(keys); keys = new EntityKey[entitySpan]; //can't reuse in this case } tmpResults.Add(o); } _loaderResults[index] = tmpResults; if (index == _queryInfos.Count - 1) { InitializeEntitiesAndCollections(reader, hydratedObjects); } return rowCount; }); } }
public static bool IsCacheWithFetches(Loader.Loader loader) { return(loader.CacheTypes.Length > loader.ResultTypes.Length); }