-
Notifications
You must be signed in to change notification settings - Fork 4
/
CommandLineArguments.cs
68 lines (52 loc) · 3.26 KB
/
CommandLineArguments.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using CommandLine;
using CommandLine.Text;
using System.Collections.Generic;
namespace PlayListGenerator
{
/// <summary>
/// Class that will be used as a result of command line parsing using library CommandLineParser (See also on nuget package)
/// </summary>
internal class CommandLineArguments
{
/*
M3U : Format de liste de lecture basique développé par Winamp.
PLS : Format de liste de lecture utilisé par WinAmp et itunes.
XSPF : Format de liste de lecture basé sur le XML opensource soutenu par xiph.org
ASX : Format de liste de lecture basé sur le XML développé par Microsoft pour Windows Media.
WPL : Format de liste de lecture basé sur le XML développé par Microsoft pour Windows Media 9 et plus.
*/
internal enum FileFormat { m3u, xspf }
[Value(0, HelpText = "[drive:][path][filename_or_mask]", Required = true)]
public string PathAndMask { get; set; } = "";
[Value(1, HelpText = "[filename]", Required = false)]
public string PlayListFilename { get; set; } = "";
[Option('S', "SubDirectories", HelpText = "Include subdirectories (recursive)")]
public bool Recursive { get; set; }
[Option('F', nameof(Format), HelpText = "Format of the generated playlist : m3u or xspf", Default = FileFormat.m3u)]
public FileFormat Format { get; set; }
[Option('R', nameof(RelativePath), HelpText = "Generate relative paths.")]
public bool RelativePath { get; set; }
[Option('O', nameof(OnePlaylistByFolder), HelpText = "Create 1 playlist by folder of the current folder")]
public bool OnePlaylistByFolder { get; set; }
[Option('M', nameof(MinimumSongByPlaylist), HelpText = "Number minimum of song(s) in a playlist. Under this number a playlist will not be generated. If unspecified, minimum is 1.", Default = 1)]
public int MinimumSongByPlaylist { get; set; }
[Option('U', nameof(UseCurrentFolderAsPlaylistName), HelpText = "If OnePlaylistByFolder(O) and SubDirectories(S) options selected, then combine this option to use the current folder as PlayListFilename. Usefull to avoid using the same PlayListFilename for all playlist generated")]
public bool UseCurrentFolderAsPlaylistName { get; set; }
[Option('K', nameof(SkipIfFileAlreadyExists), HelpText = "When you want to generate only new playlists, without overriding files")]
public bool SkipIfFileAlreadyExists { get; set; }
[Option('C', nameof(CheckMode), HelpText = "")]
public bool CheckMode { get; set; }
[Option('P', nameof(PlayListSuffix), HelpText = "Suffix of the playlist filename when UseCurrentFolderAsPlaylistName")]
public string PlayListSuffix { get; set; } = "";
[Option('N', nameof(NumericSort), HelpText = "Sort by numeric prefix sort")]
public bool NumericSort { get; set; }
[Usage()]
public static IEnumerable<Example> Examples
{
get
{
yield return new Example("Normal scenario", new CommandLineArguments { PathAndMask = @".\*.mp3", PlayListFilename = "myPlayList.m3u" });
}
}
}
}