mirror of
https://github.com/chibicitiberiu/drumkit.git
synced 2024-02-24 10:53:32 +00:00
Build 130105
This commit is contained in:
29
DrumKit/Domain/AppSettings.cs
Normal file
29
DrumKit/Domain/AppSettings.cs
Normal 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
53
DrumKit/Domain/Drum.cs
Normal 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
|
||||
}
|
||||
}
|
50
DrumKit/Domain/DrumConfig.cs
Normal file
50
DrumKit/Domain/DrumConfig.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
41
DrumKit/Domain/DrumLayout.cs
Normal file
41
DrumKit/Domain/DrumLayout.cs
Normal 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
37
DrumKit/Domain/Drumkit.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
}
|
16
DrumKit/Domain/DrumkitConfig.cs
Normal file
16
DrumKit/Domain/DrumkitConfig.cs
Normal 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; }
|
||||
}
|
||||
}
|
80
DrumKit/Domain/DrumkitLayout.cs
Normal file
80
DrumKit/Domain/DrumkitLayout.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
21
DrumKit/Domain/DrumkitLayoutCollection.cs
Normal file
21
DrumKit/Domain/DrumkitLayoutCollection.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
}
|
19
DrumKit/Domain/DrumkitLayoutTargetView.cs
Normal file
19
DrumKit/Domain/DrumkitLayoutTargetView.cs
Normal 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
|
||||
}
|
||||
}
|
19
DrumKit/Domain/SoundSource.cs
Normal file
19
DrumKit/Domain/SoundSource.cs
Normal 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; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user