From a4e2c0423453851a89dee3f4c045bacad970554e Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Fri, 12 Feb 2021 14:17:28 +0100 Subject: [PATCH] Weight property added to encoder framework --- Encoding/x265Enc.vb | 12 ++++++------ General/CommandLine.vb | 7 +++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Encoding/x265Enc.vb b/Encoding/x265Enc.vb index 1e2dfb26..d4237d7f 100644 --- a/Encoding/x265Enc.vb +++ b/Encoding/x265Enc.vb @@ -917,10 +917,10 @@ Public Class x265Params .Init = 1} Property ProgressReadframes As New BoolParam() With { - .HelpSwitch = "--progress-readframes", + .Switch = "--progress-readframes", .Text = "Progress Readframes", .Help = "Print how much frames retrieved from reader", - .Init = False, + .Weight = 9, .VisibleFunc = Function() Package.x265Type = x265Type.DJATOM} Overrides ReadOnly Property Items As List(Of CommandLineParam) @@ -1118,6 +1118,10 @@ Public Class x265Params item.HelpSwitch = switches(0) Next + + If HasWeight Then + ItemsValue = ItemsValue.OrderBy(Function(i) i.Weight).ToList + End If End If Return ItemsValue @@ -1423,10 +1427,6 @@ Public Class x265Params End If End If - If ProgressReadframes.Value AndAlso Not IsCustom(pass, ProgressReadframes.HelpSwitch) Then - sb.Append(" " + ProgressReadframes.HelpSwitch) - End If - Return Macro.Expand(sb.ToString.Trim.FixBreak.Replace(BR, " ")) End Function diff --git a/General/CommandLine.vb b/General/CommandLine.vb index 595dbee3..d2be5850 100644 --- a/General/CommandLine.vb +++ b/General/CommandLine.vb @@ -6,6 +6,7 @@ Namespace CommandLine Public MustInherit Class CommandLineParams Property Title As String Property Separator As String = " " + Property HasWeight As Boolean Event ValueChanged(item As CommandLineParam) MustOverride ReadOnly Property Items As List(Of CommandLineParam) @@ -32,6 +33,11 @@ Namespace CommandLine Protected Sub Add(path As String, ParamArray items As CommandLineParam()) For Each i In items i.Path = path + + If i.Weight <> 0 Then + HasWeight = True + End If + ItemsValue.Add(i) Next End Sub @@ -121,6 +127,7 @@ Namespace CommandLine Property Text As String Property URLs As List(Of String) Property VisibleFunc As Func(Of Boolean) + Property Weight As Integer Friend Store As PrimitiveStore Friend Params As CommandLineParams