Skip to content

Commit

Permalink
Update to alpha2. Fix version error for single file publishing/net6; …
Browse files Browse the repository at this point in the history
…Set SatelliteResourceLanguages and NeutralLanguage
  • Loading branch information
BobLd committed Nov 25, 2021
1 parent 680b022 commit 4f2ef1f
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 25 deletions.
1 change: 1 addition & 0 deletions Panoptes.Model.Mock/Panoptes.Model.Mock.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>0.0.0.1-alpha2</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Panoptes.Model.MongoDB/Panoptes.Model.MongoDB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<DebugType>embedded</DebugType>
<Version>0.0.0.1-alpha2</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Panoptes.Model.MongoDB/Sessions/MongoSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public MongoSession(ISessionHandler sessionHandler, IResultConverter resultConve
{
Credential = MongoCredential.CreateCredential(null, parameters.UserName, parameters.Password),
Server = new MongoServerAddress(_host, _port),
ApplicationName = $"{Global.AppName} {Global.AppVersion}",
ApplicationName = $"{Global.AppName} {Global.AppVersion} {Global.MachineName} {Global.OSVersion}",
HeartbeatInterval = TimeSpan.FromSeconds(5),
HeartbeatTimeout = TimeSpan.FromSeconds(40)
});
Expand Down
2 changes: 2 additions & 0 deletions Panoptes.Model.Tests/Panoptes.Model.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

<Version>0.0.0.1-alpha2</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
39 changes: 25 additions & 14 deletions Panoptes.Model/Global.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System.Diagnostics;
using System.Reflection;
using System;
using System.Diagnostics;

namespace Panoptes.Model
{
public static class Global
{
public const string AppName = "Panoptes";

public static string MachineName => Environment.MachineName;

public static string OSVersion => Environment.OSVersion.VersionString;

private static string _appVersion;
public static string AppVersion
{
Expand All @@ -22,22 +26,29 @@ public static string AppVersion

private static string GetVersion()
{
var assembly = Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
#pragma warning disable CS8603 // Possible null reference return.
if (fvi != null)
try
{
if (fvi.FileVersion == fvi.ProductVersion)
{
return fvi.FileVersion;
}
else
// https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
var fvi = FileVersionInfo.GetVersionInfo(Environment.ProcessPath);
#pragma warning disable CS8603 // Possible null reference return.
if (fvi != null)
{
return $"{fvi.FileVersion} ({fvi.ProductVersion})";
if (fvi.FileVersion == fvi.ProductVersion)
{
return fvi.FileVersion;
}
else
{
return $"{fvi.FileVersion} ({fvi.ProductVersion})";
}
}
}
return null;
return null;
#pragma warning restore CS8603 // Possible null reference return.
}
catch (System.Exception e)
{
return $"ERROR in version: {e.Message}";
}
}
}
}
2 changes: 2 additions & 0 deletions Panoptes.Model/Panoptes.Model.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<DebugType>embedded</DebugType>
<Version>0.0.0.1-alpha2</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion Panoptes.ViewModels/Panoptes.ViewModels.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<DebugType>embedded</DebugType>
<Version>0.0.0.1-alpha2</Version>
</PropertyGroup>

<ItemGroup>
Expand All @@ -10,7 +12,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Panoptes.Model.Mock\Panoptes.Model.Mock.csproj" />
<ProjectReference Include="..\Panoptes.Model.MongoDB\Panoptes.Model.MongoDB.csproj" />
<ProjectReference Include="..\Panoptes.Model\Panoptes.Model.csproj" />
</ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions Panoptes/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
xmlns:local="clr-namespace:Panoptes"
xmlns:charts="clr-namespace:Panoptes.Views.Charts"
xmlns:converters="clr-namespace:Panoptes.Views.Converters"
xmlns:panels="clr-namespace:Panoptes.Views.Panels">

xmlns:panels="clr-namespace:Panoptes.Views.Panels">

<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
Expand Down
2 changes: 2 additions & 0 deletions Panoptes/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@
</MenuItem>
</Menu>

<!--
<Label DockPanel.Dock="Right" Content="{Binding CurrentDateTimeLocal}" HorizontalAlignment="Right" ToolTip.Tip="Local time."/>
<Label DockPanel.Dock="Right" Content=" Local:" HorizontalAlignment="Right" ToolTip.Tip="Local time."/>
-->
<Label DockPanel.Dock="Right" Content="{Binding CurrentDateTimeUtc}" HorizontalAlignment="Right" ToolTip.Tip="UTC time."/>
<Label DockPanel.Dock="Right" Content="UTC:" HorizontalAlignment="Right" ToolTip.Tip="UTC time."/>
</DockPanel>
Expand Down
12 changes: 8 additions & 4 deletions Panoptes/Panoptes.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ApplicationIcon>Resources\icon\halloween53_109170.ico</ApplicationIcon>
<Version>0.0.0.1-alpha1</Version>
<Version>0.0.0.1-alpha2</Version>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<NeutralLanguage>en</NeutralLanguage>
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\icon\halloween53_109170.ico" />
Expand All @@ -14,14 +17,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.10" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.10" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.10" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.10" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.10" Condition=" '$(Configuration)' == 'Debug' " />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="OxyPlot.Avalonia" Version="2.1.0-20210915.2" />
<PackageReference Include="QuantConnect.Common" Version="2.5.13230" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Panoptes.Model.Mock\Panoptes.Model.Mock.csproj" />
<ProjectReference Include="..\Panoptes.Model.Mock\Panoptes.Model.Mock.csproj" Condition=" '$(Configuration)' == 'Debug' "/>
<ProjectReference Include="..\Panoptes.Model.MongoDB\Panoptes.Model.MongoDB.csproj" />
<ProjectReference Include="..\Panoptes.Model\Panoptes.Model.csproj" />
<ProjectReference Include="..\Panoptes.ViewModels\Panoptes.ViewModels.csproj" />
Expand Down
14 changes: 12 additions & 2 deletions Panoptes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ class Program
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
public static void Main(string[] args)
{
try
{
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
catch (System.Exception ex)
{
System.IO.File.WriteAllText("ERROR.txt", ex.ToString());
}
}

// Might be optimised https://github.com/ahopper/Avalonia.IconPacks/blob/no-avalonia-desktop/src/Avalonia.IconPacks/Program.cs
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
Expand Down
2 changes: 1 addition & 1 deletion Panoptes/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public MainWindowViewModel(ISessionService resultService, IMessenger messenger,
CashBookPane = cashBookPane;
OxyPlotSelectionPane = oxyPlotSelectionViewModel;

Title = $"{Global.AppName} - LEAN Algorithm Monitor - {Global.AppVersion}";
Title = $"{Global.AppName} - LEAN Algorithm Monitor - {Global.AppVersion} - {Global.MachineName} ({Global.OSVersion})";

#if DEBUG
Title = "[DEBUG] " + Title;
Expand Down

0 comments on commit 4f2ef1f

Please sign in to comment.