Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.1.0 #7

Merged
merged 24 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a478e35
Refactor code and update dependencies to .NET 6
MikeMoolenaar Jun 22, 2023
8a389f1
Reformat all code and add .editorconfig
MikeMoolenaar Aug 29, 2023
8ca1e02
Cleanup more code
MikeMoolenaar Aug 29, 2023
8b7804c
Reduce amount of parameters for WriteMkvFile to 1
MikeMoolenaar Aug 29, 2023
5fe77a8
Upgrade to .net 7
MikeMoolenaar Aug 29, 2023
d3d8fba
Upgrade to dotnet 8 + all dependencies
MikeMoolenaar Dec 29, 2023
413813b
Cleanup UI
MikeMoolenaar Dec 29, 2023
5640299
Improve padding a little
MikeMoolenaar Dec 29, 2023
4feb6e1
Improve MkvFile code
MikeMoolenaar Dec 29, 2023
d1e2acf
Fix json serialization crash
MikeMoolenaar Dec 29, 2023
adeca09
Add unit test for MkvFile ToString + improve code a little
MikeMoolenaar Dec 29, 2023
3a952f1
Update github workflows
MikeMoolenaar Jan 2, 2024
0de935a
Update
MikeMoolenaar Jan 2, 2024
30db10c
Update ci
MikeMoolenaar Jan 2, 2024
220a76b
Add mkvalidator.exe to test project
MikeMoolenaar Jan 2, 2024
a471302
Update dropdown states and fix unit tests on windows
MikeMoolenaar Jan 2, 2024
4f898ac
Add unit test dependency install instructions
MikeMoolenaar Jan 2, 2024
a801252
Add logo + bump version. Fixes #1
MikeMoolenaar Jan 9, 2024
6d57695
Fix MacOS build
MikeMoolenaar Jan 11, 2024
c226a2a
Publish release as pre-release
MikeMoolenaar Jan 11, 2024
cada781
Change icon to bmp to support gtk
MikeMoolenaar Jan 12, 2024
a81a7ae
Fix icon crashing application on Linux
MikeMoolenaar Jan 12, 2024
9cac14f
Update linux screenshot
MikeMoolenaar Jan 12, 2024
2222a62
Update screenshots
MikeMoolenaar Jan 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
###############################
# Core EditorConfig Options #
###############################
root = true
# All files
[*]
indent_style = space

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# 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
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,25 @@ name: Build & test

on:
push:
branches: [ main ]
branches: [ main, develop ]
paths:
- 'MatroskaLib/**'
- 'MkvDefaultTrackChanger/**'
- 'TestMkvFiles/**'
- '.github/workflows/build-and-test.yml'
pull_request:
branches: [ main ]
branches: [ main, develop ]

