diff --git a/HaRepacker/GUI/AboutForm.Designer.cs b/HaRepacker/GUI/AboutForm.Designer.cs
index 93d6f56f..391973e6 100644
--- a/HaRepacker/GUI/AboutForm.Designer.cs
+++ b/HaRepacker/GUI/AboutForm.Designer.cs
@@ -79,6 +79,7 @@ private void InitializeComponent()
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "AboutForm";
this.ResumeLayout(false);
diff --git a/HaRepacker/GUI/FirstRunForm.Designer.cs b/HaRepacker/GUI/FirstRunForm.Designer.cs
index 7d77211d..1f1c851e 100644
--- a/HaRepacker/GUI/FirstRunForm.Designer.cs
+++ b/HaRepacker/GUI/FirstRunForm.Designer.cs
@@ -64,7 +64,7 @@ private void InitializeComponent()
this.Controls.Add(this.autoUpdate);
this.Controls.Add(this.autoAssociateBox);
this.Controls.Add(this.button1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FirstRunForm";
diff --git a/HaRepacker/GUI/FirstRunForm.resx b/HaRepacker/GUI/FirstRunForm.resx
index 939cf539..6d9290d1 100644
--- a/HaRepacker/GUI/FirstRunForm.resx
+++ b/HaRepacker/GUI/FirstRunForm.resx
@@ -117,68 +117,89 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 0, 108
+
+
+
+ 4, 5, 4, 5
+
+
+ 493, 40
+
+
+
+ 0
+
+
+ OK
+
button1
-
-
- 6, 13
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 2
-
True
-
- True
+
+ 18, 54
-
- autoAssociateBox
+
+ 4, 5, 4, 5
-
- System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 455, 24
-
- 329, 96
+
+ 15
-
- FirstRunForm
+
+ Periodically check for updates (requires internet connection)
-
- 14
+
+ autoUpdate
+
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
-
- 264, 17
-
-
-
- CenterScreen
+
+ 0
-
- Periodically check for updates (requires internet connection)
+
+ True
- 12, 12
+ 18, 18
-
- 308, 17
+
+ 4, 5, 4, 5
-
- 15
+
+ 388, 24
-
- $this
+
+ 14
Automatically associate WZ files with HaRepacker
-
- 2
+
+ autoAssociateBox
-
- 12, 35
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
@@ -186,37 +207,28 @@
1
-
- 0
-
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ True
+
+
+ 9, 20
-
- OK
+
+ 494, 148
-
- 112, 58
+
+ 4, 5, 4, 5
-
- 0
+
+ CenterScreen
First Run
-
- 89, 26
+
+ FirstRunForm
-
- autoUpdate
+
+ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- True
-
\ No newline at end of file
diff --git a/HaRepacker/GUI/NewForm.Designer.cs b/HaRepacker/GUI/NewForm.Designer.cs
index 8a822b1e..a6e6b9ac 100644
--- a/HaRepacker/GUI/NewForm.Designer.cs
+++ b/HaRepacker/GUI/NewForm.Designer.cs
@@ -154,6 +154,7 @@ private void InitializeComponent()
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.nameBox);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "NewForm";
this.ResumeLayout(false);
this.PerformLayout();
diff --git a/HaRepacker/GUI/NewForm.resx b/HaRepacker/GUI/NewForm.resx
index 66efed41..e7991900 100644
--- a/HaRepacker/GUI/NewForm.resx
+++ b/HaRepacker/GUI/NewForm.resx
@@ -119,10 +119,14 @@
- 75, 12
+ 112, 18
+
+
+
+ 4, 5, 4, 5
- 101, 20
+ 150, 26
@@ -144,10 +148,13 @@
True
- 34, 15
+ 18, 21
+
+
+ 4, 0, 4, 0
- 35, 13
+ 51, 20
1
@@ -171,10 +178,13 @@
True
- 178, 15
+ 267, 23
+
+
+ 4, 0, 4, 0
- 23, 13
+ 32, 20
2
@@ -198,10 +208,13 @@
True
- 38, 40
+ 18, 60
+
+
+ 4, 0, 4, 0
- 31, 13
+ 43, 20
3
@@ -225,10 +238,13 @@
True
- 76, 38
+ 114, 58
+
+
+ 4, 5, 4, 5
- 62, 17
+ 90, 24
4
@@ -252,10 +268,13 @@
True
- 141, 38
+ 212, 58
+
+
+ 4, 5, 4, 5
- 41, 17
+ 59, 24
5
@@ -276,10 +295,13 @@
9
- 75, 61
+ 112, 94
+
+
+ 4, 5, 4, 5
- 205, 20
+ 306, 26
6
@@ -303,10 +325,13 @@
True
- 18, 64
+ 18, 97
+
+
+ 4, 0, 4, 0
- 51, 13
+ 76, 20
7
@@ -327,10 +352,13 @@
7
- 35, 140
+ 0, 229
+
+
+ 4, 5, 4, 5
- 103, 38
+ 220, 58
8
@@ -350,11 +378,17 @@
6
+
+ NoControl
+
- 144, 140
+ 230, 229
+
+
+ 4, 5, 4, 5
- 112, 38
+ 208, 58
9
@@ -378,10 +412,13 @@
True
- 12, 90
+ 18, 138
+
+
+ 4, 0, 4, 0
- 57, 13
+ 84, 20
10
@@ -405,10 +442,13 @@
True
- 27, 117
+ 18, 181
+
+
+ 4, 0, 4, 0
- 42, 13
+ 63, 20
11
@@ -429,10 +469,13 @@
3
- 75, 87
+ 112, 134
+
+
+ 4, 5, 4, 5
- 205, 21
+ 306, 28
12
@@ -450,10 +493,13 @@
2
- 75, 114
+ 112, 175
+
+
+ 4, 5, 4, 5
- 51, 20
+ 74, 26
13
@@ -476,15 +522,17 @@
True
-
NoControl
- 188, 38
+ 282, 58
+
+
+ 4, 5, 4, 5
- 94, 17
+ 137, 24
14
@@ -508,10 +556,13 @@
True
- 6, 13
+ 9, 20
- 292, 187
+ 438, 288
+
+
+ 4, 5, 4, 5
New...
diff --git a/HaRepacker/GUI/OptionsForm.Designer.cs b/HaRepacker/GUI/OptionsForm.Designer.cs
index 73413a05..94f747b0 100644
--- a/HaRepacker/GUI/OptionsForm.Designer.cs
+++ b/HaRepacker/GUI/OptionsForm.Designer.cs
@@ -77,12 +77,12 @@ private void InitializeComponent()
//
// lineBreakBox
//
- resources.ApplyResources(this.lineBreakBox, "lineBreakBox");
this.lineBreakBox.FormattingEnabled = true;
this.lineBreakBox.Items.AddRange(new object[] {
resources.GetString("lineBreakBox.Items"),
resources.GetString("lineBreakBox.Items1"),
resources.GetString("lineBreakBox.Items2")});
+ resources.ApplyResources(this.lineBreakBox, "lineBreakBox");
this.lineBreakBox.Name = "lineBreakBox";
//
// label2
@@ -144,6 +144,7 @@ private void InitializeComponent()
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.sortBox);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "OptionsForm";
this.ResumeLayout(false);
this.PerformLayout();
diff --git a/HaRepacker/GUI/OptionsForm.resx b/HaRepacker/GUI/OptionsForm.resx
index 9a3b1c38..b4c7e796 100644
--- a/HaRepacker/GUI/OptionsForm.resx
+++ b/HaRepacker/GUI/OptionsForm.resx
@@ -117,370 +117,412 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Indentation
-
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
-
- 93, 33
+
+ 18, 18
-
- $this
+
+
+ 4, 5, 4, 5
-
- OK
+
+ 135, 24
-
- $this
+
+ 0
Sort TreeView
-
- $this
-
-
- 5
-
-
- 12, 143
+
+ sortBox
-
- 12, 120
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- lineBreakBox
+
+ $this
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 12
-
- System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 0, 370
-
- 12, 12
+
+ 4, 5, 4, 5
-
- OptionsForm
+
+ 236, 51
-
- label1
+
+ 2
-
- 68, 20
+
+ OK
-
-
- 0
+
+ okButton
-
+
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
$this
-
- defXmlFolderEnable
-
-
- 0
+
+ 11
-
- True
+
+ 249, 370
-
- None
+
+ 4, 5, 4, 5
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
+
+ 236, 51
-
- 12, 58
+
+ 3
Cancel
-
- 4
+
+ cancelButton
-
- 264, 17
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- autoUpdate
+
+ $this
-
- sortBox
+
+ 10
-
-
- CenterParent
+
+ 117, 260
-
- $this
+
+ 4, 5, 4, 5
-
- 8
+
+ 354, 26
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 4
0
-
- ...
-
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 5
-
-
- 7
+
+ indentBox
-
- 60, 13
+
+ HaRepackerLib.Controls.IntegerInput, HaRepackerLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
$this
-
- 7
+
+ 9
-
- False
+
+ True
-
- 3
+
+ 18, 265
-
- browse
+
+ 4, 0, 4, 0
-
- 6, 13
+
+ 90, 20
-
- 175, 17
+
+ 5
-
- Unix
+
+ Indentation
-
- 57, 13
+
+ label1
-
- 13
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
$this
-
- 93, 33
+
+ 8
-
- 9
+
+ None
-
- System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Windows
-
- 12, 198
+
+ Unix
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 117, 300
-
- Line break
+
+ 4, 5, 4, 5
-
- 10
+
+ 356, 28
-
- Default XML Folder:
+
+ 6
-
- 64, 229
+
+ lineBreakBox
-
+
+ System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
$this
-
- okButton
+
+ 7
-
- 6
+
+ True
-
- 68, 21
+
+ 18, 305
-
- 12, 35
+
+ 4, 0, 4, 0
-
- 1
+
+ 83, 20
-
- 3
+
+ 7
-
- 163, 229
+
+ Line break
-
- 12
+
+ label2
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
-
- 11
+
+ 6
-
- 78, 195
+
+ True
-
- Automatically associate WZ files with HaRepacker
+
+ 18, 54
-
- autoAssociateBox
+
+ 4, 5, 4, 5
+
+
+ 260, 24
+
+
+ 8
+
+
+ Use APNG incompatibility frame
apngIncompEnable
-
- $this
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 188, 143
+
+ $this
-
- 11
+
+ 5
-
+
True
-
- 12, 81
+
+ 18, 185
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 4, 5, 4, 5
-
- True
+
+ 177, 24
-
- HaRepackerLib.Controls.IntegerInput, HaRepackerLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
+ 9
-
- Use APNG incompatibility frame
+
+ Default XML Folder:
-
- True
+
+ defXmlFolderEnable
-
- True
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 6
+
+ $this
-
- 12, 172
+
+ 4
-
- 8
+
+ False
-
- 120, 17
+
+ 18, 220
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 4, 5, 4, 5
+
+
+ 399, 26
+
+
+ 10
defXmlFolderBox
+
+ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 3
+
False
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 425, 220
+
+
+ 4, 5, 4, 5
- 31, 19
+ 46, 29
-
- 4
+
+ 11
-
- 12
+
+ ...
-
- $this
+
+ browse
-
- Windows
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 9
+
+ $this
-
+
+ 2
+
+
True
-
- 10
+
+ 18, 89
-
- $this
+
+ 4, 5, 4, 5
-
- Options
+
+ 388, 24
-
- 93, 17
+
+ 12
-
- 2
+
+ Automatically associate WZ files with HaRepacker
-
- True
+
+ autoAssociateBox
-
- 323, 274
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 170, 20
+
+ $this
-
- System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 1
-
- cancelButton
+
+ True
-
- label2
+
+ 18, 125
-
- 78, 169
+
+ 4, 5, 4, 5
- 308, 17
+ 455, 24
-
- 2
-
-
- indentBox
+
+ 13
Periodically check for updates (requires internet connection)
+
+ autoUpdate
+
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 0
+
True
+
+ 9, 20
+
+
+ 484, 422
+
+
+ 4, 5, 4, 5
+
+
+ CenterParent
+
+
+ Options
+
+
+ OptionsForm
+
+
+ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/HaRepacker/GUI/SaveForm.designer.cs b/HaRepacker/GUI/SaveForm.designer.cs
index adad0d4f..99f7b63b 100644
--- a/HaRepacker/GUI/SaveForm.designer.cs
+++ b/HaRepacker/GUI/SaveForm.designer.cs
@@ -38,8 +38,8 @@ private void InitializeComponent()
//
// encryptionBox
//
- resources.ApplyResources(this.encryptionBox, "encryptionBox");
this.encryptionBox.FormattingEnabled = true;
+ resources.ApplyResources(this.encryptionBox, "encryptionBox");
this.encryptionBox.Name = "encryptionBox";
//
// saveButton
@@ -74,6 +74,7 @@ private void InitializeComponent()
this.Controls.Add(this.versionBox);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.encryptionBox);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "SaveForm";
this.Load += new System.EventHandler(this.SaveForm_Load);
this.ResumeLayout(false);
diff --git a/HaRepacker/GUI/SaveForm.resx b/HaRepacker/GUI/SaveForm.resx
index 5047bfff..103195ed 100644
--- a/HaRepacker/GUI/SaveForm.resx
+++ b/HaRepacker/GUI/SaveForm.resx
@@ -117,21 +117,155 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 112, 18
+
+
+
+ 4, 5, 4, 5
+
+
+ 265, 28
+
+
+
+ 0
+
+
+ encryptionBox
+
+
+ System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 4
+
+
+ 2, 117
+
+
+ 4, 5, 4, 5
+
+
+ 394, 42
+
+
+ 2
+
Save
+
+ saveButton
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 3
+
+
+ 112, 60
+
+
+ 4, 5, 4, 5
+
+
+ 265, 26
+
+
+ 3
+
+
+ 0
+
+
+ versionBox
+
+
+ HaRepackerLib.Controls.IntegerInput, HaRepackerLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
$this
+
+ 2
+
+
+ True
+
+
+ 40, 63
+
+
+ 4, 0, 4, 0
+
+
+ 63, 20
+
+
+ 4
+
+
+ Version
+
+
+ label1
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 1
+
+
+ True
+
+
+ 18, 23
+
+
+ 4, 0, 4, 0
+
+
+ 84, 20
+
+
+ 5
+
+
+ Encryption
+
+
+ label2
+
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+ $this
+
+
+ 0
+
+
+ True
+
- 6, 13
+ 9, 20
-
- 178, 20
+
+ 398, 160
@@ -2533,131 +2667,16 @@
+B8AAA==
-
-
- 0
-
-
- 12, 15
-
-
- 75, 39
-
-
- $this
-
-
- Version
-
-
- 75, 65
-
-
- SaveForm
-
-
- 2
-
-
- $this
-
-
- 27, 41
-
-
- versionBox
+
+ 4, 5, 4, 5
Save
-
- 178, 27
-
-
- $this
-
-
- 178, 21
-
-
- 1
-
-
- label1
-
-
- label2
-
-
- HaRepackerLib.Controls.IntegerInput, HaRepackerLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
+ SaveForm
System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Encryption
-
-
- saveButton
-
-
- 3
-
-
- 3
-
-
- True
-
-
- 57, 13
-
-
- encryptionBox
-
-
- 4
-
-
- 42, 13
-
-
- 2
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 5
-
-
- 75, 12
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 4
-
-
- 265, 104
-
-
- True
-
-
- System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 0
-
-
- 0
-
-
- $this
-
-
- True
-
\ No newline at end of file
diff --git a/HaRepackerLib/WzMp3Streamer.cs b/HaRepackerLib/WzMp3Streamer.cs
index 5cae728a..7e7a7b15 100644
--- a/HaRepackerLib/WzMp3Streamer.cs
+++ b/HaRepackerLib/WzMp3Streamer.cs
@@ -19,7 +19,10 @@ namespace HaRepackerLib
public class WzMp3Streamer
{
private Stream byteStream;
+
private Mp3FileReader mpegStream;
+ private WaveFileReader waveFileStream;
+
private WaveOut wavePlayer;
private WzSoundProperty sound;
private bool repeat;
@@ -29,17 +32,30 @@ public WzMp3Streamer(WzSoundProperty sound, bool repeat)
this.repeat = repeat;
this.sound = sound;
byteStream = new MemoryStream(sound.GetBytes(false));
- mpegStream = new Mp3FileReader(byteStream);
+
wavePlayer = new WaveOut(WaveCallbackInfo.FunctionCallback());
- wavePlayer.Init(mpegStream);
+ try
+ {
+ mpegStream = new Mp3FileReader(byteStream);
+ wavePlayer.Init(mpegStream);
+ }
+ catch (System.InvalidOperationException)
+ {
+ waveFileStream = new WaveFileReader(byteStream);
+ wavePlayer.Init(waveFileStream);
+ }
wavePlayer.PlaybackStopped += new EventHandler(wavePlayer_PlaybackStopped);
}
void wavePlayer_PlaybackStopped(object sender, StoppedEventArgs e)
{
- if (repeat && !disposed)
+ if (repeat && !disposed)
{
- mpegStream.Seek(0, SeekOrigin.Begin);
+ if (mpegStream != null)
+ mpegStream.Seek(0, SeekOrigin.Begin);
+ else
+ waveFileStream.Seek(0, SeekOrigin.Begin);
+
wavePlayer.Pause();
wavePlayer.Play();
}
@@ -54,7 +70,16 @@ public void Dispose()
{
disposed = true;
wavePlayer.Dispose();
- mpegStream.Dispose();
+ if (mpegStream != null)
+ {
+ mpegStream.Dispose();
+ mpegStream = null;
+ }
+ if (waveFileStream != null)
+ {
+ waveFileStream.Dispose();
+ waveFileStream = null;
+ }
byteStream.Dispose();
GC.Collect();
GC.WaitForPendingFinalizers();
@@ -85,11 +110,19 @@ public int Position
{
get
{
- return (int)(mpegStream.Position / mpegStream.WaveFormat.AverageBytesPerSecond);
+ if (mpegStream != null)
+ return (int)(mpegStream.Position / mpegStream.WaveFormat.AverageBytesPerSecond);
+ else if (waveFileStream != null)
+ return (int)(waveFileStream.Position / waveFileStream.WaveFormat.AverageBytesPerSecond);
+
+ return 0;
}
set
{
- mpegStream.Seek(value * mpegStream.WaveFormat.AverageBytesPerSecond, SeekOrigin.Begin);
+ if (mpegStream != null)
+ mpegStream.Seek(value * mpegStream.WaveFormat.AverageBytesPerSecond, SeekOrigin.Begin);
+ else if (waveFileStream != null)
+ waveFileStream.Seek(value * waveFileStream.WaveFormat.AverageBytesPerSecond, SeekOrigin.Begin);
}
}
}