Пример #1
0
        public static ResourceType GetTypeByName(string name)
        {
            ResourceType t;

            types.TryGetValue(name, out t);
            return(t);
        }
Пример #2
0
        /////////////////////////////////////////

        public static Component_Mesh GetMesh(RectangleF uv)
        {
            //try to get from the cache
            if (items.TryGetValue(uv, out var item))
            {
                item.EngineTime = Time.Current;

                items.Remove(uv);
                items.Add(uv, item);

                return(item.Mesh);
            }

            //remove old item from the cache
            if (items.Count >= MaxCacheSize)
            {
                foreach (var pair in items)
                {
                    if (pair.Value.EngineTime != Time.Current)
                    {
                        pair.Value.Dispose();
                        items.Remove(pair.Key);
                        break;
                    }
                }
            }

            //create item and add to the cache
            item = new Item(uv);
            items.Add(uv, item);

            return(item.Mesh);
        }
Пример #3
0
 public static Resource GetByName(string name)
 {
     lock ( lockObject )
     {
         Resource r;
         resources.TryGetValue(GetKey(name), out r);
         return(r);
     }
 }
Пример #4
0
 public static RegisteredAssemblyItem GetRegisteredAssembly(Assembly assembly)
 {
     lock ( registeredAssemblies )
     {
         RegisteredAssemblyItem item;
         if (registeredAssemblies.TryGetValue(assembly, out item))
         {
             return(item);
         }
         return(null);
     }
 }
Пример #5
0
            public override Metadata.TypeInfo MetadataGetType(string pathInside)
            {
                if (assembly != null)
                {
                    if (typeByPathInside == null)
                    {
                        typeByPathInside = new EDictionary <string, Metadata.TypeInfo>();

                        foreach (var netType in assembly.GetExportedTypes())
                        {
                            var type = MetadataManager.GetTypeOfNetType(netType);                              //, false );

                            //!!!!так?
                            string pathInside2;
                            {
                                int index = type.Name.IndexOf('|');
                                if (index != -1)
                                {
                                    pathInside2 = type.Name.Substring(index + 1);
                                }
                                else
                                {
                                    pathInside2 = "";
                                }
                            }

                            typeByPathInside[pathInside2] = type;
                        }
                    }

                    {
                        Metadata.TypeInfo type;
                        typeByPathInside.TryGetValue(pathInside, out type);
                        return(type);
                    }
                }

                return(base.MetadataGetType(pathInside));
            }