public void AddInterface(Type type) { if (_interfaceMap.ContainsKey(type)) { return; } var tsInterface = new TSInterface(type, GenerateLookupTypeName); _interfaceMap.Add(type, tsInterface); tsInterface.Initialize(); }
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); }