Skip to content

Commit

Permalink
Converts tool to use WinUI3 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
roryclaasen committed Aug 9, 2023
1 parent 3e98a68 commit 4b3bb3f
Show file tree
Hide file tree
Showing 47 changed files with 1,734 additions and 844 deletions.
117 changes: 102 additions & 15 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,39 +1,117 @@
# EditorConfig is awesome: https://EditorConfig.org
# EditorConfig https://EditorConfig.org
# Style as Code Minimal EditorConfig v.2020.02.16.0 https://styleascode.net

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
end_of_line = crlf
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,yml,xml,Config,props,csproj}]
[*.{yml,json,csproj,props,Config}]
indent_size = 2

# C# files
[*.cs]

#Formatting
########################
# Formatting
########################

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true

# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

#sort System.* using directives alphabetically, and place them before other usings
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true

#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
csharp_space_between_method_call_parameter_list_parentheses = false
########################
# Naming
########################

#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
csharp_space_between_method_declaration_parameter_list_parentheses = false
dotnet_naming_symbols.static_fields.required_modifiers = static

########################
# Language Features
########################

#prefer block bodies for constructors
csharp_style_expression_bodied_constructors = false:suggestion
# IDE1005: Delegate invocation can be simplified
csharp_style_conditional_delegate_call = true:suggestion

#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# IDE0018: Variable declaration can be inlined
csharp_style_inlined_variable_declaration = true:suggestion

# IDE0019: Use pattern matching
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion

#
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion

# IDE0016: Null check can be simplified
csharp_style_throw_expression = true:suggestion

#
dotnet_style_coalesce_expression = true:suggestion

# IDE0028: Collection initialization can be simplified
dotnet_style_collection_initializer = true:suggestion

#
dotnet_style_explicit_tuple_names = true:suggestion

#
dotnet_style_null_propagation = true:suggestion

# IDE0017: Object initialization can be simplified
dotnet_style_object_initializer = true:suggestion

# IDE0049: Name can be simplified
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

########################
# Diagnostic - Documentation
########################

# missing XML comment
dotnet_diagnostic.CS1591.severity = none
Expand Down Expand Up @@ -65,7 +143,9 @@ dotnet_diagnostic.SA1615.severity = none
# constructor summary must begin with standard text
dotnet_diagnostic.SA1642.severity = none

########################
# Diagnostic - Generic Constraints
########################

# Do not catch general exception types
dotnet_diagnostic.CA1031.severity = warning
Expand All @@ -90,3 +170,10 @@ dotnet_diagnostic.SA1203.severity = warning

# Static elements should appear before instance elements
dotnet_diagnostic.SA1204.severity = warning

########################
# Readability Rules
########################

# SA1124: Do not use regions
dotnet_diagnostic.SA1124.severity = none
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
cache-dependency-path: |
**/packages.lock.json
- name: Restore dependencies
run: dotnet restore --locked-mode /p:PublishReadyToRun=false
run: dotnet restore --locked-mode
- name: Build
run: dotnet build --no-restore --configuration Release /p:PublishReadyToRun=false /p:Platform=${{ matrix.platform }}
run: dotnet build --no-restore -c Release -p:Platform=${{ matrix.platform }}
# - name: Test
# run: dotnet test --no-build --verbosity normal
21 changes: 13 additions & 8 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<PropertyGroup>
<IsMsixPackage>false</IsMsixPackage>
</PropertyGroup>

<PropertyGroup Label="Generic Properties">
<Configurations>Debug;Release</Configurations>
<Platforms>x64</Platforms>
<DebugType>full</DebugType>
<IsPublishable>false</IsPublishable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>true</Optimize>
</PropertyGroup>

<PropertyGroup Label="Assembly Properties">
<Authors>Rory Claasen (contact@roryclaasen.dev)</Authors>
<Copyright>All rights reserved.</Copyright>
<Product>Mosaic</Product>
<Product>Mosaic Video Viewer</Product>
</PropertyGroup>

