static private void generateSnippets(IEnumerable <Type> types)
        {
            Configuration configuration = Utility.GetConfiguration();

            if (null != configuration)
            {
                BinderBase.SetLibraryOutputPath(configuration.snippetsOutputPath);
            }
            NamespaceBinder.Clear();

            List <Type> nestedTypes = new List <Type>();

            foreach (Type type in types)
            {
                if (type.IsNested)
                {
                    nestedTypes.Add(type);
                    continue;
                }
                generateSnippet(type);
            }
            foreach (Type type in nestedTypes)
            {
                generateSnippet(type);
            }

            foreach (NamespaceBinder space in NamespaceBinder.Spaces)
            {
                space.GenerateSnippets(true);
            }
            Entry.Log("General.Typescript snippets generate successfully!");
        }
        static private void generateBinders(IEnumerable <Type> types, List <Type> delegates)
        {
            Configuration configuration = Utility.GetConfiguration();

            if (null != configuration)
            {
                BinderBase.SetBinderOutputPath(configuration.bindersOutputPath);
            }
            NamespaceBinder.Clear();

            List <Type> nestedTypes = new List <Type>();

            foreach (Type type in types)
            {
                if (type.IsNested)
                {
                    nestedTypes.Add(type);
                    continue;
                }
                generateBinder(type);
            }
            foreach (Type type in nestedTypes)
            {
                generateBinder(type);
            }

            foreach (NamespaceBinder space in NamespaceBinder.Spaces)
            {
                space.GenerateBinder(delegates, true);
            }

            AssetDatabase.Refresh();
            Entry.Log("General.Typescript binders generate successfully!");
        }
Exemple #3
0
 static internal ClassBinder Create(Type type, BinderBase parent)
 {
     if (Utils.IsSupported(type))
     {
         return(type.IsEnum ? EnumClassBinder.Create(type, parent) as ClassBinder : TypeClassBinder.Create(type, parent) as ClassBinder);
     }
     return(null);
 }
Exemple #4
0
 internal ClassBinder(Type type, BinderBase parent) : base(type.Name, parent, type.Name + "Binder", type.FullName.Replace(".", "").Replace("+", ""))
 {
     mType = type;
     if (mType.IsNested)
     {
         mFullname = mType.FullName.Replace('+', '.');
     }
 }
Exemple #5
0
 protected override void addChild(BinderBase child)
 {
     base.addChild(child);
     if (child is NamespaceBinder)
     {
         mSpaces.Add(child.Name, child as NamespaceBinder);
     }
 }
 internal TypeClassBinder(Type type, BinderBase parent) : base(type, parent)
 {
     mConstructors       = this.pickConstructors();
     mStaticMethods      = this.pickStaticMethods();
     mInstanceMethods    = this.pickInstanceMethods();
     mStaticProperties   = this.pickProperties(BindingFlags.Static);
     mInstanceProperties = this.pickProperties(BindingFlags.Instance);
     mInstanceFields     = this.pickFileds();
 }
 protected virtual void addChild(BinderBase child)
 {
     if (mChildren.ContainsKey(child.Name))
     {
         BinderBase exist = mChildren[child.Name];
         Entry.Log(exist.Fullname);
         Entry.LogError("There is already a child named {0} in {1}!", child.Name, mName);
     }
     else
     {
         mChildren.Add(child.Name, child);
     }
 }
 internal BinderBase(string name, BinderBase parent, string filename, string bindername)
 {
     mName       = name;
     mParent     = parent;
     mFilename   = filename;
     mBinderName = bindername;
     if (null == mParent)
     {
         mFullname = mName;
     }
     else
     {
         mFullname = mParent.Fullname + "." + mName;
         mParent.addChild(this);
     }
 }
 internal EnumClassBinder(Type type, BinderBase parent) : base(type, parent)
 {
 }
 static new internal EnumClassBinder Create(Type mType, BinderBase parent)
 {
     return(new EnumClassBinder(mType, parent));
 }
 internal BinderBase(string name, BinderBase parent) : this(name, parent, name + "Binder", name + "Binder")
 {
 }