Skip to content

Commit

Permalink
Fix trim black
Browse files Browse the repository at this point in the history
  • Loading branch information
HakanL committed Sep 24, 2020
1 parent 2c557d3 commit 0973058
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Utils/DMXrecorder/ConverterUI/ConverterUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\PostProcessor\PostProcessor.csproj" />
<ProjectReference Include="..\Processor\Processor.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Utils/DMXrecorder/ConverterUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Animatroller.PostProcessor;
using Animatroller.Processor;

namespace Animatroller.ConverterUI
{
Expand Down Expand Up @@ -77,7 +77,7 @@ private void buttonConvert_Click(object sender, RoutedEventArgs e)
{
progress.Value = 0;

var converter = new PostProcessor.Command.FileConvert(fileReader, fileWriter, transformer);
var converter = new Processor.Command.FileConvert(fileReader, fileWriter, transformer);

// TODO: Report progress
converter.Execute();
Expand Down
8 changes: 7 additions & 1 deletion Utils/DMXrecorder/DMXrecorder.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DMXrecorder", "DMXrecorder\DMXrecorder.csproj", "{4D3CF655-C2E0-4B14-A441-80791C0FE092}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMXrecorder", "DMXrecorder\DMXrecorder.csproj", "{4D3CF655-C2E0-4B14-A441-80791C0FE092}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostProcessor", "PostProcessor\PostProcessor.csproj", "{D55F0B0F-63F9-4D3F-B27D-A913D2B2D5EA}"
EndProject
Expand All @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DMXplayer", "DMXplayer\DMXp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConverterUI", "ConverterUI\ConverterUI.csproj", "{95B2BF6D-31AC-408E-AADA-3B25422843B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Processor", "Processor\Processor.csproj", "{AD2A54A9-8B3A-498A-9F30-C2A3F72BF6F6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -39,6 +41,10 @@ Global
{95B2BF6D-31AC-408E-AADA-3B25422843B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95B2BF6D-31AC-408E-AADA-3B25422843B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95B2BF6D-31AC-408E-AADA-3B25422843B8}.Release|Any CPU.Build.0 = Release|Any CPU
{AD2A54A9-8B3A-498A-9F30-C2A3F72BF6F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD2A54A9-8B3A-498A-9F30-C2A3F72BF6F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD2A54A9-8B3A-498A-9F30-C2A3F72BF6F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD2A54A9-8B3A-498A-9F30-C2A3F72BF6F6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions Utils/DMXrecorder/PostProcessor/PostProcessor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\Processor\Processor.csproj" />
</ItemGroup>

</Project>
13 changes: 7 additions & 6 deletions Utils/DMXrecorder/PostProcessor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Animatroller.Processor;
using PowerArgs;

namespace Animatroller.PostProcessor
Expand Down Expand Up @@ -65,7 +66,7 @@ public static void Main(string[] args)
var transforms = new List<ITransform>();
if (!string.IsNullOrEmpty(arguments.UniverseMapping))
{
UniverseMapper mapper = null;
Processor.Transform.UniverseMapper mapper = null;

var parts = arguments.UniverseMapping.Split(',').Select(x => x.Trim()).ToList();
foreach (string part in parts)
Expand Down Expand Up @@ -96,7 +97,7 @@ public static void Main(string[] args)

if (mapper == null)
{
mapper = new UniverseMapper();
mapper = new Processor.Transform.UniverseMapper();
transforms.Add(mapper);
}

Expand All @@ -113,25 +114,25 @@ public static void Main(string[] args)
if (fileWriter == null)
throw new ArgumentNullException("Missing output file");

command = new Command.TrimBlack(fileReader, fileWriter);
command = new Processor.Command.TrimBlack(fileReader, fileWriter);
break;

case Arguments.Commands.FindLoop:
command = new Command.FindLoop(fileReader);
command = new Processor.Command.FindLoop(fileReader);
break;

case Arguments.Commands.TrimEnd:
if (fileWriter == null)
throw new ArgumentNullException("Missing output file");

command = new Command.TrimEnd(fileReader, fileWriter, arguments.TrimPos);
command = new Processor.Command.TrimEnd(fileReader, fileWriter, arguments.TrimPos);
break;

case Arguments.Commands.FileConvert:
if (fileWriter == null)
throw new ArgumentNullException("Missing output file");

command = new Command.FileConvert(fileReader, fileWriter, transformer);
command = new Processor.Command.FileConvert(fileReader, fileWriter, transformer);
break;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace Animatroller.PostProcessor.Command
namespace Animatroller.Processor.Command
{
public class FileConvert : ICommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace Animatroller.PostProcessor.Command
namespace Animatroller.Processor.Command
{
public class FindLoop : ICommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using System.Text;
using System.Threading.Tasks;

namespace Animatroller.PostProcessor.Command
namespace Animatroller.Processor.Command
{
//FIXME: Make it work with multiple universes

public class TrimBlack : ICommand
{
private readonly Common.IFileReader fileReader;
Expand Down Expand Up @@ -70,12 +68,13 @@ public void Execute()
currentPos = 0;
while (this.fileReader.DataAvailable)
{
long pos = currentPos++;
long pos = currentPos;

if (pos >= firstPos)
break;

this.fileReader.ReadFrame();
currentPos++;
}

while (this.fileReader.DataAvailable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace Animatroller.PostProcessor.Command
namespace Animatroller.Processor.Command
{
//FIXME: Make it work with multiple universes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace Animatroller.PostProcessor
namespace Animatroller.Processor
{
public interface ICommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace Animatroller.PostProcessor
namespace Animatroller.Processor
{
public interface ITransform
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace Animatroller.PostProcessor
namespace Animatroller.Processor
{
public interface ITransformer
{
Expand Down
12 changes: 12 additions & 0 deletions Utils/DMXrecorder/Processor/Processor.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Animatroller.Processor</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Text;
using Animatroller.Common;

namespace Animatroller.PostProcessor
namespace Animatroller.Processor.Transform
{
public class UniverseMapper : ITransform
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Text;
using Animatroller.Common;

namespace Animatroller.PostProcessor
namespace Animatroller.Processor
{
public class Transformer : ITransformer
{
Expand Down

0 comments on commit 0973058

Please sign in to comment.