<PropertyGroup Label="Code Quality">
Expand All @@ -26,11 +34,8 @@
</ItemGroup>

<PropertyGroup>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>true</Optimize>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

</Project>
10 changes: 6 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
</PropertyGroup>

<ItemGroup Label="WinUI 3">
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.3.230502000" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageVersion Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.18" />
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.2" />
<PackageVersion Include="CsvHelper" Version="30.0.1" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.3.230724000" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
</ItemGroup>

<ItemGroup Label="Quality">
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.128" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.354" />
</ItemGroup>

<ItemGroup Label="nuget.org">
<PackageVersion Include="LibVLCSharp" Version="3.7.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="VideoLAN.LibVLC.Windows" Version="3.0.18" />
</ItemGroup>

Expand Down
46 changes: 46 additions & 0 deletions Mosaic.Infrastructure/Collections/ConcurrentLoopingQueue{T}.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// ------------------------------------------------------------------------------
// <copyright file="ConcurrentLoopingQueue{T}.cs" company="Rory Claasen">
// Copyright (c) Rory Claasen. All rights reserved.
// </copyright>
// ------------------------------------------------------------------------------

namespace Mosaic.Infrastructure.Collections
{
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

public class ConcurrentLoopingQueue<T> : IConcurrentLoopingQueue<T>
{
private readonly ConcurrentQueue<T> entries = new();

public int Count => this.entries.Count;

public void Enqueue(T item) => this.entries.Enqueue(item);

public void EnqueueRange(IEnumerable<T> items)
{
foreach (var item in items)
{
this.Enqueue(item);
}
}

public bool TryDequeue([MaybeNullWhen(false)] out T result)
{
if (this.entries.TryDequeue(out result))
{
this.entries.Enqueue(result);
return true;
}

return false;
}

public bool TryPeak([MaybeNullWhen(false)] out T result)
=> this.entries.TryPeek(out result);

public void Clear()
=> this.entries.Clear();
}
}
26 changes: 26 additions & 0 deletions Mosaic.Infrastructure/Collections/IConcurrentLoopingQueue{T}.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ------------------------------------------------------------------------------
// <copyright file="IConcurrentLoopingQueue{T}.cs" company="Rory Claasen">
// Copyright (c) Rory Claasen. All rights reserved.
// </copyright>
// ------------------------------------------------------------------------------

namespace Mosaic.Infrastructure.Collections
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

public interface IConcurrentLoopingQueue<T>
{
int Count { get; }

void Enqueue(T item);

void EnqueueRange(IEnumerable<T> items);

bool TryDequeue([MaybeNullWhen(false)] out T result);

bool TryPeak([MaybeNullWhen(false)] out T result);

void Clear();
}
}
18 changes: 0 additions & 18 deletions Mosaic.Infrastructure/Config/Loader/ConfigLoader.cs

This file was deleted.

32 changes: 0 additions & 32 deletions Mosaic.Infrastructure/Config/Loader/ConfigLoader{T}.cs

This file was deleted.

13 changes: 0 additions & 13 deletions Mosaic.Infrastructure/Config/Loader/IConfigLoader{T}.cs

This file was deleted.

18 changes: 18 additions & 0 deletions Mosaic.Infrastructure/Config/MediaEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// ------------------------------------------------------------------------------
// <copyright file="MediaEntry.cs" company="Rory Claasen">
// Copyright (c) Rory Claasen. All rights reserved.
// </copyright>
// ------------------------------------------------------------------------------

namespace Mosaic.Infrastructure.Config
{
using System;
using CsvHelper.Configuration.Attributes;

public record MediaEntry(
[property: Index(0)]
Uri Mrl,

[property: Index(1)]
string? DisplayLabel = null);
}

0 comments on commit 4b3bb3f

Please sign in to comment.