示例#1
0
        public void AddInterface(Type type)
        {
            if (_interfaceMap.ContainsKey(type))
            {
                return;
            }

            var tsInterface = new TSInterface(type, GenerateLookupTypeName);

            _interfaceMap.Add(type, tsInterface);
            tsInterface.Initialize();
        }
示例#2
0
        public void AddSubNamespaceType(List <string> ns, Type type)
        {
            if (ns.Count == 0)
            {
                var ti = type.GetTypeInfo();
                if (ti.IsEnum)
                {
                    if (Settings.ConstEnumsEnabled)
                    {
                        var tsconstenum = new TSConstEnumeration(type)
                        {
                            IsExported = true
                        };
                        Enumerations.Add(tsconstenum);
                    }
                    return;
                }
                var tsinterface = new TSInterface(type, _mapType)
                {
                    IsExported = true
                };
                Interfaces.Add(tsinterface);

                return;
            }

            var root = ns.First();

            var mod = SubModules.FirstOrDefault(m => m.Name == root);

            if (mod == null)
            {
                mod = new TSModule(root, _mapType);
                SubModules.Add(mod);
            }

            ns.RemoveAt(0);

            mod.AddSubNamespaceType(ns, type);
        }
        public void AddSubNamespaceType(List<string> ns, Type type)
        {
            if (ns.Count == 0)
            {
                if (type.IsEnum)
                {
                    if (Settings.ConstEnumsEnabled)
                    {
                        var tsconstenum = new TSConstEnumeration(type)
                        {
                            IsExported = true
                        };
                        Enumerations.Add(tsconstenum);
                    }
                    return;
                }
                var tsinterface = new TSInterface(type, _mapType)
                {
                    IsExported = true
                };
                Interfaces.Add(tsinterface);

                return;

            }

            var root = ns.First();

            var mod = SubModules.FirstOrDefault(m => m.Name == root);
            if (mod == null)
            {
                mod = new TSModule(root, _mapType);
                SubModules.Add(mod);
            }

            ns.RemoveAt(0);

            mod.AddSubNamespaceType(ns, type);
        }