Skip to content

Commit

Permalink
-Add GIT version
Browse files Browse the repository at this point in the history
  • Loading branch information
e4rthdog committed Apr 12, 2020
1 parent e5c2953 commit 03bee74
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

version.txt

# User-specific files
*.rsuser
*.suo
Expand Down
11 changes: 9 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Program
static void Main(string[] args)
{
string remoteUri = ConfigurationManager.AppSettings.Get("VATSIMURL");
string fileName = ConfigurationManager.AppSettings.Get("VATSIMDATAFILE");
string fileName = ConfigurationManager.AppSettings.Get("VATSIMDATAFILE");
string myStringWebResource = remoteUri + fileName;
string lookFor;
int refreshInterval;
Expand All @@ -28,7 +28,14 @@ static void Main(string[] args)
Airports = Util.LoadAirports();

Util.typeWriter(Util.ascVATSIM, 4, ConsoleColor.DarkGray);
Util.WriteLn("\n(c) 2020 - Elias Stassinos - More Info: http://www.estassinos.com/vatboard - v1", ConsoleColor.DarkGreen, ConsoleColor.White);
Util.WriteLn(
"\n(c) 2020 - Elias Stassinos - More Info: http://www.estassinos.com/vatboard ",
ConsoleColor.DarkGreen,
ConsoleColor.White);
Util.WriteLn(
string.Format("\n\nVersion: {0} ", Util.GetVersion()),
ConsoleColor.DarkGreen,
ConsoleColor.White,false);

lookFor = ReadLine.Read("\n\nAirport ICAO:", "").ToUpper();
refreshInterval = Convert.ToInt32(ReadLine.Read("\nRefresh Interval (default 10sec):", "10"));
Expand Down
13 changes: 13 additions & 0 deletions Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;

namespace VatBoardCons
Expand Down Expand Up @@ -195,5 +196,17 @@ public static void DownloadVatsimData(string _uri, string _filename)
}
}

public static string GetVersion()
{
string gitVersion = String.Empty;
using (Stream stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("VatBoard.version.txt"))
using (StreamReader reader = new StreamReader(stream))
{
gitVersion = reader.ReadLine();
}
return gitVersion;
}

}
}
13 changes: 13 additions & 0 deletions VatBoard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@
<Version>1.0</Version>
<RepositoryUrl>https://github.com/e4rthdog/VatBoard.git</RepositoryUrl>
<RepositoryType>GIT</RepositoryType>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>

<ItemGroup>
<None Remove="version.txt" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="version.txt" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="ReadLine" Version="2.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
Expand All @@ -27,4 +36,8 @@
</None>
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="call version.bat" />
</Target>

</Project>
1 change: 1 addition & 0 deletions version.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"C:\Program Files\Git\bin\git.exe" describe --long > ".\version.txt"

0 comments on commit 03bee74

Please sign in to comment.