Skip to content

Commit

Permalink
Change to CommandLineParser
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed Nov 26, 2021
1 parent 6c3340e commit 68e06d3
Show file tree
Hide file tree
Showing 8 changed files with 1,306 additions and 895 deletions.
95 changes: 95 additions & 0 deletions N_m3u8DL-CLI/MyOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using CommandLine;
using CommandLine.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace N_m3u8DL_CLI
{
internal class MyOptions
{
[Value(0, Hidden = true, MetaName = "Input Source", HelpText = "Help_input", ResourceType = typeof(strings))]
public string Input { get; set; }

[Option("workDir", HelpText = "Help_workDir", ResourceType = typeof(strings))]
public string WorkDir { get; set; }

[Option("saveName", HelpText = "Help_saveName", ResourceType = typeof(strings))]
public string SaveName { get; set; } = "";

[Option("baseUrl", HelpText = "Help_baseUrl", ResourceType = typeof(strings))]
public string BaseUrl { get; set; }

[Option("headers", HelpText = "Help_headers", ResourceType = typeof(strings))]
public string Headers { get; set; } = "";

[Option("maxThreads", Default = 32U, HelpText = "Help_maxThreads", ResourceType = typeof(strings))]
public uint MaxThreads { get; set; }

[Option("minThreads", Default = 16U, HelpText = "Help_minThreads", ResourceType = typeof(strings))]
public uint MinThreads { get; set; }

[Option("retryCount", Default = 15U, HelpText = "Help_retryCount", ResourceType = typeof(strings))]
public uint RetryCount { get; set; }

[Option("timeOut", Default = 10U, HelpText = "Help_timeOut", ResourceType = typeof(strings))]
public uint TimeOut { get; set; }

[Option("muxSetJson", HelpText = "Help_muxSetJson", ResourceType = typeof(strings))]
public string MuxSetJson { get; set; }

[Option("useKeyFile", HelpText = "Help_useKeyFile", ResourceType = typeof(strings))]
public string UseKeyFile { get; set; }

[Option("useKeyBase64", HelpText = "Help_useKeyBase64", ResourceType = typeof(strings))]
public string UseKeyBase64 { get; set; }

[Option("useKeyIV", HelpText = "Help_useKeyIV", ResourceType = typeof(strings))]
public string UseKeyIV { get; set; }

[Option("downloadRange", HelpText = "Help_downloadRange", ResourceType = typeof(strings))]
public string DownloadRange { get; set; }

[Option("liveRecDur", HelpText = "Help_liveRecDur", ResourceType = typeof(strings))]
public string LiveRecDur { get; set; }

[Option("stopSpeed", HelpText = "Help_stopSpeed", ResourceType = typeof(strings))]
public long StopSpeed { get; set; } = 0L;

[Option("maxSpeed", HelpText = "Help_maxSpeed", ResourceType = typeof(strings))]
public long MaxSpeed { get; set; } = 0L;

[Option("proxyAddress", HelpText = "Help_proxyAddress", ResourceType = typeof(strings))]
public string ProxyAddress { get; set; }

[Option("enableDelAfterDone", HelpText = "Help_enableDelAfterDone", ResourceType = typeof(strings))]
public bool EnableDelAfterDone { get; set; }

[Option("enableMuxFastStart", HelpText = "Help_enableMuxFastStart", ResourceType = typeof(strings))]
public bool EnableMuxFastStart { get; set; }

[Option("enableBinaryMerge", HelpText = "Help_enableBinaryMerge", ResourceType = typeof(strings))]
public bool EnableBinaryMerge { get; set; }

[Option("enableParseOnly", HelpText = "Help_enableParseOnly", ResourceType = typeof(strings))]
public bool EnableParseOnly { get; set; }

[Option("enableAudioOnly", HelpText = "Help_enableAudioOnly", ResourceType = typeof(strings))]
public bool EnableAudioOnly { get; set; }

[Option("disableDateInfo", HelpText = "Help_disableDateInfo", ResourceType = typeof(strings))]
public bool DisableDateInfo { get; set; }

[Option("disableIntegrityCheck", HelpText = "Help_disableIntegrityCheck", ResourceType = typeof(strings))]
public bool DisableIntegrityCheck { get; set; }

[Option("noMerge", HelpText = "Help_noMerge", ResourceType = typeof(strings))]
public bool NoMerge { get; set; }

[Option("noProxy", HelpText = "Help_noProxy", ResourceType = typeof(strings))]
public bool NoProxy { get; set; }

}
}
22 changes: 12 additions & 10 deletions N_m3u8DL-CLI/N_m3u8DL-CLI.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
<Import Project="..\packages\Resource.Embedder.2.1.1\build\Resource.Embedder.props" Condition="Exists('..\packages\Resource.Embedder.2.1.1\build\Resource.Embedder.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -45,15 +45,18 @@
<Reference Include="BrotliSharpLib, Version=0.3.2.0, Culture=neutral, PublicKeyToken=3f4e2a1cd615fcb7, processorArchitecture=MSIL">
<HintPath>..\packages\BrotliSharpLib.0.3.3\lib\net451\BrotliSharpLib.dll</HintPath>
</Reference>
<Reference Include="CommandLine, Version=2.8.0.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
<HintPath>..\packages\CommandLineParser.2.8.0\lib\net45\CommandLine.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.JScript" />
<Reference Include="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NiL.JS, Version=2.5.1428.0, Culture=neutral, PublicKeyToken=fa941a7c2a4de689, processorArchitecture=MSIL">
<HintPath>..\packages\NiL.JS.2.5.1428\lib\net45\NiL.JS.dll</HintPath>
Expand All @@ -75,14 +78,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CommandLineArgument.cs" />
<Compile Include="CommandLineArgumentParser.cs" />
<Compile Include="Decode51CtoKey.cs" />
<Compile Include="DecodeDdyun.cs" />
<Compile Include="DecodeHuke88Key.cs" />
<Compile Include="DecodeImooc.cs" />
<Compile Include="DecodeNfmovies.cs" />
<Compile Include="Decrypter.cs" />
<Compile Include="DecodeNfmovies.cs" />
<Compile Include="FFmpeg.cs" />
<Compile Include="Global.cs" />
<Compile Include="HLSLiveDownloader.cs" />
Expand All @@ -91,6 +92,7 @@
<Compile Include="LOGGER.cs" />
<Compile Include="DownloadManager.cs" />
<Compile Include="MPDParser.cs" />
<Compile Include="MyOptions.cs" />
<Compile Include="Parser.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgressReporter.cs" />
Expand Down Expand Up @@ -135,15 +137,15 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="strings.en-US.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>strings.en-US.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="strings.zh-TW.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>strings.zh-TW.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
Expand All @@ -157,4 +159,4 @@
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
</Target>
<Import Project="..\packages\Fody.6.0.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.0.0\build\Fody.targets')" />
</Project>
</Project>
Loading

0 comments on commit 68e06d3

Please sign in to comment.