コード例 #1
0
        protected void PrintHeader()
        {
            if (ChoCommandLineParserSettings.Me.DoNotShowHeader)
            {
                return;
            }

            if (Silent)
            {
                return;
            }

            lock (_padLock)
            {
                if (_isHeaderPrinted)
                {
                    return;
                }
                _isHeaderPrinted = true;
            }

            string applicationName = ApplicationName;

            if (applicationName.IsNullOrWhiteSpace())
            {
                applicationName = ChoAssembly.GetAssemblyTitle();
                if (applicationName.IsNullOrWhiteSpace())
                {
                    applicationName = ChoApplication.EntryAssemblyFileName;
                    //if (Assembly.GetEntryAssembly() != null && !Assembly.GetEntryAssembly().FullName.IsNullOrWhiteSpace()
                    //    && Assembly.GetEntryAssembly().FullName.IndexOf(',') > 0)
                    //    applicationName = Assembly.GetEntryAssembly().FullName.SplitNTrim(',')[0]; // EntryAssemblyFileName; //ChoGlobalApplicationSettings.Me.ApplicationName;
                }
            }
            if (applicationName.IsNullOrWhiteSpace())
            {
                applicationName = "Unknown";
            }

            string version = Version;

            if (version.IsNullOrWhiteSpace())
            {
                version = ChoAssembly.GetEntryAssembly().GetName().Version.ToString();
            }

            Console.WriteLine("{0} [Version {1}]".FormatString(applicationName, version));

            string copyright = Copyright;

            if (copyright.IsNullOrWhiteSpace())
            {
                copyright = ChoAssembly.GetAssemblyCopyright();
            }

            if (!copyright.IsNullOrWhiteSpace())
            {
                Console.WriteLine(copyright);
            }

            string description = Description;

            if (description.IsNullOrWhiteSpace())
            {
                description = ChoAssembly.GetAssemblyDescription();
            }

            if (!description.IsNullOrWhiteSpace())
            {
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine(description);
            }

            if (!AdditionalInfo.IsNullOrWhiteSpace())
            {
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine(AdditionalInfo);
            }

            Console.WriteLine();
        }