-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from MikeMoolenaar/develop
Release 1.1.0
- Loading branch information
Showing
42 changed files
with
1,307 additions
and
1,071 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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: | ||
|
@@ -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 not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
Oops, something went wrong.