Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Added automatic automatic build number/date display in the campaign e…
Browse files Browse the repository at this point in the history
…ditor
  • Loading branch information
REHERC committed Apr 22, 2021
1 parent 3cc389d commit 9e16338
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 24 deletions.
44 changes: 24 additions & 20 deletions App.AdventureMaker.Core/App.AdventureMaker.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,45 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<Version>1.0.0.0</Version>
<AssemblyVersion>1.0.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<NeutralLanguage>en</NeutralLanguage>
<RepositoryUrl>github.com/reherc/centrifuge.mods.distance</RepositoryUrl>
<Product>Campaign Editor for Distance</Product>
<Company />
<Company />
<Authors>Reherc</Authors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;APP PREVIEW</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>1701;1702;CS7035</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;APP PREVIEW</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>1701;1702;CS7035</NoWarn>
</PropertyGroup>

<ItemGroup>
<None Remove="Resources\Images\NoLevelImageFound.png" />
<None Remove="Resources\Images\sample thumbnail.bytes.png" />
<None Remove="Resources\Images\StatusError.png" />
<None Remove="Resources\Images\StatusInfo.png" />
<None Remove="Resources\Images\StatusWarning.png" />
<None Remove="Resources\Text\archive_readme.txt" />
<None Remove="Resources\Images\NoLevelImageFound.png" />
<None Remove="Resources\Images\sample thumbnail.bytes.png" />
<None Remove="Resources\Images\StatusError.png" />
<None Remove="Resources\Images\StatusInfo.png" />
<None Remove="Resources\Images\StatusWarning.png" />
<None Remove="Resources\Text\archive_readme.txt" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\Images\NoLevelImageFound.png" />
<EmbeddedResource Include="Resources\Images\sample thumbnail.bytes.png" />
<EmbeddedResource Include="Resources\Images\StatusError.png" />
<EmbeddedResource Include="Resources\Images\StatusInfo.png" />
<EmbeddedResource Include="Resources\Images\StatusWarning.png" />
<EmbeddedResource Include="Resources\Text\archive_readme.txt" />
<EmbeddedResource Include="Resources\Images\NoLevelImageFound.png" />
<EmbeddedResource Include="Resources\Images\sample thumbnail.bytes.png" />
<EmbeddedResource Include="Resources\Images\StatusError.png" />
<EmbeddedResource Include="Resources\Images\StatusInfo.png" />
<EmbeddedResource Include="Resources\Images\StatusWarning.png" />
<EmbeddedResource Include="Resources\Text\archive_readme.txt" />
</ItemGroup>

<ItemGroup>
Expand All @@ -54,11 +58,11 @@
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\Images\NoLevelImageFound.png" />
<Resource Include="Resources\Images\sample thumbnail.bytes.png" />
<Resource Include="Resources\Images\StatusError.png" />
<Resource Include="Resources\Images\StatusInfo.png" />
<Resource Include="Resources\Images\StatusWarning.png" />
<Resource Include="Resources\Images\NoLevelImageFound.png" />
<Resource Include="Resources\Images\sample thumbnail.bytes.png" />
<Resource Include="Resources\Images\StatusError.png" />
<Resource Include="Resources\Images\StatusInfo.png" />
<Resource Include="Resources\Images\StatusWarning.png" />
</ItemGroup>

<Import Project="..\App.SharedResources\App.Icons.projitems" Label="Shared" />
Expand Down
9 changes: 7 additions & 2 deletions App.AdventureMaker.Core/Forms/AboutWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ private void InitializeComponent()
Content = new StackLayout()
{
Style = "vertical",
Spacing = 20,
Padding = new Padding(24),
Spacing = 12,
Padding = new Padding(16),

//Spacing = new Size(15, 15),
Items =
Expand All @@ -42,6 +42,11 @@ private void InitializeComponent()
Text = "Community content making tool for Distance",
TextAlignment = TextAlignment.Center
},
new Label()
{
Text = Main.GetVersionString(),
TextAlignment = TextAlignment.Center
},
//new StackLayout()
//{
// Orientation = Orientation.Vertical,
Expand Down
5 changes: 5 additions & 0 deletions App.AdventureMaker.Core/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@ public static void Start()

new Eto.Forms.Application(Platform.Detect).Run(new MainWindow());
}

public static string GetVersionString()
{
return $"V.{typeof(Main).Assembly.GetName().Version} - Built on {typeof(Main).Assembly.GetBuildDate():g}";
}
}
}
8 changes: 7 additions & 1 deletion App.AdventureMaker.Core/Views/EditorStartView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Eto.Forms;
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace App.AdventureMaker.Core.Views
{
Expand Down Expand Up @@ -68,8 +69,13 @@ public EditorStartView(MainView editor)
TextAlignment = TextAlignment.Center,
Font = new Font(SystemFont.Bold),
TextColor = Colors.Red
}, new Padding(8), centered: true)
}, new Padding(8), centered: true),
#endif
TableLayout.AutoSized(new Label()
{
Text = Main.GetVersionString(),
TextAlignment = TextAlignment.Center,
}, new Padding(8), centered: true),
}
}
}, false),
Expand Down
1 change: 0 additions & 1 deletion App.AdventureMaker.Core/Views/EditorTabView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using App.AdventureMaker.Core.Interfaces;
using Distance.AdventureMaker.Common.Models;
using Eto.Forms;
using System;
using System.Collections.Generic;

namespace App.AdventureMaker.Core.Views
Expand Down
2 changes: 2 additions & 0 deletions Common.Extensions/Common.Extensions.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<Compile Include="$(MSBuildThisFileDirectory)mscorlib\System\IO\FileInfoEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)mscorlib\System\IO\DirectoryInfoEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)mscorlib\System\IO\IO.cs" />
<Compile Include="$(MSBuildThisFileDirectory)mscorlib\System\Reflection\AssemblyEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)mscorlib\System\StringEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)mscorlib\System\VersionEx.cs" />
</ItemGroup>
</Project>
11 changes: 11 additions & 0 deletions Common.Extensions/mscorlib/System/Reflection/AssemblyEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma warning disable RCS1110
using System;
using System.Reflection;

public static class AssemblyEx
{
public static DateTime GetBuildDate(this Assembly assembly)
{
return assembly.GetName().Version.ToDate();
}
}
11 changes: 11 additions & 0 deletions Common.Extensions/mscorlib/System/VersionEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma warning disable RCS1110, RCS1123
using System;

public static class VersionEx
{
public static DateTime ToDate(this Version version)
{
long ticks = TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision;
return new DateTime(2000, 1, 1).Add(new TimeSpan(ticks));
}
}

0 comments on commit 9e16338

Please sign in to comment.