jobs:
build-and-test:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: FedericoCarboni/setup-ffmpeg@v1
# - uses: actions/cache@v2
# with:
# path: ~/.nuget/packages
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
# restore-keys: |
# ${{ runner.os }}-nuget-
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
41 changes: 20 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version'
description: 'Version (example: "1.1.0")'
required: true
default: ''
env:
PUBLISH_WIN_PATH: ./MkvDefaultTrackChanger/MkvDefaultTrackChanger.WinForms/bin/Release/net5.0-windows/win-x64/publish
PUBLISH_LINUX_PATH: ./MkvDefaultTrackChanger/MkvDefaultTrackChanger.Gtk/bin/Release/net5.0/linux-x64/publish
PUBLISH_MAC_PATH: ./MkvDefaultTrackChanger/MkvDefaultTrackChanger.Mac/bin/Release/net5.0/osx-x64/publish
PUBLISH_WIN_PATH: ./MkvDefaultTrackChanger/MkvDefaultTrackChanger.WinForms/bin/Release/net8.0-windows/win-x64/publish
PUBLISH_LINUX_PATH: ./MkvDefaultTrackChanger/MkvDefaultTrackChanger.Gtk/bin/Release/net8.0/linux-x64/publish
PUBLISH_MAC_PATH: ./MkvDefaultTrackChanger/MkvDefaultTrackChanger.Mac/bin/Release/net8.0/osx-x64/publish
jobs:
build:
runs-on: windows-latest
Expand All @@ -20,24 +20,23 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build Windows
run: dotnet publish MkvDefaultTrackChanger/MkvDefaultTrackChanger.WinForms/MkvDefaultTrackChanger.WinForms.csproj --configuration Release -r win-x64 -p:PublishSingleFile=true --self-contained true -p:PublishTrimmed=True -p:IncludeNativeLibrariesForSelfExtract=true -p:Version=${{ github.event.inputs.version }}
run: dotnet publish MkvDefaultTrackChanger/MkvDefaultTrackChanger.WinForms/MkvDefaultTrackChanger.WinForms.csproj -c Release -r win-x64 -p:PublishSingleFile=true -p:Version=${{ github.event.inputs.version }}
- name: Build Linux
run: dotnet publish MkvDefaultTrackChanger/MkvDefaultTrackChanger.Gtk/MkvDefaultTrackChanger.Gtk.csproj --configuration Release -r linux-x64 -p:PublishSingleFile=true --self-contained true -p:PublishTrimmed=True -p:TrimMode=CopyUsed -p:Version=${{ github.event.inputs.version }}
run: dotnet publish MkvDefaultTrackChanger/MkvDefaultTrackChanger.Gtk/MkvDefaultTrackChanger.Gtk.csproj -c Release -r linux-x64 -p:PublishSingleFile=true -p:Version=${{ github.event.inputs.version }}
- name: Build Mac
run: dotnet publish MkvDefaultTrackChanger/MkvDefaultTrackChanger.Mac/MkvDefaultTrackChanger.Mac.csproj --configuration Release -r osx-x64 -p:PublishSingleFile=true --self-contained true -p:Version=${{ github.event.inputs.version }}
run: dotnet publish MkvDefaultTrackChanger/MkvDefaultTrackChanger.Mac/MkvDefaultTrackChanger.Mac.csproj -c Release -r osx-x64 -p:PublishSingleFile=true -p:Version=${{ github.event.inputs.version }}
- name: Zip releases
run: |
powershell Rename-Item $env:PUBLISH_WIN_PATH/MkvDefaultTrackChanger.WinForms.exe MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.exe
powershell Compress-Archive $env:PUBLISH_WIN_PATH/MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.exe ./MkvDefaultTrackChanger-Windows-V${{ github.event.inputs.version }}.zip
powershell Rename-Item $env:PUBLISH_LINUX_PATH/MkvDefaultTrackChanger.Gtk MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.Gtk
powershell Compress-Archive $env:PUBLISH_LINUX_PATH/MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.Gtk ./MkvDefaultTrackChanger-Linux-V${{ github.event.inputs.version }}.zip
# TODO: Fix MacOS archive not working (it extracts to a folder instead of a .app file)
# powershell Rename-Item $env:PUBLISH_MAC_PATH/MkvDefaultTrackChanger.Mac.app ./MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.Mac.app
# powershell Compress-Archive $env:PUBLISH_MAC_PATH/MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.Mac.app ./MkvDefaultTrackChanger-MacOS-V${{ github.event.inputs.version }}.zip
powershell Rename-Item $env:PUBLISH_MAC_PATH/MkvDefaultTrackChanger.Mac.app ./MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.Mac.app
powershell Compress-Archive $env:PUBLISH_MAC_PATH/MkvDefaultTrackChanger-V${{ github.event.inputs.version }}.Mac.app ./MkvDefaultTrackChanger-MacOS-V${{ github.event.inputs.version }}.zip
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -48,7 +47,7 @@ jobs:
release_name: V${{ github.event.inputs.version }}
body: TODO add description and rebuild MacOS locally
draft: true
prerelease: false
prerelease: true
- name: Upload release Windows
uses: actions/[email protected]
env:
Expand All @@ -67,12 +66,12 @@ jobs:
asset_path: ./MkvDefaultTrackChanger-Linux-V${{ github.event.inputs.version }}.zip
asset_name: MkvDefaultTrackChanger-Linux-V${{ github.event.inputs.version }}.zip
asset_content_type: application/zip
#- name: Upload release Mac
# uses: actions/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./MkvDefaultTrackChanger-MacOS-V${{ github.event.inputs.version }}.zip
# asset_name: MkvDefaultTrackChanger-MacOS-V${{ github.event.inputs.version }}.zip
# asset_content_type: application/zip
- name: Upload release Mac
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./MkvDefaultTrackChanger-MacOS-V${{ github.event.inputs.version }}.zip
asset_name: MkvDefaultTrackChanger-MacOS-V${{ github.event.inputs.version }}.zip
asset_content_type: application/zip
Binary file removed Assets/Screenshot linux.jpg
Binary file not shown.
Binary file added Assets/Screenshot linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Screenshot mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Screenshot windows.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 62 additions & 64 deletions MatroskaLib/MatroskaLib.Test/ByteHelperTest.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,74 @@
using System.Collections.Generic;
using Xunit;

namespace MatroskaLib.Test
namespace MatroskaLib.Test;

