Skip to content

Commit b7cc180

Browse files
committed
Initial commit.
0 parents  commit b7cc180

39 files changed

+1841
-0
lines changed

.gitignore

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.sln.docstates
8+
9+
# Build results
10+
[Dd]ebug/
11+
[Rr]elease/
12+
x64/
13+
build/
14+
[Bb]in/
15+
[Oo]bj/
16+
17+
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
18+
!packages/*/build/
19+
20+
# MSTest test Results
21+
[Tt]est[Rr]esult*/
22+
[Bb]uild[Ll]og.*
23+
24+
*_i.c
25+
*_p.c
26+
*.ilk
27+
*.meta
28+
*.obj
29+
*.pch
30+
*.pdb
31+
*.pgc
32+
*.pgd
33+
*.rsp
34+
*.sbr
35+
*.tlb
36+
*.tli
37+
*.tlh
38+
*.tmp
39+
*.tmp_proj
40+
*.log
41+
*.vspscc
42+
*.vssscc
43+
.builds
44+
*.pidb
45+
*.log
46+
*.scc
47+
48+
# Visual Studio profiler
49+
*.psess
50+
*.vsp
51+
*.vspx
52+
53+
# Guidance Automation Toolkit
54+
*.gpState
55+
56+
# ReSharper is a .NET coding add-in
57+
_ReSharper*/
58+
*.[Rr]e[Ss]harper
59+
60+
# TeamCity is a build add-in
61+
_TeamCity*
62+
63+
# DotCover is a Code Coverage Tool
64+
*.dotCover
65+
66+
# NCrunch
67+
*.ncrunch*
68+
.*crunch*.local.xml
69+
70+
# Installshield output folder
71+
[Ee]xpress/
72+
73+
# DocProject is a documentation generator add-in
74+
DocProject/buildhelp/
75+
DocProject/Help/*.HxT
76+
DocProject/Help/*.HxC
77+
DocProject/Help/*.hhc
78+
DocProject/Help/*.hhk
79+
DocProject/Help/*.hhp
80+
DocProject/Help/Html2
81+
DocProject/Help/html
82+
83+
# Click-Once directory
84+
publish/
85+
86+
# Publish Web Output
87+
*.Publish.xml
88+
89+
# NuGet Packages Directory
90+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
91+
#packages/
92+
93+
# Windows Azure Build Output
94+
csx
95+
*.build.csdef
96+
97+
# Windows Store app package directory
98+
AppPackages/
99+
100+
# Others
101+
sql/
102+
*.Cache
103+
ClientBin/
104+
[Ss]tyle[Cc]op.*
105+
~$*
106+
*~
107+
*.dbmdl
108+
*.[Pp]ublish.xml
109+
*.pfx
110+
*.publishsettings
111+
112+
# RIA/Silverlight projects
113+
Generated_Code/
114+
115+
# Backup & report files from converting an old project file to a newer
116+
# Visual Studio version.
117+
_UpgradeReport_Files/
118+
Backup*/
119+
UpgradeLog*.XML
120+
UpgradeLog*.htm
121+
122+
# SQL Server files
123+
App_Data/*.mdf
124+
App_Data/*.ldf
125+
126+
127+
#LightSwitch generated files
128+
GeneratedArtifacts/
129+
_Pvt_Extensions/
130+
ModelManifest.xml
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
using System.Reflection;
7+
8+
namespace PlaylistGenerator {
9+
static class AssemblyExtension {
10+
public static T GetCustomAttribute<T>(this Assembly a) {
11+
return a.GetCustomAttributes<T>().First();
12+
}
13+
14+
public static T[] GetCustomAttributes<T>(this Assembly a) {
15+
return (T[])a.GetCustomAttributes(typeof(T), false).Cast<T>();
16+
}
17+
}
18+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
using Mono.Options;
7+
8+
namespace PlaylistGenerator {
9+
class ConsoleConfiguration : Configuration {
10+
private PlaylistContext currentContext;
11+
12+
public OptionSet Options { get; private set; }
13+
14+
private ConsoleConfiguration() : base() {
15+
CreatePlaylistContext();
16+
}
17+
18+
public ConsoleConfiguration(IEnumerable<string> args) : this() {
19+
Options = CreateOptionSet();
20+
Options.Parse(args);
21+
}
22+
23+
void CreatePlaylistContext(string directory = null) {
24+
//Reuse current context when directory not set.
25+
if (currentContext != null && currentContext.Directory == null)
26+
currentContext.Directory = directory;
27+
28+
//Create new context when no context or directory already set.
29+
else Contexts.Add(currentContext = new PlaylistContext(directory));
30+
}
31+
32+
OptionSet CreateOptionSet() {
33+
return new OptionSet() {
34+
//Default handler.
35+
{ "<>", v => CreatePlaylistContext(v) },
36+
{ "e|extension=", "Add files with the specified file extension", v => currentContext.FileExtension = v }
37+
};
38+
}
39+
}
40+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{9DAA5A06-E8A7-4E25-8621-C0DA0C7EBCCE}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>PlaylistGenerator</RootNamespace>
11+
<AssemblyName>PlaylistGenerator</AssemblyName>
12+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.Core" />
37+
<Reference Include="System.Xml.Linq" />
38+
<Reference Include="System.Data.DataSetExtensions" />
39+
<Reference Include="Microsoft.CSharp" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Xml" />
42+
</ItemGroup>
43+
<ItemGroup>
44+
<Compile Include="AssemblyExtension.cs" />
45+
<Compile Include="ConsoleConfiguration.cs" />
46+
<Compile Include="Mono.Options\Options.cs" />
47+
<Compile Include="Program.cs" />
48+
<Compile Include="Properties\AssemblyInfo.cs" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<None Include="packages.config" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<ProjectReference Include="..\Playlist Generator\Playlist Generator.csproj">
55+
<Project>{3f8a1f68-892f-46bc-8718-5cca66e76315}</Project>
56+
<Name>Playlist Generator</Name>
57+
</ProjectReference>
58+
</ItemGroup>
59+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
60+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
61+
Other similar extension points exist, see Microsoft.Common.targets.
62+
<Target Name="BeforeBuild">
63+
</Target>
64+
<Target Name="AfterBuild">
65+
</Target>
66+
-->
67+
</Project>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
using System.Reflection;
7+
8+
namespace PlaylistGenerator {
9+
class Program {
10+
public static Generator Generator { get; private set; }
11+
12+
public static int Main(string[] args) {
13+
WriteBanner();
14+
15+
//Create generator with configuration based on command-line arguments.
16+
var config = new ConsoleConfiguration(args);
17+
Generator = new Generator(config);
18+
19+
//Create playlists.
20+
if (config.IsValid()) CreatePlaylists();
21+
22+
//Write usage instructions.
23+
else {
24+
WriteUsage();
25+
26+
return 1;
27+
}
28+
29+
return 0;
30+
}
31+
32+
static void CreatePlaylists() {
33+
Generator.CreatePlaylists();
34+
35+
foreach (var context in Generator.Configuration.Contexts)
36+
Console.WriteLine(
37+
"Wrote {0} {1}s to \"{2}\"",
38+
context.Playlist.Count,
39+
context.FileExtension.TrimStart('.'),
40+
context.FilePath
41+
);
42+
}
43+
44+
static void WriteUsage() {
45+
Console.WriteLine(
46+
"Usage: {0} <[option]... <path>>...\n",
47+
System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName
48+
);
49+
50+
((ConsoleConfiguration)Generator.Configuration).Options.WriteOptionDescriptions(Console.Out);
51+
}
52+
53+
static void WriteBanner() {
54+
var a = Assembly.GetExecutingAssembly();
55+
var n = a.GetName();
56+
57+
Console.WriteLine(
58+
"{0} {1} v{2}.{3}.{4}\n",
59+
a.GetCustomAttribute<AssemblyCompanyAttribute>().Company,
60+
n.Name,
61+
n.Version.Major,
62+
n.Version.Minor,
63+
n.Version.Build
64+
);
65+
}
66+
}
67+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Playlist Generator Console")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("ScriptFUSION")]
12+
[assembly: AssemblyProduct("Playlist Generator Console")]
13+
[assembly: AssemblyCopyright("Copyright 2013")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("b9ca6b0c-1406-4032-b3db-1e4a1d215f07")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
37+
38+
//Friend assemblies.
39+
[assembly: InternalsVisibleTo("PlaylistGeneratorTest")]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Mono.Options" version="1.1" targetFramework="net40" />
4+
</packages>

Playlist Generator GUI/App.xaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Application
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:PlaylistGenerator="clr-namespace:PlaylistGenerator"
5+
x:Class="App"
6+
StartupUri="MainWindow.xaml">
7+
</Application>

Playlist Generator GUI/App.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Windows;
7+
8+
namespace PlaylistGenerator {
9+
/// <summary>
10+
/// Interaction logic for App.xaml
11+
/// </summary>
12+
public partial class App : Application {
13+
}
14+
}

0 commit comments

Comments
 (0)