Exemple #1
0
        private void EditorForm_Load(object sender, EventArgs e)
        {
            if (WinFormsUtility.IsDesignerHosted(this))
            {
                return;
            }

            //hide ribbon to avoid redrawing
            kryptonRibbon.Visible = false;

            // create cover
            coverControl           = new Control();
            coverControl.BackColor = Color.FromArgb(40, 40, 40);
            coverControl.Dock      = DockStyle.Fill;
            Controls.Add(coverControl);
            coverControl.BringToFront();
            Application.DoEvents();

            ////dpi
            //try
            //{
            //	using( Graphics graphics = CreateGraphics() )
            //	{
            //		dpi = graphics.DpiX;
            //	}
            //}
            //catch( Exception ex )
            //{
            //	dpi = 96;
            //	Log.Warning( "EditorForm: CreateGraphics: Call failed. " + ex.Message );
            //}

            kryptonRibbon.RibbonTabs.Clear();

            {
                EngineApp.InitSettings.UseApplicationWindowHandle = Handle;

                if (!EngineApp.Create())
                {
                    Log.Fatal("EngineApp.Create() failed.");
                    Close();
                    return;
                }

                //эксепшен не генегируется, просто падает

                //bool created = false;

                //if( Debugger.IsAttached )
                //	created = EngineApp.Create();
                //else
                //{
                //	try
                //	{
                //		//!!!!
                //		Log.Info( "dd" );

                //		created = EngineApp.Create();

                //		//!!!!
                //		Log.Info( "tt" );

                //	}
                //	catch( Exception e2 )
                //	{
                //		//!!!!
                //		Log.Info( "ee" );

                //		Log.FatalAsException( e2.ToString() );
                //	}
                //}

                //if( !created )
                //{
                //	Log.Fatal( "EngineApp.Create() failed." );
                //	Close();
                //	return;
                //}
            }

            EngineApp.DefaultSoundChannelGroup.Volume = 0;

            EnableLocalization();
            PreviewImagesManager.Init();

            //set theme
            if (ProjectSettings.Get.Theme.Value == Component_ProjectSettings.ThemeEnum.Dark)
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlack;
            }
            else
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlue;
            }

            KryptonDarkThemeUtility.DarkTheme = EditorAPI.DarkTheme;
            if (EditorAPI.DarkTheme)
            {
                EditorAssemblyInterface.Instance.SetDarkTheme();
            }
            Aga.Controls.Tree.NodeControls.BaseTextControl.DarkTheme = EditorAPI.DarkTheme;

            BackColor = EditorAPI.DarkTheme ? Color.FromArgb(40, 40, 40) : Color.FromArgb(240, 240, 240);

            //app button
            kryptonRibbon.RibbonAppButton.AppButtonText = EditorLocalization.Translate("AppButton", kryptonRibbon.RibbonAppButton.AppButtonText);
            if (DarkTheme)
            {
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorDark  = Color.FromArgb(40, 40, 40);
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorLight = Color.FromArgb(54, 54, 54);
            }

            //!!!! default editor layout:

            // IsSystemWindow = true for this:
            // для этих "системных" окон используется отдельная логика сериализации (окна создаются до загрузки конфига)
            // и отдельная логика закрытия (hide/remove)
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ObjectsWindow(), new SettingsWindow() }, DockingEdge.Right);
            //workspaceController.AddDockspace(new MembersWindow(), "Members", DockingEdge.Right, new Size(300, 300));
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ResourcesWindow(), new SolutionExplorer(), new PreviewWindow() }, DockingEdge.Left);
            workspaceController.AddToDockspace(new DockWindow[] { new MessageLogWindow(), new OutputWindow(), new DebugInfoWindow() }, DockingEdge.Bottom);

            Log.Info("Use Log.Info(), Log.Warning() methods to write to the window. These methods can be used in the Player. Press '~' to open console of the Player.");
            OutputWindow.Print("Use OutputWindow.Print() method to write to the window. Unlike Message Log window, this window is not a list. Here you can add text in arbitrary format.\n");

            //!!!!эвент чтобы свои добавлять. и пример

            //load docking state
            {
                string configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileName);
                //default settings
                if (!File.Exists(configFile))
                {
                    configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileNameDefault);
                }

                if (File.Exists(configFile))
                {
                    //no try catch to save the ability to work with debugger. in case when error happens during loading one of documents

                    //try
                    //{
                    workspaceController.LoadLayoutFromFile(configFile);

                    //!!!!
                    //hack. unhide the page to load it correctly. after loading the page will hided
                    foreach (var page in workspaceController.DockingManager.Pages)
                    {
                        if (page.needHideAfterLoading)
                        {
                            page.needHideAfterLoading = false;

                            var window = page.GetDockWindow();
                            if (window != null)
                            {
                                workspaceController.SetDockWindowVisibility(window, false);
                            }
                        }
                    }

                    //}
                    //catch( Exception e2 )
                    //{
                    //	var text = $"Error loading docking settings.\n\n" + e2.Message;
                    //	Log.Warning( text );
                    //	EditorMessageBox.ShowWarning( text );
                    //}
                }
            }

            InitQAT();
            InitRibbon();

            UpdateText();

            //apply editor settings
            EditorSettingsSerialization.InitAfterFormLoad();

            XmlDocumentationFiles.PreloadBaseAssemblies();

            EditorAPI.SelectedDocumentWindowChanged += EditorAPI_SelectedDocumentWindowChanged;

            UpdateRecentProjectsInRegistry();

            LoginUtility.RequestFullLicenseInfo();

            kryptonRibbon.BeforeMinimizedModeChanged += KryptonRibbon_BeforeMinimizedModeChanged;
            kryptonRibbon.MinimizedModeChanged       += KryptonRibbon_MinimizedModeChanged;

            KryptonWinFormsUtility.editorFormStartTemporaryLockUpdateAction = delegate()
            {
                if (IsHandleCreated && !EditorAPI.ClosingApplication)
                {
                    KryptonWinFormsUtility.LockFormUpdate(this);
                    unlockFormUpdateInTimer = DateTime.Now + TimeSpan.FromSeconds(0.1);
                }
            };

            loaded = true;
        }
