Exemplo n.º 1
0
 public virtual TypeSearcherDatabase AddEnums()
 {
     RegisterTypesFromMetadata((items, metadata) =>
     {
         var enumItem = new TypeSearcherItem(metadata.TypeHandle, metadata.FriendlyName);
         return(items.TryAddEnumItem(enumItem, metadata));
     });
     return(this);
 }
Exemplo n.º 2
0
 public virtual TypeSearcherDatabase AddClasses()
 {
     RegisterTypesFromMetadata((items, metadata) =>
     {
         var classItem = new TypeSearcherItem(metadata.TypeHandle, metadata.FriendlyName);
         return(items.TryAddClassItem(m_Stencil, classItem, metadata));
     });
     return(this);
 }
Exemplo n.º 3
0
        public virtual TypeSearcherDatabase AddGraphs()
        {
            RegisterTypes(items =>
            {
                var assetGUIDs = AssetDatabase.FindAssets($"t:{typeof(VSGraphAssetModel).Name}");
                var graphs     = assetGUIDs.Select(p =>
                                                   AssetDatabase.LoadAssetAtPath <VSGraphAssetModel>(AssetDatabase.GUIDToAssetPath(p))
                                                   ).Where(x => x.GraphModel?.Stencil.GetType() != typeof(MacroStencil));

                foreach (var meta in graphs.Select(graph => graph.GenerateTypeHandle(m_Stencil).GetMetadata(m_Stencil)))
                {
                    var graphItem = new TypeSearcherItem(meta.TypeHandle, meta.Name);
                    items.TryAddGraphItem(graphItem, meta);
                }
            });
            return(this);
        }