Exemplo n.º 1
0
        public static async Task <long> ListRightPushAsync <T>(string key, T value, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.ListRightPushAsync <T>(key, value));
        }
Exemplo n.º 2
0
        public static async Task <List <T> > ListRangeAsync <T>(string key, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.ListRangeAsync <T>(key));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询字符串缓存
        /// </summary>
        /// <param name="key"></param>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static async Task <string> GetStringAsync(string key, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.GetStringAsync(key));
        }
Exemplo n.º 4
0
 /// <summary>
 /// 读取缓存。
 /// 读取默认缓存与方法传进来的缓存,以方法传进来的缓存为优先级最高。
 /// </summary>
 /// <param name="cacheType"></param>
 /// <returns></returns>
 private static CacheEnum GetCacheType(CacheEnum cacheType)
 {
     if (cacheType == 0)
     {
         cacheType = CacheConfiguration.DefaultCacheType;
     }
     return(cacheType);
 }
Exemplo n.º 5
0
        public List <CacheMessage> PopMessages(CacheEnum cache)
        {
            List <CacheMessage> list = new List <CacheMessage>();

            if (messages.ContainsKey(cache.ToString()))
            {
                list = messages[cache.ToString()];
            }
            return(list);
        }
Exemplo n.º 6
0
        public void Clear(CacheEnum cache)
        {
            List <CacheMessage> list = new List <CacheMessage>();

            if (messages.ContainsKey(cache.ToString()))
            {
                list = messages[cache.ToString()];
            }
            list.Clear();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Unknown以外で存在しないものを全て作る
        /// </summary>
        public void CreateDefaultPreset()
        {
            var presets = CacheEnum.GetValues <BlendShapePreset>();

            foreach (var preset in presets)
            {
                if (preset == BlendShapePreset.Unknown)
                {
                    continue;
                }
                CreateDefaultPreset(preset);
            }
        }
Exemplo n.º 8
0
        public void PushMessage(CacheMessage message, CacheEnum cache)
        {
            List <CacheMessage> list = new List <CacheMessage>();

            if (messages.ContainsKey(cache.ToString()))
            {
                list = messages[cache.ToString()];
            }
            else
            {
                messages[cache.ToString()] = list;
            }
            list.Add(message);
        }
Exemplo n.º 9
0
 private static string TranslateCacheEnum(CacheEnum cacheEnum)
 {
     if (cacheEnum == CacheEnum.ReadOnly)
     {
         return("read-only");
     }
     else if (cacheEnum == CacheEnum.ReadWrite)
     {
         return("read-write");
     }
     else
     {
         return("nonstrict-read-write");
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 根据type读取缓存
        /// </summary>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        private static ICacheAssemble GetCache(CacheEnum cacheType)
        {
            switch (cacheType)
            {
            case CacheEnum.Redis:
                return(RedisAssemble.GetInstance());

            case CacheEnum.WebCache:
                return(WebCacheAssemble.GetInstance());

            case CacheEnum.Memcached:
                return(MemcachedAssemble.GetInstance());
            }

            return(null);
        }
Exemplo n.º 11
0
 public AzureSession(string connectionString, string shareName, string systemDir, int waitForLockMilliseconds = 5000, bool optimisticLocking = true,
   bool enableCache = true, CacheEnum objectCachingDefaultPolicy = CacheEnum.Yes)
   : base(systemDir, waitForLockMilliseconds, optimisticLocking, enableCache, objectCachingDefaultPolicy)
 {
   m_cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
   if (Path.IsPathRooted(systemDir) == false)
     SystemDirectory = systemDir;
   m_shareName = shareName;
   m_cloudFileClient = m_cloudStorageAccount.CreateCloudFileClient();
   m_cloudShare = m_cloudFileClient.GetShareReference(shareName);
   if (m_cloudShare.Exists())
   {
     m_rootDir = m_cloudShare.GetRootDirectoryReference();
     m_databaseDir = m_rootDir.GetDirectoryReference(systemDir);
     m_databaseDir.CreateIfNotExists();
   }
 }
Exemplo n.º 12
0
 public AzureSession(string connectionString, string shareName, string systemDir, int waitForLockMilliseconds = 5000, bool optimisticLocking = true,
   bool enableCache = true, CacheEnum objectCachingDefaultPolicy = CacheEnum.Yes)
   : base(systemDir, waitForLockMilliseconds, optimisticLocking, enableCache, objectCachingDefaultPolicy)
 {
   m_cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
   if (Path.IsPathRooted(systemDir) == false)
     SystemDirectory = systemDir;
   m_shareName = shareName;
   m_cloudFileClient = m_cloudStorageAccount.CreateCloudFileClient();
   m_cloudShare = m_cloudFileClient.GetShareReference(shareName);
   if (m_cloudShare.Exists())
   {
     m_rootDir = m_cloudShare.GetRootDirectoryReference();
     m_databaseDir = m_rootDir.GetDirectoryReference(systemDir);
     m_databaseDir.CreateIfNotExists();
   }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 从xml文件获取redis配置信息
        /// </summary>
        /// <param name="path"></param>
        /// <param name="CacheName"></param>
        private void GetCacheConfig(CacheEnum CacheName)
        {
            XmlDocument xml = new XmlDocument();//声明xml

            xml.Load(AppDomain.CurrentDomain.BaseDirectory + XmlPath);
            XmlNodeList topM = xml.DocumentElement.ChildNodes;

            if (topM.Count < 0)
            {
                return;
            }
            foreach (XmlElement element in topM)
            {
                if (element.HasAttribute("Name") && element.Attributes["Name"].Value.ToLower() == CacheName.ToString().ToLower())
                {
                    IsTrue          = element.SelectSingleNode("IsTrue").InnerText.Trim().ToLower() == "true" ? true : false;
                    ReadServer      = element.SelectSingleNode("ReadServer").InnerText.Trim();
                    WriteServer     = element.SelectSingleNode("WriteServer").InnerText.Trim();;
                    RedisDB         = (DBEnum)Enum.Parse(typeof(DBEnum), element.SelectSingleNode("RedisDB").InnerText.Trim(), false);
                    RedisExpireTime = Convert.ToDateTime(element.SelectSingleNode("RedisExpireTime").InnerText.Trim()).Hour * 60 + Convert.ToDateTime(element.SelectSingleNode("RedisExpireTime").InnerText.Trim()).Minute;
                    IsCacheName     = CacheName;
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 修改缓存时间
        /// </summary>
        /// <param name="key"></param>
        /// <param name="expiry"></param>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static async Task <bool> UpdateExpiryAsync(string key, TimeSpan expiry, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.UpdateExpiryAsync(key, expiry));
        }
Exemplo n.º 15
0
		private void WriteJcsCache(CacheEnum cacheEnum)
		{
			if (cacheEnum != CacheEnum.Undefined)
			{
				AppendF("<jcs-cache usage=\"{0}\" />", TranslateCacheEnum(cacheEnum));
			}
		}
Exemplo n.º 16
0
        /// <summary>
        /// 修改List key缓存时间
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="expiry"></param>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static async Task <List <string> > UpdateExpiryListAsync(List <string> keys, TimeSpan expiry, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.UpdateExpiryListAsync(keys, expiry));
        }
Exemplo n.º 17
0
        private void WriteCollection(ManyRelationCascadeEnum cascadeEnum, Type targetType,
                                     RelationType type, String name, string accessString,
                                     String table, String schema, bool lazy, bool inverse, String orderBy,
                                     String where, String sort, String columnKey, String columnRef, IModelNode extraModel,
                                     String index, String indexType, CacheEnum cache)
        {
            String cascade = TranslateCascadeEnum(cascadeEnum);

            String closingTag = null;

            if (type == RelationType.Bag)
            {
                closingTag = "</bag>";

                AppendF("<bag {0} {1} {2} {3} {4} {5} {6} {7} {8} >",
                        MakeAtt("name", name),
                        MakeAtt("access", accessString),
                        WriteIfNonNull("table", table),
                        WriteIfNonNull("schema", schema),
                        WriteIfTrue("lazy", lazy),
                        WriteIfTrue("inverse", inverse),
                        WriteIfNonNull("cascade", cascade),
                        WriteIfNonNull("order-by", orderBy),
                        WriteIfNonNull("where", where));
            }
            else if (type == RelationType.Set)
            {
                closingTag = "</set>";

                AppendF("<set {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}>",
                        MakeAtt("name", name),
                        MakeAtt("access", accessString),
                        WriteIfNonNull("table", table),
                        WriteIfNonNull("schema", schema),
                        WriteIfTrue("lazy", lazy),
                        WriteIfTrue("inverse", inverse),
                        WriteIfNonNull("cascade", cascade),
                        WriteIfNonNull("order-by", orderBy),
                        WriteIfNonNull("where", where),
                        WriteIfNonNull("sort", sort));
            }
            else if (type == RelationType.IdBag)
            {
                closingTag = "</idbag>";

                AppendF("<idbag {0} {1} {2} {3} {4} {5} {6} {7}>",
                        MakeAtt("name", name),
                        MakeAtt("access", accessString),
                        WriteIfNonNull("table", table),
                        WriteIfNonNull("schema", schema),
                        WriteIfTrue("lazy", lazy),
                        WriteIfNonNull("cascade", cascade),
                        WriteIfNonNull("order-by", orderBy),
                        WriteIfNonNull("where", where));

                VisitNode(extraModel);
            }
            else if (type == RelationType.Map)
            {
                closingTag = "</map>";

                AppendF("<map {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}>",
                        MakeAtt("name", name),
                        MakeAtt("access", accessString),
                        WriteIfNonNull("table", table),
                        WriteIfNonNull("schema", schema),
                        WriteIfTrue("lazy", lazy),
                        WriteIfTrue("inverse", inverse),
                        WriteIfNonNull("cascade", cascade),
                        WriteIfNonNull("order-by", orderBy),
                        WriteIfNonNull("where", where),
                        WriteIfNonNull("sort", sort));
            }

            Ident();

            WriteCache(cache);
            WriteKey(columnKey);

            if (type == RelationType.Map)
            {
                WriteIndex(index, indexType);
            }

            if (columnRef == null)
            {
                if (extraModel == null)
                {
                    WriteOneToMany(targetType);
                }
                else
                {
                    VisitNode(extraModel);
                }
            }
            else
            {
                WriteManyToMany(targetType, columnRef);
            }

            Dedent();

            Append(closingTag);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 通过List key删除缓存
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static async Task <List <string> > DeleteListAsync(List <string> keys, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.DeleteListAsync(keys));
        }
 static UssageLicense FromString(string src)
 {
     return(CacheEnum.TryParseOrDefault <UssageLicense>(src, true));
 }
Exemplo n.º 20
0
		private void WriteCollection(ManyRelationCascadeEnum cascadeEnum,
		                             Type targetType, RelationType type, string name,
		                             string accessString, string table, string schema, bool lazy,
		                             bool inverse, string orderBy, string where, string sort,
		                             string columnKey, string[] compositeKeyColumnKeys, string element, string elementType,
		                             string columnRef, string[] compositeKeyColumnRefs,
		                             IVisitable extraModel, string index, string indexType, CacheEnum cache, string cacheregion,
		                             NotFoundBehaviour notFoundBehaviour, FetchEnum fetch, int batchSize, Type collectionType)
		{
			bool extraModelVisited = false;

			String cascade = TranslateCascadeEnum(cascadeEnum);
			String notFoundMode = TranslateNotFoundBehaviourEnum(notFoundBehaviour);
			String fetchString = TranslateFetch(fetch);

			String closingTag = null;

			if (type == RelationType.Guess)
				throw new ActiveRecordException(string.Format("Failed to guess the relation for {0}", name));

			if (type == RelationType.Bag)
			{
				closingTag = "</bag>";

				AppendF("<bag{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}>",
				        MakeAtt("name", name),
				        MakeAtt("access", accessString),
				        WriteIfNonNull("table", table),
				        WriteIfNonNull("schema", schema),
				        MakeAtt("lazy", lazy),
				        WriteIfTrue("inverse", inverse),
				        WriteIfNonNull("cascade", cascade),
				        WriteIfNonNull("order-by", orderBy),
				        WriteIfNonNull("where", where),
				        WriteIfNonNull("fetch", fetchString),						
                        WriteIfNotOne("batch-size", batchSize),
						WriteIfNonNull("collection-type", MakeTypeName(collectionType)));
			}
			else if (type == RelationType.Set)
			{
				closingTag = "</set>";

				AppendF("<set{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}>",
				        MakeAtt("name", name),
				        MakeAtt("access", accessString),
				        WriteIfNonNull("table", table),
				        WriteIfNonNull("schema", schema),
				        MakeAtt("lazy", lazy),
				        WriteIfTrue("inverse", inverse),
				        WriteIfNonNull("cascade", cascade),
				        WriteIfNonNull("order-by", orderBy),
				        WriteIfNonNull("where", where),
				        WriteIfNonNull("sort", sort),
                        WriteIfNonNull("fetch", fetchString),
						WriteIfNotOne("batch-size", batchSize),
						WriteIfNonNull("collection-type", MakeTypeName(collectionType)));
			}
			else if (type == RelationType.IdBag)
			{
				closingTag = "</idbag>";

				AppendF("<idbag{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}>",
				        MakeAtt("name", name),
				        MakeAtt("access", accessString),
				        WriteIfNonNull("table", table),
				        WriteIfNonNull("schema", schema),
				        MakeAtt("lazy", lazy),
				        WriteIfNonNull("cascade", cascade),
				        WriteIfNonNull("order-by", orderBy),
				        WriteIfNonNull("where", where),
                        WriteIfNonNull("fetch", fetchString),
						WriteIfNotOne("batch-size", batchSize),
						WriteIfNonNull("collection-type", MakeTypeName(collectionType)));
				extraModelVisited = true;
				Ident();
				VisitNode(extraModel);
				Dedent();
			}
			else if (type == RelationType.Map)
			{
				closingTag = "</map>";

				AppendF("<map{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}>",
				        MakeAtt("name", name),
				        MakeAtt("access", accessString),
				        WriteIfNonNull("table", table),
				        WriteIfNonNull("schema", schema),
				        MakeAtt("lazy", lazy),
				        WriteIfTrue("inverse", inverse),
				        WriteIfNonNull("cascade", cascade),
				        WriteIfNonNull("order-by", orderBy),
				        WriteIfNonNull("where", where),
				        WriteIfNonNull("sort", sort),
                        WriteIfNonNull("fetch", fetchString),
						WriteIfNotOne("batch-size", batchSize),
						WriteIfNonNull("collection-type", MakeTypeName(collectionType)));
			}
			else if (type == RelationType.List)
			{
				closingTag = "</list>";
				AppendF("<list{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}>",
				        MakeAtt("name", name),
				        MakeAtt("access", accessString),
				        WriteIfNonNull("table", table),
				        WriteIfNonNull("schema", schema),
				        MakeAtt("lazy", lazy),
				        WriteIfTrue("inverse", inverse),
				        WriteIfNonNull("cascade", cascade),
				        WriteIfNonNull("where", where),
                        WriteIfNonNull("fetch", fetchString),
						WriteIfNotOne("batch-size", batchSize),
						WriteIfNonNull("collection-type", MakeTypeName(collectionType)));
			}


			Ident();

			WriteCache(cache, cacheregion);

			if (columnKey == null)
			{
				Append("<key>");
				Ident();
				WriteCompositeColumns(compositeKeyColumnKeys);
				Dedent();
				Append("</key>");
			}
			else
			{
				WriteKey(columnKey);
			}

			if (type == RelationType.Map || type == RelationType.List)
			{
				WriteIndex(index, indexType);
			}

			if (element != null || elementType != null)
			{
				WriteElement(element, elementType, targetType);
			}
			else if (columnRef == null && compositeKeyColumnRefs == null)
			{
				if (extraModel == null)
				{
					WriteOneToMany(targetType, notFoundMode);
				}
				else if (!extraModelVisited)
				{
					VisitNode(extraModel);
				}
			}
			else
			{
				if (columnRef != null)
				{
					WriteManyToMany(targetType, columnRef, notFoundMode);
				}
				else
				{
					WriteManyToMany(targetType, compositeKeyColumnRefs, notFoundMode);
				}
			}

			Dedent();

			Append(closingTag);
		}
Exemplo n.º 21
0
        /// <summary>
        /// 设置List对象缓存且支持基础数据类型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        /// <param name="expiry"></param>
        /// <param name="cacheType"></param>
        /// <returns>失败的键值</returns>
        public static async Task <List <string> > SetListAsync <T>(Dictionary <string, object> obj, TimeSpan?expiry = default(TimeSpan?), CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.SetListAsync <T>(obj, expiry));
        }
Exemplo n.º 22
0
 /// <summary>
 /// 根据枚举获取Key值
 /// </summary>
 /// <param name="cacheEnum"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 private static string GetKey(CacheEnum cacheEnum, string key)
 {
     return($"{ cacheEnum.ToString()}-{key}");
 }
Exemplo n.º 23
0
        /// <summary>
        /// 查询List字符串缓存
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static async Task <Dictionary <string, string> > GetStringListAsync(List <string> keys, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.GetStringListAsync(keys));
        }
Exemplo n.º 24
0
        protected int RedisExpireTime;                                               //redis默认过期时间(分钟)

        /// <summary>
        /// 指定缓存类型
        /// </summary>
        /// <param name="CacheName"></param>
        public CacheClient(CacheEnum CacheName = CacheEnum.RedisCache)
        {
            GetCacheConfig(CacheName);
        }
Exemplo n.º 25
0
		private static string TranslateCacheEnum(CacheEnum cacheEnum)
		{
			if (cacheEnum == CacheEnum.ReadOnly)
			{
				return "read-only";
			}
			else if (cacheEnum == CacheEnum.ReadWrite)
			{
				return "read-write";
			}
			else
			{
				return "nonstrict-read-write";
			}
		}
Exemplo n.º 26
0
        /// <summary>
        /// 设置对象缓存且支持基础数据类型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="obj"></param>
        /// <param name="expiry"></param>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static bool Set <T>(string key, T obj, TimeSpan?expiry = default(TimeSpan?), CacheEnum cacheType = 0)
        {
            //读取缓存。读取默认缓存与方法传进来的缓存,以方法传进来的缓存为优先级最高。
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(cache.Set(key, obj, expiry));
        }
Exemplo n.º 27
0
		private void WriteCache(CacheEnum cacheEnum, string cacheregion)
		{
			if (cacheEnum != CacheEnum.Undefined)
			{
				AppendF("<cache{1} usage=\"{0}\" />", TranslateCacheEnum(cacheEnum), WriteIfNonNull("region", cacheregion));
			}
		}
Exemplo n.º 28
0
        public static async Task <long> ListRemoveStringAsync(string key, string value, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(await cache.ListRemoveStringAsync(key, value));
        }
Exemplo n.º 29
0
 /// <summary>
 /// 指定缓存类型,指定区
 /// </summary>
 /// <param name="_redisdb"></param>
 public ContentCache(CacheEnum CacheName, DBEnum _redisdb)
 {
     client = new CacheClient(CacheName).CreateInstance(_redisdb);//创建缓存对象cache、memcache或redis
 }
Exemplo n.º 30
0
 public ICacheService GetCacheService(CacheEnum cacheEnum) => cacheEnum switch
 {
Exemplo n.º 31
0
        BlendShapeClip LoadBlendShapeBind(glTF_VRM_BlendShapeGroup group, Dictionary <Mesh, Transform> transformMeshTable)
        {
            var asset     = ScriptableObject.CreateInstance <BlendShapeClip>();
            var groupName = group.name;
            var prefix    = "BlendShape.";

            while (groupName.StartsWith(prefix))
            {
                groupName = groupName.Substring(prefix.Length);
            }
            asset.name = "BlendShape." + groupName;

            if (group != null)
            {
                asset.BlendShapeName = groupName;
                asset.Preset         = CacheEnum.TryParseOrDefault <BlendShapePreset>(group.presetName, true);
                asset.IsBinary       = group.isBinary;
                if (asset.Preset == BlendShapePreset.Unknown)
                {
                    // fallback
                    asset.Preset = CacheEnum.TryParseOrDefault <BlendShapePreset>(group.name, true);
                }
                asset.Values = group.binds.Select(x =>
                {
                    var mesh         = Meshes[x.mesh].Mesh;
                    var node         = transformMeshTable[mesh];
                    var relativePath = UniGLTF.UnityExtensions.RelativePathFrom(node, Root.transform);
                    return(new BlendShapeBinding
                    {
                        RelativePath = relativePath,
                        Index = x.index,
                        Weight = x.weight,
                    });
                })
                               .ToArray();
                asset.MaterialValues = group.materialValues.Select(x =>
                {
                    var value = new Vector4();
                    for (int i = 0; i < x.targetValue.Length; ++i)
                    {
                        switch (i)
                        {
                        case 0: value.x = x.targetValue[0]; break;

                        case 1: value.y = x.targetValue[1]; break;

                        case 2: value.z = x.targetValue[2]; break;

                        case 3: value.w = x.targetValue[3]; break;
                        }
                    }

                    var material     = GetMaterials().FirstOrDefault(y => y.name == x.materialName);
                    var propertyName = x.propertyName;
                    if (x.propertyName.EndsWith("_ST_S") ||
                        x.propertyName.EndsWith("_ST_T"))
                    {
                        propertyName = x.propertyName.Substring(0, x.propertyName.Length - 2);
                    }

                    var binding = default(MaterialValueBinding?);

                    if (material != null)
                    {
                        try
                        {
                            binding = new MaterialValueBinding
                            {
                                MaterialName = x.materialName,
                                ValueName    = x.propertyName,
                                TargetValue  = value,
                                BaseValue    = material.GetColor(propertyName),
                            };
                        }
                        catch (Exception)
                        {
                            // do nothing
                        }
                    }

                    return(binding);
                })
                                       .Where(x => x.HasValue)
                                       .Select(x => x.Value)
                                       .ToArray();
            }

            return(asset);
        }
Exemplo n.º 32
0
        /// <summary>
        /// 修改List key缓存时间
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="expiry"></param>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static List <string> UpdateExpiryList(List <string> keys, TimeSpan expiry, CacheEnum cacheType = 0)
        {
            cacheType = GetCacheType(cacheType);
            ICacheAssemble cache = GetCache(cacheType);

            return(cache.UpdateExpiryList(keys, expiry));
        }