Exemple #2
0
        private void EditorForm_Load(object sender, EventArgs e)
        {
            if (EditorUtility.IsDesignerHosted(this))
            {
                return;
            }

            //hide ribbon to avoid redrawing
            kryptonRibbon.Visible = false;

            // create cover
            coverControl           = new Control();
            coverControl.BackColor = Color.FromArgb(40, 40, 40);
            // 127, 127, 127 );
            //coverControl.BackColor = DarkTheme ? Color.FromArgb( 40, 40, 40 ) : Color.FromArgb( 42, 87, 154 );
            //coverControl.BackColor = Color.Black;
            coverControl.Dock = DockStyle.Fill;
            Controls.Add(coverControl);
            coverControl.BringToFront();
            Application.DoEvents();

            //dpi
            try
            {
                using (Graphics graphics = CreateGraphics())
                {
                    dpi = graphics.DpiX;
                }
            }
            catch (Exception ex)
            {
                dpi = 96;
                Log.Warning("EditorForm: CreateGraphics: Call failed. " + ex.Message);
            }

            kryptonRibbon.RibbonTabs.Clear();

            {
                EngineApp.InitSettings.UseApplicationWindowHandle = Handle;

                if (!EngineApp.Create())
                {
                    Log.Fatal("EngineApp.Create() failed.");
                    Close();
                    return;
                }

                //эксепшен не генегируется, просто падает

                //bool created = false;

                //if( Debugger.IsAttached )
                //	created = EngineApp.Create();
                //else
                //{
                //	try
                //	{
                //		//!!!!
                //		Log.Info( "dd" );

                //		created = EngineApp.Create();

                //		//!!!!
                //		Log.Info( "tt" );

                //	}
                //	catch( Exception e2 )
                //	{
                //		//!!!!
                //		Log.Info( "ee" );

                //		Log.FatalAsException( e2.ToString() );
                //	}
                //}

                //if( !created )
                //{
                //	Log.Fatal( "EngineApp.Create() failed." );
                //	Close();
                //	return;
                //}
            }

            EngineApp.DefaultSoundChannelGroup.Volume = 0;

            //set theme
            if (ProjectSettings.Get.Theme.Value == Component_ProjectSettings.ThemeEnum.Dark)
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlack;
            }
            else
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlue;
            }

            KryptonDarkThemeUtility.DarkTheme = EditorAPI.DarkTheme;
            if (EditorAPI.DarkTheme)
            {
                EditorAssemblyInterface.Instance.SetDarkTheme();
            }

            Aga.Controls.Tree.NodeControls.BaseTextControl.DarkTheme = EditorAPI.DarkTheme;

            //app button
            kryptonRibbon.RibbonAppButton.AppButtonText = EditorLocalization.Translate("AppButton", kryptonRibbon.RibbonAppButton.AppButtonText);
            if (DarkTheme)
            {
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorDark  = Color.FromArgb(40, 40, 40);
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorLight = Color.FromArgb(54, 54, 54);
            }

            //!!!! default editor layout:

            // IsSystemWindow = true for this:
            // для этих "системных" окон используется отдельная логика сериализации (окна создаются до загрузки конфига)
            // и отдельная логика закрытия (hide/remove)
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ObjectsWindow(), new SettingsWindow() }, DockingEdge.Right);
            //workspaceController.AddDockspace(new MembersWindow(), "Members", DockingEdge.Right, new Size(300, 300));
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ResourcesWindow(), new SolutionExplorer(), new PreviewWindow() }, DockingEdge.Left);
            workspaceController.AddToDockspace(new DockWindow[] { new MessageLogWindow(), new OutputWindow(), new DebugInfoWindow() }, DockingEdge.Bottom);

            //!!!!
            //workspaceController.AddDockWindow( new TipsWindow(), true, false );

            //!!!!эвент чтобы свои добавлять. и пример

            //load docking state
            {
                string configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileName);
                //default settings
                if (!File.Exists(configFile))
                {
                    configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileNameDefault);
                }

                if (File.Exists(configFile))
                {
                    //try
                    //{
                    ////!!!! If xml broken, we will not get an exception.
                    //// the exception is swallowed inside the krypton.
                    //// how do I know if an error has occurred?
                    workspaceController.LoadLayoutFromFile(configFile);
                    //}
                    //	catch
                    //	{
                    //		//!!!!TODO: layout broken. fix this!
                    //	}
                }
            }

            InitQAT();
            InitRibbon();

            UpdateText();

            //apply editor settings
            EditorSettingsSerialization.InitAfterFormLoad();

            XmlDocumentationFiles.PreloadBaseAssemblies();

            EditorAPI.SelectedDocumentWindowChanged += EditorAPI_SelectedDocumentWindowChanged;

            UpdateRecentProjectsInRegistry();

            LoginUtility.RequestFullLicenseInfo();

            loaded = true;
        }
        static string GetMetadataText2(Type type, bool addNamespace, string linePrefix, ISymbol selectSymbol, out int outSelectLine)          //RangeI outSelectRange )
        {
            outSelectLine = 0;
            //outSelectRange = RangeI.Zero;

            var result = new StringBuilder();

            //!!!!пока доки берутся через XmlDocumentationFiles. потом нужно для всех .NET типов суппорт
            var engineType       = MetadataManager.GetTypeOfNetType(type);
            var netMemberSummary = new Dictionary <MemberInfo, string>();

            if (engineType != null)
            {
                foreach (var member in engineType.MetadataGetMembers())
                {
                    var id = XmlDocumentationFiles.GetMemberId(member);
                    if (!string.IsNullOrEmpty(id))
                    {
                        var summary = XmlDocumentationFiles.GetMemberSummary(id);
                        if (!string.IsNullOrEmpty(summary))
                        {
                            //!!!!глючит
                            //if( summary.Contains( "Calls " ) )
                            //{
                            //	Log.Info( "Dfdfg" );
                            //}

                            //
                            try
                            {
                                summary = Regex.Replace(summary, "<.*?>", string.Empty);
                            }
                            catch { }

                            var method = member as Metadata.NetTypeInfo.NetMethod;
                            if (method != null)
                            {
                                netMemberSummary[method.NetMember] = summary;
                            }

                            var property = member as Metadata.NetTypeInfo.NetProperty;
                            if (property != null)
                            {
                                netMemberSummary[property.NetMember] = summary;
                            }

                            var evn = member as Metadata.NetTypeInfo.NetEvent;
                            if (evn != null)
                            {
                                netMemberSummary[evn.NetMember] = summary;
                            }
                        }
                    }
                }
            }

            if (addNamespace)
            {
                result.AppendLine(linePrefix + "namespace " + type.Namespace);
                result.AppendLine(linePrefix + "{");
            }

            if (engineType != null)
            {
                var id = XmlDocumentationFiles.GetTypeId(engineType);
                if (!string.IsNullOrEmpty(id))
                {
                    var summary = XmlDocumentationFiles.GetMemberSummary(id);
                    if (!string.IsNullOrEmpty(summary))
                    {
                        result.AppendLine(linePrefix + "\t// " + summary);

                        //result.AppendLine( linePrefix + "\t//" );
                        //result.AppendLine( linePrefix + "\t// Summary:" );
                        //result.AppendLine( linePrefix + "\t//    " + "text" );
                    }
                }
            }

            {
                var line = "\t";

                if (type.IsPublic || type.IsNestedPublic)
                {
                    line += "public ";
                }
                else if (type.IsNestedFamily)
                {
                    line += "protected ";
                }

                if (type.IsAbstract && type.IsSealed)
                {
                    line += "static ";
                }
                if (type.IsAbstract)
                {
                    line += "abstract ";
                }
                else if (type.IsSealed)
                {
                    line += "sealed ";
                }

                if (type.IsValueType)
                {
                    line += "struct ";
                }
                else if (type.IsClass)
                {
                    line += "class ";
                }
                else if (type.IsInterface)
                {
                    line += "interface ";
                }

                line += type.Name;

                var baseType   = type.BaseType;
                var interfaces = GetDeclaredInterfaces(type);                  //type.GetInterfaces();
                if (baseType != null && baseType != typeof(object) && baseType != typeof(ValueType) || interfaces.Length != 0)
                {
                    line += " :";

                    bool more = false;

                    if (baseType != null && baseType != typeof(object) && baseType != typeof(ValueType))
                    {
                        line += " " + baseType.Name;
                        more  = true;
                    }

                    foreach (var iface in interfaces)
                    {
                        ////!!!!
                        //if( iface.DeclaringType != baseType )
                        //	continue;

                        if (more)
                        {
                            line += ",";
                        }
                        line += " " + GetNetTypeName(iface);
                        more  = true;
                    }
                }

                result.AppendLine(linePrefix + line);
            }

            result.AppendLine(linePrefix + "\t{");

            var addEmptyLine = false;

            var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            CollectionUtility.MergeSort(fields, delegate(FieldInfo m1, FieldInfo m2)
            {
                if (m1.IsStatic && !m2.IsStatic)
                {
                    return(-1);
                }
                if (!m1.IsStatic && m2.IsStatic)
                {
                    return(1);
                }
                return(0);
            });

            foreach (var netField in fields)
            {
                if (!netField.IsFamily && !netField.IsPublic)
                {
                    continue;
                }

                result.AppendLine(linePrefix + "\t\t//");
                if (netMemberSummary.TryGetValue(netField, out var summary))
                {
                    result.AppendLine(linePrefix + "\t\t// " + summary);
                }

                GetAttributesText(netField.GetCustomAttributesData(), linePrefix);

                var line = linePrefix + "\t\t";
                line += GetFieldText(netField);
                result.AppendLine(line);

                var fieldSymbol = selectSymbol as IFieldSymbol;
                if (fieldSymbol != null && fieldSymbol.Name == netField.Name)
                {
                    outSelectLine = result.ToString().Count(f => f == '\n');                      // + 1;
                }
                addEmptyLine = true;
            }

            if (addEmptyLine)
            {
                result.AppendLine(linePrefix + "\t\t");
            }
            addEmptyLine = false;

            var constructors = type.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            CollectionUtility.MergeSort(constructors, delegate(ConstructorInfo m1, ConstructorInfo m2)
            {
                if (m1.IsStatic && !m2.IsStatic)
                {
                    return(-1);
                }
                if (!m1.IsStatic && m2.IsStatic)
                {
                    return(1);
                }
                return(0);
            });

            foreach (var netMethod in constructors)
            {
                if (!netMethod.IsFamily && !netMethod.IsPublic)
                {
                    continue;
                }
                //if( netMethod.IsSpecialName )
                //{
                //	if( netMethod.Name.Length > 4 && ( netMethod.Name.Substring( 0, 4 ) == "get_" || netMethod.Name.Substring( 0, 4 ) == "set_" ) )
                //		continue;
                //	if( netMethod.Name.Length > 4 && netMethod.Name.Substring( 0, 4 ) == "add_" )
                //		continue;
                //	if( netMethod.Name.Length > 7 && netMethod.Name.Substring( 0, 7 ) == "remove_" )
                //		continue;
                //}
                //if( netMethod.GetBaseDefinition() != netMethod )
                //	continue;

                result.AppendLine(linePrefix + "\t\t//");
                if (netMemberSummary.TryGetValue(netMethod, out var summary))
                {
                    result.AppendLine(linePrefix + "\t\t// " + summary);
                }

                GetAttributesText(netMethod.GetCustomAttributesData(), linePrefix);

                var line = linePrefix + "\t\t";
                line += GetMethodText(netMethod);
                result.AppendLine(line);

                var methodSymbol = selectSymbol as IMethodSymbol;
                if (methodSymbol != null && methodSymbol.Name == netMethod.Name)
                {
                    outSelectLine = result.ToString().Count(f => f == '\n');                      // + 1;
                }
                addEmptyLine = true;
            }

            if (addEmptyLine)
            {
                result.AppendLine(linePrefix + "\t\t");
            }
            addEmptyLine = false;

            var properties = type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            CollectionUtility.MergeSort(properties, delegate(PropertyInfo m1, PropertyInfo m2)
            {
                var getMethod1 = m1.GetGetMethod(true);
                var getMethod2 = m2.GetGetMethod(true);
                if (getMethod1 != null && getMethod2 != null)
                {
                    if (getMethod1.IsStatic && !getMethod2.IsStatic)
                    {
                        return(-1);
                    }
                    if (!getMethod1.IsStatic && getMethod2.IsStatic)
                    {
                        return(1);
                    }
                }
                return(0);
            });

            foreach (var netProperty in properties)
            {
                var getMethod = netProperty.GetGetMethod(true);
                if (getMethod != null)
                {
                    if (!getMethod.IsFamily && !getMethod.IsPublic)
                    {
                        continue;
                    }
                }

                result.AppendLine(linePrefix + "\t\t//");
                if (netMemberSummary.TryGetValue(netProperty, out var summary))
                {
                    result.AppendLine(linePrefix + "\t\t// " + summary);
                }

                GetAttributesText(netProperty.GetCustomAttributesData(), linePrefix);

                var line = linePrefix + "\t\t";
                line += GetPropertyText(netProperty);
                result.AppendLine(line);

                var propertySymbol = selectSymbol as IPropertySymbol;
                if (propertySymbol != null && propertySymbol.Name == netProperty.Name)
                {
                    outSelectLine = result.ToString().Count(f => f == '\n');                      // + 1;
                }
                addEmptyLine = true;
            }

            if (addEmptyLine)
            {
                result.AppendLine(linePrefix + "\t\t");
            }
            addEmptyLine = false;

            var events = type.GetEvents(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            CollectionUtility.MergeSort(events, delegate(EventInfo m1, EventInfo m2)
            {
                var method1 = m1.GetAddMethod(true);
                var method2 = m2.GetAddMethod(true);
                if (method1 != null && method2 != null)
                {
                    if (method1.IsStatic && !method2.IsStatic)
                    {
                        return(-1);
                    }
                    if (!method1.IsStatic && method2.IsStatic)
                    {
                        return(1);
                    }
                }
                return(0);
            });

            foreach (var netEvent in events)
            {
                var method = netEvent.GetAddMethod(true);
                if (method != null)
                {
                    if (!method.IsFamily && !method.IsPublic)
                    {
                        continue;
                    }
                }

                result.AppendLine(linePrefix + "\t\t//");
                if (netMemberSummary.TryGetValue(netEvent, out var summary))
                {
                    result.AppendLine(linePrefix + "\t\t// " + summary);
                }

                GetAttributesText(netEvent.GetCustomAttributesData(), linePrefix);

                int textOffset = result.Length;

                var line = linePrefix + "\t\t";
                line += GetEventText(netEvent);                  //, out var nameRange );
                result.AppendLine(line);

                var eventSymbol = selectSymbol as IEventSymbol;
                if (eventSymbol != null && eventSymbol.Name == netEvent.Name)
                {
                    outSelectLine = result.ToString().Count(f => f == '\n');                      // + 1;

                    //outSelectRange = new RangeI( nameRange.Minimum + textOffset, nameRange.Maximum + textOffset );

                    //var text = editor2.Document.Text;
                    //if( text.Length >= span.Start )
                    //{
                    //	var text2 = text.Substring( 0, span.Start );
                    //	int line = text2.Count( f => f == '\n' ) + 1;
                    //	editor2.ScrollToLine( line );
                    //}

                    //!!!!
                    //eventSymbol.Name
                }

                addEmptyLine = true;
            }

            if (addEmptyLine)
            {
                result.AppendLine(linePrefix + "\t\t");
            }
            addEmptyLine = false;

            var methods = type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            CollectionUtility.MergeSort(methods, delegate(MethodInfo m1, MethodInfo m2)
            {
                if (m1.IsStatic && !m2.IsStatic)
                {
                    return(-1);
                }
                if (!m1.IsStatic && m2.IsStatic)
                {
                    return(1);
                }
                return(0);
            });

            foreach (var netMethod in methods)
            {
                if (!netMethod.IsFamily && !netMethod.IsPublic)
                {
                    continue;
                }
                if (netMethod.IsSpecialName)
                {
                    if (netMethod.Name.Length > 4 && (netMethod.Name.Substring(0, 4) == "get_" || netMethod.Name.Substring(0, 4) == "set_"))
                    {
                        continue;
                    }
                    if (netMethod.Name.Length > 4 && netMethod.Name.Substring(0, 4) == "add_")
                    {
                        continue;
                    }
                    if (netMethod.Name.Length > 7 && netMethod.Name.Substring(0, 7) == "remove_")
                    {
                        continue;
                    }
                }
                if (netMethod.GetBaseDefinition() != netMethod)
                {
                    continue;
                }

                result.AppendLine(linePrefix + "\t\t//");
                if (netMemberSummary.TryGetValue(netMethod, out var summary))
                {
                    result.AppendLine(linePrefix + "\t\t// " + summary);
                }

                GetAttributesText(netMethod.GetCustomAttributesData(), linePrefix);

                var line = linePrefix + "\t\t";
                line += GetMethodText(netMethod);
                result.AppendLine(line);

                //!!!!override methods support
                var methodSymbol = selectSymbol as IMethodSymbol;
                if (methodSymbol != null && methodSymbol.Name == netMethod.Name)
                {
                    outSelectLine = result.ToString().Count(f => f == '\n');                      // + 1;
                }
                addEmptyLine = true;
            }

            //nested types
            bool existsNestedTypes = false;

            foreach (var nestedType in type.GetNestedTypes())
            {
                if (typeof(Delegate).IsAssignableFrom(nestedType))
                {
                    continue;
                }
                if (typeof(Enum).IsAssignableFrom(nestedType))
                {
                    continue;
                }

                result.AppendLine(linePrefix + "\t");

                var text = GetMetadataText2(nestedType, false, linePrefix + "\t", null, out _);
                result.Append(text);

                existsNestedTypes = true;
            }
            if (existsNestedTypes)
            {
                result.AppendLine(linePrefix);
            }

            result.AppendLine(linePrefix + "\t}");
            if (addNamespace)
            {
                result.AppendLine(linePrefix + "}");
            }

            return(result.ToString());
        }