fna-workbench

fna-workbench Git Source Tree


Root/src/Utilities/AssemblyHelper.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
 
using System;
using System.Reflection;
 
namespace MonoGame.Utilities
{
    internal static class AssemblyHelper
    {
        public static string GetDefaultWindowTitle()
        {
            // Set the window title.
            string windowTitle = string.Empty;
 
            // When running unit tests this can return null.
            var assembly = Assembly.GetEntryAssembly();
            if (assembly != null)
            {
                // Use the Title attribute of the Assembly if possible.
                var assemblyTitleAtt = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute)));
                if (assemblyTitleAtt != null)
                    windowTitle = assemblyTitleAtt.Title;
 
                // Otherwise, fallback to the Name of the assembly.
                if (string.IsNullOrEmpty(windowTitle))
                    windowTitle = assembly.GetName().Name;
            }
 
            return windowTitle;
        }
    }
}

Archive Download this file

Branches

Number of commits:
Page rendered in 0.09722s using 11 queries.