Skip to content

Commit

Permalink
V 0.67-B67 - for final testing
Browse files Browse the repository at this point in the history
- RERUN FacilityDataLoader !!!
- CHECK MapLibProvider.ini  to enable Stamen 3D

- Add ADF2 items (same as ADF1)
- Add Nav1/2 Course (OBS) item
- Add Missed Approach Legs to Map Approach
- Add Decoding and display of LNM Plan (LNM native format); load from file
- Add Decoding and display of GPX Plan; load from file
- Add PDF as supported Shelf Format
- Add Subfolders support in FlightBag - Shelf
- Add Airport Overview to FlightBag - Shelf (in folder Airport Reports)
- Update SimBrief Flightplan is now stored PDF document (@.FlightPlan)
- Update FlightTable (@.FlightTable) more details added when available in plan
- Update Display of Routes with procedures and limits
- Update MapLib for Stamen Maps (now served by Stadia Maps - needs a Key, default OFF)
- Update METAR collection (new URL from provider)
- Update RA limit for Jet engine acft is now 2500ft
- Fix DME only stations are now properly identified
- Fix METAR decoding of weather in some cases
- Fix Minor consistency fixes in Bar Items
- Update Facility data base extended for procedures
- Update MSFS Connection procedure reviewed and improved
- Update Using NLog for logging now
- Update QuickGuides
  • Loading branch information
bm98 committed Nov 14, 2023
1 parent bd2d47f commit a8dabd7
Show file tree
Hide file tree
Showing 53 changed files with 996 additions and 296 deletions.
105 changes: 15 additions & 90 deletions DbgLib/Dbg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,29 @@ public sealed class Dbg
private static readonly Lazy<Dbg> lazy = new Lazy<Dbg>( ( ) => new Dbg( ) );
private Dbg( )
{
_canWrite = false;
InitLog( );
DumpAudioProps( );
}


// Log a Text Item as Error
private void LogError( string text )
{
using (ScopeContext.PushNestedState( "Logging" ))
LOG.Error( text );
}

// the debug file in the current directory
private readonly string c_logFileName = Path.Combine( ".", "DEBUG_log.txt" );

// flag is we can/shall write
private bool _canWrite;
// Log a Text Item from a Module
private void Log( string module, string text )
{
using (ScopeContext.PushNestedState( module ))
LOG.Info( text );
}

