Skip to content

Commit

Permalink
Added command line arguments parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
fholger committed Jul 31, 2014
1 parent 6864313 commit b6635b9
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
RSTabConverter/bin/*
RSTabConverter/obj/*
RSTabConverterLib/bin/*
RSTabConverterLib/obj/*
Binary file added CommandLine.dll
Binary file not shown.
Binary file added CommandLine.pdb
Binary file not shown.
6 changes: 6 additions & 0 deletions RSTabConverter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RSTabConverter", "RSTabConverter\RSTabConverter.csproj", "{62A79A13-92D8-4DCE-A723-783244F5323B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RSTabConverterLib", "RSTabConverterLib\RSTabConverterLib.csproj", "{A391030A-8289-4B6A-8117-1C7995808AD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{62A79A13-92D8-4DCE-A723-783244F5323B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62A79A13-92D8-4DCE-A723-783244F5323B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62A79A13-92D8-4DCE-A723-783244F5323B}.Release|Any CPU.Build.0 = Release|Any CPU
{A391030A-8289-4B6A-8117-1C7995808AD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A391030A-8289-4B6A-8117-1C7995808AD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A391030A-8289-4B6A-8117-1C7995808AD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A391030A-8289-4B6A-8117-1C7995808AD5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Binary file modified RSTabConverter.v12.suo
Binary file not shown.
33 changes: 33 additions & 0 deletions RSTabConverter/CmdOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Text;
using System.Collections.Generic;
using CommandLine;
using CommandLine.Text;

namespace RSTabConverter
{
class CmdOptions
{
[Option('p', "psarc", Required = true, HelpText = "PSARC song archive to open.")]
public string PsarcFile { get; set; }

[Option('l', null, HelpText = "List songs contained in the archive.")]
public bool ListSongs { get; set; }

[HelpOption(HelpText = "Display this help screen.")]
public string GetUsage()
{
var help = new HelpText
{
Heading = new HeadingInfo("Rocksmith 2014 Tab Converter"),
Copyright = new CopyrightInfo("Holger Frydrych", 2014),
AdditionalNewLineAfterOption = true,
AddDashesToOption = true
};
help.AddPreOptionsLine("\nConvert Rocksmith tracks to MusicXML tabs.\n");
help.AddPreOptionsLine("Usage: RSTabConverter -p archive.psarc");
help.AddOptions(this);
return help;
}
}
}
12 changes: 8 additions & 4 deletions RSTabConverter/Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommandLine;
using CommandLine.Text;

namespace RSTabConverter
{
class Program
{
static void Main(string[] args)
{
// parse command line arguments
var options = new CmdOptions();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
Console.WriteLine("Opening archive {0} ...", options.PsarcFile);
}
}
}
}
11 changes: 9 additions & 2 deletions RSTabConverter/RSTabConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="RocksmithToolkitLib">
<HintPath>..\RocksmithToolkitLib.dll</HintPath>
<Reference Include="CommandLine">
<HintPath>..\CommandLine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -44,6 +44,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CmdOptions.cs" />
<Compile Include="musicxml.designer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -54,6 +55,12 @@
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RSTabConverterLib\RSTabConverterLib.csproj">
<Project>{a391030a-8289-4b6a-8117-1c7995808ad5}</Project>
<Name>RSTabConverterLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
12 changes: 12 additions & 0 deletions RSTabConverterLib/PSARCBrowser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RSTabConverterLib
{
public class PSARCBrowser
{
}
}
36 changes: 36 additions & 0 deletions RSTabConverterLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("RSTabConverterLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RSTabConverterLib")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]

// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("44026a2c-342f-4512-9b51-997ad8393e3b")]

// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
56 changes: 56 additions & 0 deletions RSTabConverterLib/RSTabConverterLib.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A391030A-8289-4B6A-8117-1C7995808AD5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RSTabConverterLib</RootNamespace>
<AssemblyName>RSTabConverterLib</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="RocksmithToolkitLib">
<HintPath>..\RocksmithToolkitLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PSARCBrowser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

0 comments on commit b6635b9

Please sign in to comment.