Skip to content

Commit

Permalink
Reverted a change that was not meant to be committed. Fixed nullabili…
Browse files Browse the repository at this point in the history
…ty on Serilog and ValueConverter classes.
  • Loading branch information
TrippSC2 committed Feb 13, 2022
1 parent de07cd7 commit ff395a2
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 55 deletions.
56 changes: 28 additions & 28 deletions OpenTracker.Setup/OpenTracker.Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@
{
"Entry"
{
"MsmKey" = "8:_4913C9C404594CDBAE9F3117F7A8A99C"
"MsmKey" = "8:_0D875BFCC3AF4A1589F8C7E33357693B"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_975CA38B882C463AA889B74F563350D7"
"MsmKey" = "8:_4913C9C404594CDBAE9F3117F7A8A99C"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_9AE8180EC7284F8CAADB0EB749E44301"
"MsmKey" = "8:_5BB2FE7855FB42E1B6BD9385F7BE35CB"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_9E6FFC26C1B94A308AE37383659B05F8"
"MsmKey" = "8:_85CFBA2DE302467E93A2A484896EB594"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_BB8564D1E1364967B945056E0DE2B87D"
"MsmKey" = "8:_9E6FFC26C1B94A308AE37383659B05F8"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_D4C025E52F6D4B0CBD39712608FCF0CC"
"MsmKey" = "8:_B2E14E312E94461A96BDCEA89020A1F8"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
Expand Down Expand Up @@ -136,12 +136,12 @@
}
"File"
{
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4913C9C404594CDBAE9F3117F7A8A99C"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0D875BFCC3AF4A1589F8C7E33357693B"
{
"SourcePath" = "8:..\\OpenTracker\\triforce.ico"
"TargetName" = "8:triforce.ico"
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\Themes\\Dark.xaml"
"TargetName" = "8:Dark.xaml"
"Tag" = "8:"
"Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D"
"Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
Expand All @@ -156,12 +156,12 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_975CA38B882C463AA889B74F563350D7"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4913C9C404594CDBAE9F3117F7A8A99C"
{
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\Themes\\Dark.xaml"
"TargetName" = "8:Dark.xaml"
"SourcePath" = "8:..\\OpenTracker\\triforce.ico"
"TargetName" = "8:triforce.ico"
"Tag" = "8:"
"Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D"
"Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
Expand All @@ -176,12 +176,12 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9AE8180EC7284F8CAADB0EB749E44301"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5BB2FE7855FB42E1B6BD9385F7BE35CB"
{
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\Themes\\Default.xaml"
"TargetName" = "8:Default.xaml"
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\runtimes\\win7-x64\\native\\lzma.dll"
"TargetName" = "8:lzma.dll"
"Tag" = "8:"
"Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D"
"Folder" = "8:_C85AC8B5F1374419BA0D2192D2D360D5"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
Expand All @@ -196,9 +196,9 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BB8564D1E1364967B945056E0DE2B87D"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_85CFBA2DE302467E93A2A484896EB594"
{
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\OpenTracker.deps.json"
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\OpenTracker.deps.json"
"TargetName" = "8:OpenTracker.deps.json"
"Tag" = "8:"
"Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D"
Expand All @@ -216,12 +216,12 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D4C025E52F6D4B0CBD39712608FCF0CC"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B2E14E312E94461A96BDCEA89020A1F8"
{
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\runtimes\\win7-x64\\native\\lzma.dll"
"TargetName" = "8:lzma.dll"
"SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\Themes\\Default.xaml"
"TargetName" = "8:Default.xaml"
"Tag" = "8:"
"Folder" = "8:_C85AC8B5F1374419BA0D2192D2D360D5"
"Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
Expand Down Expand Up @@ -347,15 +347,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:OpenTracker"
"ProductCode" = "8:{5EAF757E-FE14-4A69-B5DC-96006B64848A}"
"PackageCode" = "8:{C8BB1096-45C2-456B-BC96-24DA20F06E48}"
"ProductCode" = "8:{6DB73962-5FE7-42A2-8EA6-79DEF608AC05}"
"PackageCode" = "8:{DD037352-9411-41C5-A2B2-807061F138AC}"
"UpgradeCode" = "8:{C98C2121-B4C5-473A-9B86-5407FEFFE8F1}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:1.8.2"
"ProductVersion" = "8:1.8.3"
"Manufacturer" = "8:OpenTracker"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down Expand Up @@ -897,7 +897,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_9E6FFC26C1B94A308AE37383659B05F8"
{
"SourcePath" = "8:..\\OpenTracker\\obj\\Release\\netcoreapp3.1\\apphost.exe"
"SourcePath" = "8:..\\OpenTracker\\obj\\Release\\net6.0\\apphost.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D"
Expand Down
21 changes: 3 additions & 18 deletions OpenTracker.Utils/Themes/ThemeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml.Styling;
using Avalonia.Styling;
Expand Down Expand Up @@ -37,13 +36,7 @@ public ThemeManager(ITheme.Factory themeFactory, IStyleHost app, string path)
app.Styles.Insert(0, SelectedTheme.Style);

var _ = this.WhenAnyValue(x => x.SelectedTheme)
.Where(x => x != null).Subscribe(x =>
{
if (x?.Style != null)
{
app.Styles[0] = x.Style;
}
});
.Subscribe(x => { app.Styles[0] = x.Style; });
}

private List<ITheme> GetDefaultThemes()
Expand All @@ -58,16 +51,10 @@ private List<ITheme> GetDefaultThemes()
Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default")
};

var citrus = new StyleInclude(new Uri("resm:Styles?assembly=Citrus.Avalonia.Sandbox"))
{
Source = new Uri("avares://Citrus.Avalonia/Citrus.xaml")
};

return new List<ITheme>
{
_themeFactory("Dark", dark),
_themeFactory("Light", light),
_themeFactory("Citrus", citrus)
_themeFactory("Light", light)
};
}

Expand Down Expand Up @@ -109,9 +96,7 @@ private List<ITheme> LoadThemesFromFolder(string path)
Debug.Write(e.ToString());
}

themes.AddRange(GetDefaultThemes());

return themes;
return themes.Count == 0 ? GetDefaultThemes() : themes;
}

public void LoadSelectedTheme(string file)
Expand Down
15 changes: 8 additions & 7 deletions OpenTracker/Models/AvaloniaSerilogSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public bool IsEnabled(LogEventLevel level, string area)
return _logger.IsEnabled((Serilog.Events.LogEventLevel)level);
}

public void Log(LogEventLevel level, string area, object source, string messageTemplate)
public void Log(LogEventLevel level, string area, object? source, string messageTemplate)
{
Log(level, area, source, messageTemplate, Array.Empty<object>());
}

public void Log<T0>(
LogEventLevel level, string area, object source, string messageTemplate, T0 propertyValue0)
LogEventLevel level, string area, object? source, string messageTemplate, T0 propertyValue0)
{
if (propertyValue0 is null)
{
Expand All @@ -50,7 +50,7 @@ public void Log<T0>(
}

public void Log<T0, T1>(
LogEventLevel level, string area, object source, string messageTemplate, T0 propertyValue0,
LogEventLevel level, string area, object? source, string messageTemplate, T0 propertyValue0,
T1 propertyValue1)
{
if (propertyValue0 is null)
Expand All @@ -70,7 +70,7 @@ public void Log<T0, T1>(
}

public void Log<T0, T1, T2>(
LogEventLevel level, string area, object source, string messageTemplate, T0 propertyValue0,
LogEventLevel level, string area, object? source, string messageTemplate, T0 propertyValue0,
T1 propertyValue1, T2 propertyValue2)
{
if (propertyValue0 is null)
Expand All @@ -94,7 +94,7 @@ public void Log<T0, T1, T2>(
});
}

public void Log(LogEventLevel level, string area, object source, string messageTemplate, params object[] propertyValues)
public void Log(LogEventLevel level, string area, object? source, string messageTemplate, params object?[] propertyValues)
{
for (var i = 0; i < propertyValues.Length; i++)
{
Expand All @@ -114,7 +114,7 @@ public void Log(LogEventLevel level, string area, object source, string messageT
/// <returns>
/// A string representing the visual hierarchy of the control as an object.
/// </returns>
private static object GetHierarchy(object source)
private static object? GetHierarchy(object? source)
{
if (source is not IControl visual)
{
Expand All @@ -128,8 +128,9 @@ private static object GetHierarchy(object source)
visualString
};

while ((visual = visual.Parent) is not null)
while (visual.Parent is not null)
{
visual = visual.Parent;
visualString = visual.ToString() ?? throw new NullReferenceException();

hierarchy.Insert(0, visualString);
Expand Down
4 changes: 2 additions & 2 deletions OpenTracker/ValueConverters/BitmapValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class BitmapValueConverter : IValueConverter
try
{
var assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
return new Bitmap(assets.Open(uri));
return new Bitmap(assets?.Open(uri));
}
catch (FileNotFoundException ex)
{
Expand All @@ -54,7 +54,7 @@ public class BitmapValueConverter : IValueConverter
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new Exception("All bindings should be one-way.");
}
Expand Down

0 comments on commit ff395a2

Please sign in to comment.