// Init the Log with some basic information
private void InitLog( )
{
if (!_canWrite) return;

try {
LogManager.ThrowExceptions = true;
using (ScopeContext.PushNestedState( "InitLog" ))
Expand All @@ -132,7 +140,6 @@ private void InitLog( )
catch (Exception ex) {
using (ScopeContext.PushNestedState( "InitLog" ))
LOG.Error( ex, "Cannot write logfile" );
_canWrite = false;
return;
}
finally {
Expand Down Expand Up @@ -165,16 +172,6 @@ private string TagLine( string text )
/// </summary>
public AccessCheckResult AccessCheckResult { get; private set; } = AccessCheckResult.Success;

/// <summary>
/// Enable debugging
/// From now on the log will be written
/// </summary>
public void EnableDebug( )
{
_canWrite = true;
InitLog( );
}

/// <summary>
/// Returns a new Logger with a Module Name
/// </summary>
Expand Down Expand Up @@ -342,73 +339,6 @@ public AccessCheckResult AccessCheck( string directory )

#region Logging

/// <summary>
/// Log a Text Item, writes immediately to the file
/// </summary>
/// <param name="text">Log Text</param>
public void Log( string text )
{
if (!_canWrite) return;

using (ScopeContext.PushNestedState( "Logging" ))
LOG.Info( text );
}

/// <summary>
/// Log a Text Item as Error
/// </summary>
/// <param name="text">Log Text</param>
public void LogError( string text )
{
using (ScopeContext.PushNestedState( "Logging" ))
LOG.Error( text );
}

/// <summary>
/// Log a Text Item as Error with Exception
/// </summary>
/// <param name="ex">Exception</param>
/// <param name="text">Log Text</param>
public void LogException( Exception ex, string text )
{
using (ScopeContext.PushNestedState( "Logging" ))
LOG.Error( ex, text );
}

/// <summary>
/// Log a Text Item from a Module
/// </summary>
/// <param name="module">The related sw part</param>
/// <param name="text">Log Text</param>
public void Log( string module, string text )
{
using (ScopeContext.PushNestedState( module ))
LOG.Info( text );
}

/// <summary>
/// Log a Text Item from a Module as Error
/// </summary>
/// <param name="module">The related sw part</param>
/// <param name="text">Log Text</param>
public void LogError( string module, string text )
{
using (ScopeContext.PushNestedState( module ))
LOG.Error( text );
}

/// <summary>
/// Log a Text Item as Error with Exception
/// </summary>
/// <param name="module">The related sw part</param>
/// <param name="ex">Exception</param>
/// <param name="text">Log Text</param>
public void LogException( string module, Exception ex, string text )
{
using (ScopeContext.PushNestedState( module ))
LOG.Error( ex, text );
}


/// <summary>
/// Log a text and dump the stacktrace from the calling process
Expand Down Expand Up @@ -442,7 +372,6 @@ private void CollectEnvironmentInformation( )
// Get the current directory and files in it
private void ListCurDir( )
{
if (!_canWrite) return;
using (ScopeContext.PushNestedState( "InitLog" )) {
LOG.Info( $"Current Directory:" );
LOG.Info( $" {Environment.CurrentDirectory}" );
Expand Down Expand Up @@ -475,8 +404,6 @@ public void DumpAudioProps( )
// dump the installed voices from MS
private void ListInstalledVoices( )
{
if (!_canWrite) return;

var voices = SpeechSynthesizer.AllVoices;
using (ScopeContext.PushNestedState( "InitLog" )) {
LOG.Info( "Installed Voices:" );
Expand All @@ -495,8 +422,6 @@ private void ListInstalledVoices( )
async private void ListDeviceInformation( )
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{
if (!_canWrite) return;

var ret = DeviceInformation.FindAllAsync( DeviceClass.AudioRender ).AsTask( );
ret.Wait( );
if (ret.Status == TaskStatus.RanToCompletion) {
Expand Down
2 changes: 1 addition & 1 deletion DbgLib/DbgLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.Contracts">
<Version>10.0.22621.755</Version>
<Version>10.0.22621.2428</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>5.2.5</Version>
Expand Down
48 changes: 38 additions & 10 deletions DbgLib/DbgLogger.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using NLog;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Expand All @@ -12,7 +14,8 @@ namespace DbgLib
/// </summary>
public class DbgLogger : IDbg
{
private string _assembly = "";
private readonly Logger LOG = LogManager.GetLogger( "Generic" );

private string _type = "";
private string _module = "";

Expand All @@ -28,6 +31,7 @@ public DbgLogger( )
_module = "Generic";

_modName = _module;
LOG = LogManager.GetLogger( _modName );
}

/// <summary>
Expand All @@ -36,8 +40,8 @@ public DbgLogger( )
public DbgLogger( string module )
{
_module = module;

_modName = _module;
LOG = LogManager.GetLogger( _modName );
}

/// <summary>
Expand All @@ -48,17 +52,18 @@ public DbgLogger( Type type )
_type = type.Name;

_modName = $"{_type}";
LOG = LogManager.GetLogger( _modName );
}

/// <summary>
/// cTor: Assembly.Module Prefix
/// </summary>
public DbgLogger( Assembly assembly, Type type )
{
_assembly = assembly.FullName;
_type = type.Name;

_modName = $"{assembly.GetName( ).Name}.{_type}";
LOG = LogManager.GetLogger( _modName );
}

/// <summary>
Expand All @@ -67,7 +72,7 @@ public DbgLogger( Assembly assembly, Type type )
/// <param name="text">Log Text</param>
public void Log( string text )
{
Dbg.Instance.Log( $"({_modName})", text );
LOG.Info( text );
}

/// <summary>
Expand All @@ -76,7 +81,16 @@ public void Log( string text )
/// <param name="text">Log Text</param>
public void LogError( string text )
{
Dbg.Instance.LogError( $"({_modName})", text );
LOG.Error( text );
}

/// <summary>
/// Log a Text Item as Trace
/// </summary>
/// <param name="text">Log Text</param>
public void LogTrace( string text )
{
LOG.Trace( text );
}

/// <summary>
Expand All @@ -86,7 +100,7 @@ public void LogError( string text )
/// <param name="text">Log Text</param>
public void LogException( Exception ex, string text )
{
Dbg.Instance.LogException( $"({_modName})", ex, text );
LOG.Error(ex, text );
}


Expand All @@ -106,7 +120,8 @@ public void LogStackTrace( string text )
/// <param name="text">Log Text</param>
public void Log( string context, string text )
{
Dbg.Instance.Log( $"({_modName}.{context})", text );
using (ScopeContext.PushNestedState(context ))
LOG.Info( text );
}

/// <summary>
Expand All @@ -116,7 +131,19 @@ public void Log( string context, string text )
/// <param name="text">Log Text</param>
public void LogError( string context, string text )
{
Dbg.Instance.LogError( $"({_modName}.{context})", text );
using (ScopeContext.PushNestedState( context ))
LOG.Error( text );
}

/// <summary>
/// Log a Text Item as Trace
/// </summary>
/// <param name="context">A context</param>
/// <param name="text">Log Text</param>
public void LogTrace( string context, string text )
{
using (ScopeContext.PushNestedState( context ))
LOG.Trace( text );
}

/// <summary>
Expand All @@ -127,7 +154,8 @@ public void LogError( string context, string text )
/// <param name="text">Log Text</param>
public void LogException( string context, Exception ex, string text )
{
Dbg.Instance.LogException( $"({_modName}.{context})", ex, text );
using (ScopeContext.PushNestedState( context ))
LOG.Error(ex, text );
}


Expand Down
13 changes: 13 additions & 0 deletions DbgLib/IDbg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public interface IDbg
/// <param name="text">Log Text</param>
void LogError( string text );

/// <summary>
/// Log a Text Item as Trace
/// </summary>
/// <param name="text">Log Text</param>
void LogTrace( string text );

/// <summary>
/// Log a Text Item as Error with Exception
/// </summary>
Expand Down Expand Up @@ -50,6 +56,13 @@ public interface IDbg
/// <param name="text">Log Text</param>
void LogError( string context, string text );

/// <summary>
/// Log a Text Item as Trace
/// </summary>
/// <param name="context">A context</param>
/// <param name="text">Log Text</param>
void LogTrace( string context, string text );

/// <summary>
/// Log a Text Item as Error with Exception
/// </summary>
Expand Down
29 changes: 0 additions & 29 deletions FS20_HudBar/AApp/DebugStart.cs

This file was deleted.

Loading

0 comments on commit a8dabd7

Please sign in to comment.