Skip to content

Commit

Permalink
Reduces size of vanity message (closes #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
serialseb committed Apr 6, 2012
1 parent eff3f24 commit 12c91d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
14 changes: 11 additions & 3 deletions src/OpenWrap.Shell/BootstrapRunner.cs
Expand Up @@ -159,16 +159,24 @@ void LogFoundPackages(IEnumerable<string> bootstrapPackages)

void NotifyVersion(Assembly assembly)
{
Version fileVersion = null;
SemanticVersion fileVersion = null;
try
{
var version = FileVersionInfo.GetVersionInfo(assembly.Location);
fileVersion = new Version(version.FileVersion);
fileVersion = SemanticVersion.TryParseExact(version.FileVersion);
}
catch
{
}
_notifier.BootstraperIs(assembly.Location, fileVersion ?? assembly.GetName().Version);
if (fileVersion == null)
{
var attrib = Attribute.GetCustomAttribute(assembly, typeof(AssemblyInformationalVersionAttribute));
if (attrib != null)
fileVersion = SemanticVersion.TryParseExact(((AssemblyInformationalVersionAttribute)attrib).InformationalVersion);
}
if (fileVersion == null)
fileVersion = SemanticVersion.TryParseExact(assembly.GetName().Version.ToString());
_notifier.BootstraperIs(assembly.Location, fileVersion);
}
BootstrapResult ExecuteEntrypoint(string[] args, KeyValuePair<Type, Func<string[], int>> entryPoint)
{
Expand Down
14 changes: 9 additions & 5 deletions src/OpenWrap.Shell/ConsoleNotifier.cs
@@ -1,19 +1,23 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace OpenWrap
{
public class ConsoleNotifier : INotifier
{
int _downloadProgress;

public void BootstraperIs(string entrypointFile, Version entrypointVersion)
public void BootstraperIs(string entrypointFile, SemanticVersion entrypointVersion)
{
var version = FileVersionInfo.GetVersionInfo(typeof(ConsoleNotifier).Assembly.Location);
Console.WriteLine("# OpenWrap Shell {0}", version.FileVersion);
Console.WriteLine("# " + version.LegalCopyright);
Console.WriteLine("# Using {0} ({1})", entrypointFile, entrypointVersion);
Console.WriteLine();
var entrypointName = AssemblyName.GetAssemblyName(entrypointFile).Name;
Console.WriteLine("# {0} v{1} (shell v{2})", entrypointName, entrypointVersion, version.FileVersion);
//Console.WriteLine("# OpenWrap Shell {0}", version.FileVersion);
//Console.WriteLine("# " + version.LegalCopyright);
//Console.WriteLine("# Using {0} ({1})", entrypointFile, entrypointVersion);
//Console.WriteLine();
}

public BootstrapResult BootstrappingFailed(Exception exception)
Expand Down
2 changes: 1 addition & 1 deletion src/OpenWrap.Shell/INotifier.cs
Expand Up @@ -7,7 +7,7 @@ public interface INotifier : INotifyDownload
{
BootstrapResult BootstrappingFailed(Exception exception);
BootstrapResult RunFailed(Exception e);
void BootstraperIs(string entrypointFile, Version entrypointVersion);
void BootstraperIs(string entrypointFile, SemanticVersion entrypointVersion);
void Message(string message, params object[] messageParameters);
InstallAction InstallOptions();
}
Expand Down

0 comments on commit 12c91d7

Please sign in to comment.