public class ByteHelperTest
{
public class ByteHelperTest
public static TheoryData<ulong, List<byte>> TestData1 = new() {
{ 2UL, new () { 0x2 } },
{ 909UL, new () { 0x3, 0x8D } },
{ 1_800_70UL, new () { 0x2, 0xBF, 0x66 } },
};
[Theory, MemberData(nameof(TestData1))]
public void ToBytesTest(ulong value, List<byte> lsBytesExpected)
{
List<byte> lsResult = ByteHelper.ToBytes(value);

Assert.Equal(lsBytesExpected, lsResult);
}

public static TheoryData<List<byte>, List<byte>> TestData2 = new() {
{ new() {0x0, 0x0, 0x0, 0x96}, new () { 0x96 } },
{ new() {0x0, 0x0, 0x5, 0x0, 0x9}, new () { 0x5, 0x0, 0x9 } },
{ new() {0x9}, new () { 0x9 } },
{ new() {}, new () { } }
};
[Theory, MemberData(nameof(TestData2))]
public void RemoveLeftZeroesTest(List<byte> lsBytes, List<byte> lsBytesExpected)
{
ByteHelper.RemoveLeftZeroes(lsBytes);

Assert.Equal(lsBytes, lsBytesExpected);
}

public static IEnumerable<object[]> Data()
{
public static TheoryData<ulong, List<byte>> TestData1 = new () {
{ 2UL, new () { 0x2 } },
{ 909UL, new () { 0x3, 0x8D } },
{ 1_800_70UL, new () { 0x2, 0xBF, 0x66 } },
yield return new object[]
{
new List<byte>{ 0x6B, 0x2D, 0xAE, 0xBB, 0xD7, 0x81, 0x02 },
new List<byte>{ 0x6B, 0x2D, 0xAE, 0xBE, 0xD7, 0x81, 0x02 },
4,
3
};
[Theory, MemberData(nameof(TestData1))]
public void ToBytesTest(ulong value, List<byte> lsBytesExpected)
yield return new object[]
{
List<byte> lsResult = ByteHelper.ToBytes(value);

Assert.Equal(lsBytesExpected, lsResult);
}

public static TheoryData<List<byte>, List<byte>> TestData2 = new () {
{ new() {0x0, 0x0, 0x0, 0x96}, new () { 0x96 } },
{ new() {0x0, 0x0, 0x5, 0x0, 0x9}, new () { 0x5, 0x0, 0x9 } },
{ new() {0x9}, new () { 0x9 } },
{ new() {}, new () { } }
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x83, 0xD7, 0x81, 0x03 },
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x87, 0xD7, 0x81, 0x03 },
5,
4
};
yield return new object[]
{
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x83, 0xD7, 0x81, 0x03 },
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x87, 0xD7, 0x81, 0x03 },
5,
4
};
[Theory, MemberData(nameof(TestData2))]
public void RemoveLeftZeroesTest(List<byte> lsBytes, List<byte> lsBytesExpected)
yield return new object[]
{
ByteHelper.RemoveLeftZeroes(lsBytes);
new List<byte>{ 0x00, 0x00, 0xAE, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0, 0x3A, 0xD7, 81 },
new List<byte>{ 0x00, 0x00, 0xAE, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0, 0x3D, 0xD7, 81 },
11,
3
};
}
[Theory, MemberData(nameof(Data))]

Assert.Equal(lsBytes, lsBytesExpected);
}

public static IEnumerable<object[]> Data() {
yield return new object[]
{
new List<byte>{ 0x6B, 0x2D, 0xAE, 0xBB, 0xD7, 0x81, 0x02 },
new List<byte>{ 0x6B, 0x2D, 0xAE, 0xBE, 0xD7, 0x81, 0x02 },
4,
3
};
yield return new object[]
{
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x83, 0xD7, 0x81, 0x03 },
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x87, 0xD7, 0x81, 0x03 },
5,
4
};
yield return new object[]
{
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x83, 0xD7, 0x81, 0x03 },
new List<byte>{ 0x81, 0x02, 0xAE, 0x42, 0x87, 0xD7, 0x81, 0x03 },
5,
4
};
yield return new object[]
{
new List<byte>{ 0x00, 0x00, 0xAE, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0, 0x3A, 0xD7, 81 },
new List<byte>{ 0x00, 0x00, 0xAE, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0, 0x3D, 0xD7, 81 },
11,
3
};
}
[Theory, MemberData(nameof(Data))]
public void TestChangeLength(List<byte> inputData, List<byte> expectedData, int position, int newAddition)
{
ByteHelper.ChangeLength(inputData, position, 0xAE, newAddition);

public void TestChangeLength(List<byte> inputData, List<byte> expectedData, int position, int newAddition)
{
ByteHelper.ChangeLength(inputData, position, 0xAE, newAddition);

Assert.Equal(inputData, expectedData);
}


Assert.Equal(inputData, expectedData);
}
}
}
Loading
Loading