Skip to content

Commit

Permalink
-automate name/ver/builddate to console
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewis Kirkaldie committed Aug 24, 2022
1 parent 90e91f9 commit e997b97
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
57 changes: 57 additions & 0 deletions Helpers/Product.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using static System.Char;

namespace StreamGoo.Helpers;

public static class Product
{
private static string _tracingName;

#region Constructors

static Product()
{
var assembly = Assembly.GetExecutingAssembly();

var appFile = Path.Combine(AppContext.BaseDirectory, "streamgoo");

if (File.Exists(appFile))
{
var versionInfo = FileVersionInfo.GetVersionInfo(appFile);

Version = versionInfo.FileVersion;
BuildTime = File.GetCreationTime(appFile);
}
else if (File.Exists($"{appFile}.exe"))
{
var versionInfo = FileVersionInfo.GetVersionInfo($"{appFile}.exe");

Version = versionInfo.FileVersion;
BuildTime = File.GetCreationTime(appFile);
}

Name = "StreamGoo";
}

#endregion

#region Static members

public static string Name { get; }

public static string TracingName
{
get
{
return _tracingName ??= string.Concat(Name.Where(c => !IsWhiteSpace(c))).ToLowerInvariant();
}
}
public static string Version { get; } = "0.0";
public static DateTime BuildTime { get; } = DateTime.MinValue;

#endregion
}
6 changes: 3 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ limitations under the License.
using System.Net.Sockets;
using System.Threading;
using CommandLine;
using StreamGoo.Helpers;

namespace StreamGoo
{
Expand Down Expand Up @@ -76,9 +77,8 @@ private static int Run(Options opts)
_options = opts;
_suppressOutput = _options.Quiet;

PrintToConsole("Cinegy StreamGoo TS Testing Tool");
PrintToConsole(
$"Corrupting your Transport Streams since 2015 (v1.0.0 - {File.GetCreationTime(AppContext.BaseDirectory)})\n");
PrintToConsole($"{Product.Name}: {Product.Version} (Built: {Product.BuildTime})");
PrintToConsole($"Corrupting your Transport Streams since 2015...\n");
_gooDurationTicks = new TimeSpan(0, 0, 0, 0, _options.GooDuration).Ticks;
_gooType = _options.GooType > -1 ? _options.GooType : Random.Next(0, 5);

Expand Down

0 comments on commit e997b97

Please sign in to comment.