Build 130105

This commit is contained in:
2013-11-18 20:06:17 +02:00
parent 8816ce4615
commit 43c240001c
81 changed files with 2620 additions and 586 deletions

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drumkitSettings")]
public class AppSettings
{
[XmlElement("currentKit")]
public string CurrentKit { get; set; }
[XmlElement("showKeys")]
public bool ShowKeyBindings { get; set; }
[XmlElement("animations")]
public bool Animations { get; set; }
public AppSettings()
{
this.CurrentKit = "Default";
this.ShowKeyBindings = false;
this.Animations = true;
}
}
}

53
DrumKit/Domain/Drum.cs Normal file
View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drum")]
public class Drum
{
#region Public properties
[XmlAttribute("id")]
public string Id { get; set; }
/// <summary>
/// Gets or sets the name of the drum.
/// </summary>
[XmlElement("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the image uri.
/// </summary>
[XmlElement("image")]
public string ImageSource { get; set; }
/// <summary>
/// Gets or sets the image uri.
/// </summary>
[XmlElement("imagePressed")]
public string ImagePressedSource { get; set; }
/// <summary>
/// Gets or sets the list of sound sources.
/// </summary>
[XmlArray("sounds")]
public List<SoundSource> Sounds { get; set; }
#endregion
#region Constructor
public Drum()
{
this.Name = null;
this.ImageSource = null;
this.ImagePressedSource = null;
this.Sounds = new List<SoundSource>();
}
#endregion
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drumConfig")]
public class DrumConfig
{
[XmlAttribute("targetId")]
public string TargetId { get; set; }
[XmlElement("enabled")]
public bool IsEnabled { get; set; }
[XmlElement("volume")]
public double Volume {
get {
if (this.VolumeL != this.VolumeR)
return double.NaN;
return this.VolumeL;
}
set {
if (!double.IsNaN(value))
this.VolumeL = this.VolumeR = value;
}
}
[XmlElement("volumeL")]
public double VolumeL { get; set; }
[XmlElement("volumeR")]
public double VolumeR { get; set; }
[XmlElement("vkey")]
public Windows.System.VirtualKey Key { get; set; }
public DrumConfig()
{
this.TargetId = null;
this.Volume = 1.0;
this.IsEnabled = true;
this.Key = Windows.System.VirtualKey.None;
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drumLayout")]
public class DrumLayout
{
[XmlAttribute("targetId")]
public string TargetId { get; set; }
[XmlElement("size")]
public double Size { get; set; }
[XmlElement("x")]
public double X { get; set; }
[XmlElement("y")]
public double Y { get; set; }
[XmlElement("zindex")]
public int ZIndex { get; set; }
[XmlElement("angle")]
public double Angle { get; set; }
public DrumLayout()
{
this.TargetId = null;
this.Size = .1;
this.X = 0;
this.Y = 0;
this.ZIndex = 0;
this.Angle = 0;
}
}
}

37
DrumKit/Domain/Drumkit.cs Normal file
View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drumkit")]
public class Drumkit
{
[XmlElement("name")]
public string Name { get; set; }
[XmlElement("description")]
public string Description { get; set; }
[XmlElement("configfile")]
public string ConfigFilePath { get; set; }
[XmlElement("layoutfile")]
public string LayoutFilePath { get; set; }
[XmlArray("drums")]
public List<Drum> Drums { get; set; }
public Drumkit()
{
this.Name = null;
this.Description = null;
this.ConfigFilePath = null;
this.LayoutFilePath = null;
this.Drums = new List<Drum>();
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drumkitConfig")]
public class DrumkitConfig
{
[XmlArray("drums")]
public List<DrumConfig> Drums { get; set; }
}
}

View File

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drumkitLayout")]
public class DrumkitLayout
{
[XmlElement("name")]
public string Name { get; set; }
[XmlIgnore()]
public DrumkitLayoutTargetView TargetView { get; set; }
[XmlElement("targetView")]
private string TargetViewSerialize
{
get
{
if (this.TargetView == DrumkitLayoutTargetView.All)
return "All";
if (this.TargetView == DrumkitLayoutTargetView.None)
return "None";
else
{
string str = "";
if ((this.TargetView & DrumkitLayoutTargetView.Filled) != 0)
str += "Filled|";
if ((this.TargetView & DrumkitLayoutTargetView.Landscape) != 0)
str += "Landscape|";
if ((this.TargetView & DrumkitLayoutTargetView.Portrait) != 0)
str += "Portrait|";
if ((this.TargetView & DrumkitLayoutTargetView.Snapped) != 0)
str += "Snapped|";
return str.TrimEnd('|');
}
}
set
{
this.TargetView = DrumkitLayoutTargetView.None;
foreach (var i in value.Split('|'))
switch (i)
{
case "Filled": this.TargetView |= DrumkitLayoutTargetView.Filled; break;
case "Landscape": this.TargetView |= DrumkitLayoutTargetView.Landscape; break;
case "Portrait": this.TargetView |= DrumkitLayoutTargetView.Portrait; break;
case "Snapped": this.TargetView |= DrumkitLayoutTargetView.Snapped; break;
case "All": this.TargetView |= DrumkitLayoutTargetView.All; break;
}
}
}
[XmlElement("isDefault")]
public bool IsDefault { get; set; }
[XmlArray("drums")]
public List<DrumLayout> Drums { get; set; }
public DrumkitLayout()
{
this.Name = null;
this.IsDefault = false;
this.Drums = new List<DrumLayout>();
this.TargetView = DrumkitLayoutTargetView.All;
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("drumkitLayoutCollection")]
public class DrumkitLayoutCollection
{
[XmlArray("items")]
public List<DrumkitLayout> Items { get; set; }
public DrumkitLayoutCollection()
{
this.Items = new List<DrumkitLayout>();
}
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DrumKit
{
[Flags]
public enum DrumkitLayoutTargetView
{
None = 0,
Snapped = 1,
Filled = 2,
Landscape = 4,
Portrait = 8,
All = Snapped | Filled | Landscape | Portrait
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DrumKit
{
[XmlType("sound")]
public class SoundSource
{
[XmlAttribute("intensity")]
public int Intensity { get; set; }
[XmlText()]
public string Source { get; set; }
}
}