Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
flare561 committed Jan 23, 2017
1 parent 58e7411 commit 2e48f0e
Show file tree
Hide file tree
Showing 20 changed files with 1,456 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Rippy.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rippy", "Rippy\Rippy.csproj", "{F925785B-E92E-4AE4-A651-054D665B3883}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F925785B-E92E-4AE4-A651-054D665B3883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F925785B-E92E-4AE4-A651-054D665B3883}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F925785B-E92E-4AE4-A651-054D665B3883}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F925785B-E92E-4AE4-A651-054D665B3883}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
104 changes: 104 additions & 0 deletions Rippy/AlbumData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rippy
{
class AlbumData : INotifyPropertyChanged
{
private string _artist;
private string _album;
private string _year;
private string _publisher;
private string _number;
private string _flacFolder;
private string _medium;
private string _tracker;

public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged(string name)
{
if (name != "MP3320")
OnPropertyChanged("MP3320");
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}

public string FlacFolder
{
get { return _flacFolder; }
set { _flacFolder = value; OnPropertyChanged("FlacFolder");}
}

public string Artist
{
get { return _artist; }
set { _artist = value; OnPropertyChanged("Artist"); }
}
public string Album
{
get { return _album; }
set { _album = value; OnPropertyChanged("Album"); }
}
public string Year
{
get { return _year; }
set { _year = value; OnPropertyChanged("Year"); }
}
public string Publisher
{
get { return _publisher; }
set { _publisher = value; OnPropertyChanged("Publisher"); }
}
public string Number
{
get { return _number; }
set { _number = value; OnPropertyChanged("Number"); }
}

public string Medium
{
get { return _medium; }
set { _medium = value; OnPropertyChanged("Medium"); }
}

public string Tracker
{
get { return _tracker; }
set { _tracker = value; OnPropertyChanged("Tracker"); }
}

public string MP3320
{
get { return FormatFolderName("MP3 320"); }
}

public string MP3V0
{
get { return FormatFolderName("MP3 V0"); }
}

public string MP3V2
{
get
{ return FormatFolderName("MP3 V2"); }
}

public string FLAC
{
get
{ return FormatFolderName("FLAC"); }
}

private string FormatFolderName(string format)
{
if (!string.IsNullOrWhiteSpace(Publisher) || !string.IsNullOrWhiteSpace(Number))
return $"{Artist} - {Album} ({Year}) [{Publisher} {Number}] [{Medium} {format}]";
else
return $"{Artist} - {Album} ({Year}) [{Medium} {format}]";
}
}
}
36 changes: 36 additions & 0 deletions Rippy/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Rippy.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<userSettings>
<Rippy.Properties.Settings>
<setting name="DBPowerampLocation" serializeAs="String">
<value>C:\Program Files\dBpoweramp\coreconverter.exe</value>
</setting>
<setting name="MP3TagLocation" serializeAs="String">
<value>C:\Program Files (x86)\Mp3tag\Mp3tag.exe</value>
</setting>
<setting name="OutputDirectory" serializeAs="String">
<value>.\Transcodes\</value>
</setting>
<setting name="TorrentDirectory" serializeAs="String">
<value>.\Torrents\</value>
</setting>
<setting name="Trackers" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>https://example.com/stuff/announce</string>
<string>https://example2.com/stuff2/announce</string>
</ArrayOfString>
</value>
</setting>
</Rippy.Properties.Settings>
</userSettings>
</configuration>
9 changes: 9 additions & 0 deletions Rippy/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="Rippy.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Rippy"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions Rippy/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Rippy
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
33 changes: 33 additions & 0 deletions Rippy/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;

namespace Rippy
{
public class AppSettings<T> where T : new()
{
private const string DEFAULT_FILENAME = "settings.json";

public void Save(string fileName = DEFAULT_FILENAME)
{
File.WriteAllText(fileName, (new JavaScriptSerializer()).Serialize(this));
}

public static void Save(T pSettings, string fileName = DEFAULT_FILENAME)
{
File.WriteAllText(fileName, (new JavaScriptSerializer()).Serialize(pSettings));
}

public static T Load(string fileName = DEFAULT_FILENAME)
{
T t = new T();
if (File.Exists(fileName))
t = (new JavaScriptSerializer()).Deserialize<T>(File.ReadAllText(fileName));
return t;
}
}
}
34 changes: 34 additions & 0 deletions Rippy/HelperMethods.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rippy
{
class HelperMethods
{
public static Task RunProcessAsync(string fileName, string arguments)
{
// there is no non-generic TaskCompletionSource
var tcs = new TaskCompletionSource<bool>();

var process = new Process
{
StartInfo = { FileName = fileName, Arguments = arguments },
EnableRaisingEvents = true
};

process.Exited += (sender, args) =>
{
tcs.SetResult(true);
process.Dispose();
};

process.Start();

return tcs.Task;
}
}
}
Loading

0 comments on commit 2e48f0e

Please sign in to comment.