コード例 #1
0
        public void AddEnumeration(Type enumeration)
        {
            if (_enumerationsMap.ContainsKey(enumeration))
            {
                return;
            }

            var enumerationTS = new TSConstEnumeration(enumeration);

            _enumerationsMap.Add(enumeration, enumerationTS);
            enumerationTS.Initialize();
        }
コード例 #2
0
ファイル: TSModule.cs プロジェクト: timk-kl/.NetTSGenerator
        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);
        }
コード例 #3
0
        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);
        }