Verions Beta 0.9 as marked by the folder name.

This commit is contained in:
2021-01-21 13:53:18 -06:00
parent 7a7ce6e8fe
commit 12c9237d50
7 changed files with 262 additions and 109 deletions
Binary file not shown.
+1 -1
View File
@@ -13,7 +13,7 @@ namespace SoundBoard
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new formMain()); Application.Run(new formMain());
+4 -4
View File
@@ -5,8 +5,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("SoundBoard")] [assembly: AssemblyTitle("The Internet's Sound Board")]
[assembly: AssemblyDescription("The best of YouTube")] [assembly: AssemblyDescription("The best of the Internet (Beta)")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MacroHard")] [assembly: AssemblyCompany("MacroHard")]
[assembly: AssemblyProduct("I Like Trains")] [assembly: AssemblyProduct("I Like Trains")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.0.0")] [assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")] [assembly: AssemblyFileVersion("0.9.0.0")]
+37 -4
View File
@@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SoundBoard</RootNamespace> <RootNamespace>SoundBoard</RootNamespace>
<AssemblyName>SoundBoard</AssemblyName> <AssemblyName>InternetSoundBoard</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl> <IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\Dev\Desktop\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled> <UpdateEnabled>false</UpdateEnabled>
@@ -21,10 +22,11 @@
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -36,6 +38,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -55,6 +58,25 @@
<PropertyGroup> <PropertyGroup>
<StartupObject>SoundBoard.Program</StartupObject> <StartupObject>SoundBoard.Program</StartupObject>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>62CE56F72C6DAA3E739B88C55F24468592A6FB81</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>SoundBoard_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@@ -130,6 +152,17 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<COMReference Include="WMPLib">
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
+28 -29
View File
@@ -31,11 +31,11 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(aboutForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(aboutForm));
this.doctorIMayBeAHomosexual = new System.Windows.Forms.PictureBox(); this.doctorIMayBeAHomosexual = new System.Windows.Forms.PictureBox();
this.applicationVersionLabel = new System.Windows.Forms.Label(); this.applicationVersionLabel = new System.Windows.Forms.Label();
this.asdfLabel = new System.Windows.Forms.Label();
this.lordBalgruufPortrait = new System.Windows.Forms.PictureBox(); this.lordBalgruufPortrait = new System.Windows.Forms.PictureBox();
this.RCDIndustriesCopyrightLabel = new System.Windows.Forms.Label(); this.RCDIndustriesCopyrightLabel = new System.Windows.Forms.Label();
this.macroHardProgrammerLabel = new System.Windows.Forms.Label(); this.macroHardProgrammerLabel = new System.Windows.Forms.Label();
this.lordBalgruuftheGreaterLabel = new System.Windows.Forms.Label(); this.disclaimerLabel = new System.Windows.Forms.Label();
this.bugReportLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.doctorIMayBeAHomosexual)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.doctorIMayBeAHomosexual)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lordBalgruufPortrait)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.lordBalgruufPortrait)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@@ -54,21 +54,11 @@
// //
this.applicationVersionLabel.AutoSize = true; this.applicationVersionLabel.AutoSize = true;
this.applicationVersionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.applicationVersionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.applicationVersionLabel.Location = new System.Drawing.Point(108, 9); this.applicationVersionLabel.Location = new System.Drawing.Point(86, 6);
this.applicationVersionLabel.Name = "applicationVersionLabel"; this.applicationVersionLabel.Name = "applicationVersionLabel";
this.applicationVersionLabel.Size = new System.Drawing.Size(194, 60); this.applicationVersionLabel.Size = new System.Drawing.Size(246, 80);
this.applicationVersionLabel.TabIndex = 1; this.applicationVersionLabel.TabIndex = 1;
this.applicationVersionLabel.Text = "YouTube Soundboard \r\n\r\nVersion 0.7.0.0\r\n"; this.applicationVersionLabel.Text = "Dynamic Soundboard \r\n\r\nVersion Beta 0.9.0.0\r\nMP3 sound format supported!";
//
// asdfLabel
//
this.asdfLabel.AutoSize = true;
this.asdfLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.asdfLabel.Location = new System.Drawing.Point(24, 79);
this.asdfLabel.Name = "asdfLabel";
this.asdfLabel.Size = new System.Drawing.Size(157, 20);
this.asdfLabel.TabIndex = 2;
this.asdfLabel.Text = "Including asdf Movie!";
// //
// lordBalgruufPortrait // lordBalgruufPortrait
// //
@@ -83,7 +73,7 @@
// RCDIndustriesCopyrightLabel // RCDIndustriesCopyrightLabel
// //
this.RCDIndustriesCopyrightLabel.AutoSize = true; this.RCDIndustriesCopyrightLabel.AutoSize = true;
this.RCDIndustriesCopyrightLabel.Location = new System.Drawing.Point(20, 275); this.RCDIndustriesCopyrightLabel.Location = new System.Drawing.Point(125, 33);
this.RCDIndustriesCopyrightLabel.Name = "RCDIndustriesCopyrightLabel"; this.RCDIndustriesCopyrightLabel.Name = "RCDIndustriesCopyrightLabel";
this.RCDIndustriesCopyrightLabel.Size = new System.Drawing.Size(164, 13); this.RCDIndustriesCopyrightLabel.Size = new System.Drawing.Size(164, 13);
this.RCDIndustriesCopyrightLabel.TabIndex = 4; this.RCDIndustriesCopyrightLabel.TabIndex = 4;
@@ -92,32 +82,41 @@
// macroHardProgrammerLabel // macroHardProgrammerLabel
// //
this.macroHardProgrammerLabel.AutoSize = true; this.macroHardProgrammerLabel.AutoSize = true;
this.macroHardProgrammerLabel.Location = new System.Drawing.Point(231, 275); this.macroHardProgrammerLabel.Location = new System.Drawing.Point(34, 275);
this.macroHardProgrammerLabel.Name = "macroHardProgrammerLabel"; this.macroHardProgrammerLabel.Name = "macroHardProgrammerLabel";
this.macroHardProgrammerLabel.Size = new System.Drawing.Size(136, 26); this.macroHardProgrammerLabel.Size = new System.Drawing.Size(136, 26);
this.macroHardProgrammerLabel.TabIndex = 5; this.macroHardProgrammerLabel.TabIndex = 5;
this.macroHardProgrammerLabel.Text = "Programmed by MacroHard\r\na RCD Industries subsidiary"; this.macroHardProgrammerLabel.Text = "Programmed by MacroHard\r\na RCD Industries subsidiary";
// //
// lordBalgruuftheGreaterLabel // disclaimerLabel
// //
this.lordBalgruuftheGreaterLabel.AutoSize = true; this.disclaimerLabel.AutoSize = true;
this.lordBalgruuftheGreaterLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.disclaimerLabel.Location = new System.Drawing.Point(61, 86);
this.lordBalgruuftheGreaterLabel.Location = new System.Drawing.Point(230, 79); this.disclaimerLabel.Name = "disclaimerLabel";
this.lordBalgruuftheGreaterLabel.Name = "lordBalgruuftheGreaterLabel"; this.disclaimerLabel.Size = new System.Drawing.Size(271, 13);
this.lordBalgruuftheGreaterLabel.Size = new System.Drawing.Size(127, 20); this.disclaimerLabel.TabIndex = 6;
this.lordBalgruuftheGreaterLabel.TabIndex = 6; this.disclaimerLabel.Text = "Current known bug: Random skips all but last sound file.";
this.lordBalgruuftheGreaterLabel.Text = "And total ballerz!"; //
// bugReportLabel
//
this.bugReportLabel.AutoSize = true;
this.bugReportLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.bugReportLabel.Location = new System.Drawing.Point(190, 275);
this.bugReportLabel.Name = "bugReportLabel";
this.bugReportLabel.Size = new System.Drawing.Size(218, 16);
this.bugReportLabel.TabIndex = 7;
this.bugReportLabel.Text = "Please report all bugs to Big Shit Jr.";
// //
// aboutForm // aboutForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(410, 310); this.ClientSize = new System.Drawing.Size(410, 310);
this.Controls.Add(this.lordBalgruuftheGreaterLabel); this.Controls.Add(this.bugReportLabel);
this.Controls.Add(this.disclaimerLabel);
this.Controls.Add(this.macroHardProgrammerLabel); this.Controls.Add(this.macroHardProgrammerLabel);
this.Controls.Add(this.RCDIndustriesCopyrightLabel); this.Controls.Add(this.RCDIndustriesCopyrightLabel);
this.Controls.Add(this.lordBalgruufPortrait); this.Controls.Add(this.lordBalgruufPortrait);
this.Controls.Add(this.asdfLabel);
this.Controls.Add(this.applicationVersionLabel); this.Controls.Add(this.applicationVersionLabel);
this.Controls.Add(this.doctorIMayBeAHomosexual); this.Controls.Add(this.doctorIMayBeAHomosexual);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@@ -140,10 +139,10 @@
private System.Windows.Forms.PictureBox doctorIMayBeAHomosexual; private System.Windows.Forms.PictureBox doctorIMayBeAHomosexual;
private System.Windows.Forms.Label applicationVersionLabel; private System.Windows.Forms.Label applicationVersionLabel;
private System.Windows.Forms.Label asdfLabel;
private System.Windows.Forms.PictureBox lordBalgruufPortrait; private System.Windows.Forms.PictureBox lordBalgruufPortrait;
private System.Windows.Forms.Label RCDIndustriesCopyrightLabel; private System.Windows.Forms.Label RCDIndustriesCopyrightLabel;
private System.Windows.Forms.Label macroHardProgrammerLabel; private System.Windows.Forms.Label macroHardProgrammerLabel;
private System.Windows.Forms.Label lordBalgruuftheGreaterLabel; private System.Windows.Forms.Label disclaimerLabel;
private System.Windows.Forms.Label bugReportLabel;
} }
} }
+5 -5
View File
@@ -104,9 +104,8 @@
// //
this.mainMenuPlayAll.CheckOnClick = true; this.mainMenuPlayAll.CheckOnClick = true;
this.mainMenuPlayAll.Name = "mainMenuPlayAll"; this.mainMenuPlayAll.Name = "mainMenuPlayAll";
this.mainMenuPlayAll.Size = new System.Drawing.Size(152, 22); this.mainMenuPlayAll.Size = new System.Drawing.Size(113, 22);
this.mainMenuPlayAll.Text = "Play &All"; this.mainMenuPlayAll.Text = "Play &All";
this.mainMenuPlayAll.Click += new System.EventHandler(this.mainMenuPlayAll_Click);
// //
// mainMenuHelp // mainMenuHelp
// //
@@ -143,10 +142,11 @@
// //
// soundboardTabControl // soundboardTabControl
// //
this.soundboardTabControl.Location = new System.Drawing.Point(7, 27); this.soundboardTabControl.Location = new System.Drawing.Point(0, 27);
this.soundboardTabControl.Name = "soundboardTabControl"; this.soundboardTabControl.Name = "soundboardTabControl";
this.soundboardTabControl.Padding = new System.Drawing.Point(0, 0);
this.soundboardTabControl.SelectedIndex = 0; this.soundboardTabControl.SelectedIndex = 0;
this.soundboardTabControl.Size = new System.Drawing.Size(418, 506); this.soundboardTabControl.Size = new System.Drawing.Size(425, 506);
this.soundboardTabControl.TabIndex = 0; this.soundboardTabControl.TabIndex = 0;
// //
// loopSelectedSoundCheckBox // loopSelectedSoundCheckBox
@@ -179,7 +179,7 @@
this.MainMenuStrip = this.mainMenu; this.MainMenuStrip = this.mainMenu;
this.Name = "formMain"; this.Name = "formMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Youtube Soundboard"; this.Text = "Interwebz\'s Soundboard";
this.Load += new System.EventHandler(this.formMain_Load); this.Load += new System.EventHandler(this.formMain_Load);
this.mainMenu.ResumeLayout(false); this.mainMenu.ResumeLayout(false);
this.mainMenu.PerformLayout(); this.mainMenu.PerformLayout();
+187 -66
View File
@@ -8,21 +8,21 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using System.Media;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection;
namespace SoundBoard namespace SoundBoard
{ {
public partial class formMain : Form public partial class formMain : Form
{ {
public WMPLib.WindowsMediaPlayer Player = new WMPLib.WindowsMediaPlayer();
public SoundPlayer player = new SoundPlayer();
public Random randomNum = new Random(); public Random randomNum = new Random();
public ListBox listBoxEntity = new ListBox(); public ListBox listBoxEntity = new ListBox();
ProcessStartInfo process = new ProcessStartInfo();
BackgroundWorker worker = new BackgroundWorker();
public string _workingDirectory; public string _workingDirectory;
public string[] _soundFiles; public string[] _soundFiles;
public string[] _soundDirectories; public string[] _soundDirectories;
public bool willLoopSound = false;
public formMain() public formMain()
{ {
@@ -43,17 +43,31 @@ namespace SoundBoard
{ {
CreateUITabs(Path.GetFileName(sounds), sounds); CreateUITabs(Path.GetFileName(sounds), sounds);
} }
worker.WorkerSupportsCancellation = true;
worker.WorkerReportsProgress = true;
fileSystemWatcherMain.Path = _workingDirectory; fileSystemWatcherMain.Path = _workingDirectory;
fileSystemWatcherMain.IncludeSubdirectories = true; fileSystemWatcherMain.IncludeSubdirectories = true;
fileSystemWatcherMain.Created += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder created fileSystemWatcherMain.Created += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder created
fileSystemWatcherMain.Deleted += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder moved or deleted fileSystemWatcherMain.Deleted += new FileSystemEventHandler(fileSystemUpdateDetected); //file or folder moved or deleted
fileSystemWatcherMain.Renamed += new RenamedEventHandler(fileSystemUpdateDetected); //for any file changes like file extension changes fileSystemWatcherMain.Renamed += new RenamedEventHandler(fileSystemUpdateDetected); //for any file changes like file extension changes
soundboardTabControl.SelectedIndexChanged += new EventHandler(CheckForDisabledListBox); //disables ore enables the Show on Disk file menu object soundboardTabControl.SelectedIndexChanged += new EventHandler(CheckForDisabledListBox); //disables ore enables the Show on Disk file menu object
listBoxEntity = (ListBox)soundboardTabControl.SelectedTab.Controls[0]; Player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(WMP_PlayStateChange);
if (listBoxEntity.Enabled == true) //check to see if the listBox is empty on form load
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
{ {
listBoxEntity.SelectedIndex = 0; mainMenuFileShowOnDisk.Enabled = true;
btnRandom.Enabled = true;
} }
else
{
mainMenuFileShowOnDisk.Enabled = false;
btnRandom.Enabled = false;
}
}
private void WMP_PlayStateChange(int newState)
{
} }
private void fileSystemUpdateDetected(object sender, FileSystemEventArgs e) private void fileSystemUpdateDetected(object sender, FileSystemEventArgs e)
@@ -77,11 +91,12 @@ namespace SoundBoard
if (listBoxEntity.Enabled == false) if (listBoxEntity.Enabled == false)
{ {
mainMenuFileShowOnDisk.Enabled = false; mainMenuFileShowOnDisk.Enabled = false;
btnRandom.Enabled = false;
} }
else else
{ {
listBoxEntity.SelectedIndex = 0;
mainMenuFileShowOnDisk.Enabled = true; mainMenuFileShowOnDisk.Enabled = true;
btnRandom.Enabled = true;
} }
} }
@@ -89,8 +104,15 @@ namespace SoundBoard
{ {
_workingDirectory = Path.GetDirectoryName(Application.ExecutablePath); _workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
_soundDirectories = Directory.GetDirectories(_workingDirectory); _soundDirectories = Directory.GetDirectories(_workingDirectory);
soundboardTabControl.Controls.Clear(); foreach (TabPage tabPage in soundboardTabControl.TabPages)
{
foreach (ListBox listBox in tabPage.Controls)
{
listBox.Dispose();
}
tabPage.Dispose();
}
foreach (string sounds in _soundFiles) foreach (string sounds in _soundFiles)
{ {
@@ -100,6 +122,17 @@ namespace SoundBoard
{ {
CreateUITabs(Path.GetFileName(files), files); CreateUITabs(Path.GetFileName(files), files);
} }
//check to see if the listBox is empty
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
{
mainMenuFileShowOnDisk.Enabled = true;
btnRandom.Enabled = true;
}
else
{
mainMenuFileShowOnDisk.Enabled = false;
btnRandom.Enabled = false;
}
} }
private void CreateUITabs(string tabName, string directoryPath) private void CreateUITabs(string tabName, string directoryPath)
@@ -119,15 +152,15 @@ namespace SoundBoard
{ {
tab.Text = tabName; //display the folder's full name to the user tab.Text = tabName; //display the folder's full name to the user
tab.Name = tabName.Replace(" ", "") + "Tab"; //create a legal name for the tab's (name) property tab.Name = tabName.Replace(" ", "") + "Tab"; //create a legal name for the tab's (name) property
tab.Height = soundControlHeight - 20; tab.Height = soundControlHeight;
tab.Height = soundControlWidth; tab.Height = soundControlWidth;
soundboardTabControl.Controls.Add(tab); soundboardTabControl.Controls.Add(tab);
localListBox.Height = soundControlHeight - 20; localListBox.Height = soundControlHeight - 25;
localListBox.Width = soundControlWidth - 7; localListBox.Width = soundControlWidth - 5;
localListBox.Name = tabName.Replace(" ", "") + "ListBox"; localListBox.Name = tabName.Replace(" ", "") + "ListBox";
tab.Controls.Add(localListBox); tab.Controls.Add(localListBox);
localListBox.Click += new EventHandler((sender, e) => ListBoxOnLeftClick(sender, e, localListBox)); //create event handler for the lsit box and pass the object in localListBox.Click += new EventHandler((sender, e) => ListBoxOnLeftClick(sender, e, localListBox)); //create event handler for the lsit box and pass the object in
} }
directoryFiles = Directory.GetFiles(Path.GetFullPath(directoryPath)); directoryFiles = Directory.GetFiles(Path.GetFullPath(directoryPath));
@@ -144,6 +177,7 @@ namespace SoundBoard
break; break;
} }
} }
if (localListBox.Items.Count == 0) if (localListBox.Items.Count == 0)
{ {
localListBox.Items.Add("No sound files found in the " + tabName + " directory."); localListBox.Items.Add("No sound files found in the " + tabName + " directory.");
@@ -151,6 +185,7 @@ namespace SoundBoard
if (soundboardTabControl.SelectedIndex == 0) if (soundboardTabControl.SelectedIndex == 0)
{ {
mainMenuFileShowOnDisk.Enabled = false; mainMenuFileShowOnDisk.Enabled = false;
btnRandom.Enabled = false;
} }
} }
} }
@@ -164,6 +199,7 @@ namespace SoundBoard
} }
//get the file's location on disk, double back if it's not a .wav file //get the file's location on disk, double back if it's not a .wav file
string fileLocation; string fileLocation;
WMPLib.IWMPPlaylist _playList = Player.playlistCollection.newPlaylist("myPlayList"); //build the playlist object
if (soundboardTabControl.SelectedIndex == 0) if (soundboardTabControl.SelectedIndex == 0)
{ {
fileLocation = _workingDirectory + "\\" + list.SelectedItem.ToString() + ".wav"; fileLocation = _workingDirectory + "\\" + list.SelectedItem.ToString() + ".wav";
@@ -182,31 +218,18 @@ namespace SoundBoard
} }
if (File.Exists(fileLocation))//check for the file's existance if (File.Exists(fileLocation))//check for the file's existance
{ {
player.SoundLocation = fileLocation; PlaySoundFile(fileLocation, list.SelectedItem.ToString()); //if the file exists then play it
player.Load();
//try playing the sound file
try
{
if (willLoopSound)
{
player.PlayLooping();
}
else
{
player.Play();
}
}
catch (InvalidOperationException Ex)
{
MessageBox.Show("The file '" + list.SelectedItem.ToString() + "' couldn't be played.", "Invalid Sound File");
}
} }
else else
{ {
MessageBox.Show("The file '" + list.SelectedItem.ToString() + "' couldn't be found.", "File Not Found"); MessageBox.Show("The file '" + list.SelectedItem.ToString() + "' couldn't be found.", "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void PlayRandomSounds()
{
}
private void btnRandom_Click(object sender, EventArgs e) private void btnRandom_Click(object sender, EventArgs e)
{ {
int iterations = (int)randomIterationNumericUpDown.Value; int iterations = (int)randomIterationNumericUpDown.Value;
@@ -225,7 +248,10 @@ namespace SoundBoard
if (mainMenuPlayAll.Checked == true) if (mainMenuPlayAll.Checked == true)
{ {
playRandomSoundBothColumns(iterations); playRandomSoundBothColumns(iterations);
btnRandom.Enabled = true; if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
{
btnRandom.Enabled = true;
}
randomIterationNumericUpDown.Enabled = true; randomIterationNumericUpDown.Enabled = true;
loopSelectedSoundCheckBox.Enabled = true; loopSelectedSoundCheckBox.Enabled = true;
return; return;
@@ -233,92 +259,193 @@ namespace SoundBoard
for (int i = 0; i < iterations; i++) for (int i = 0; i < iterations; i++)
{ {
string fileLocation;
if (soundboardTabControl.SelectedIndex == 0) if (soundboardTabControl.SelectedIndex == 0)
{ {
listBoxEntity.SelectedIndex = randomNum.Next(listBoxEntity.Items.Count); listBoxEntity.SelectedIndex = randomNum.Next(listBoxEntity.Items.Count);
if (File.Exists(_workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav")) if (File.Exists(_workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"))
{ {
player.SoundLocation = _workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"; fileLocation = _workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav";
} }
else if (File.Exists(_workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3")) else if (File.Exists(_workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3"))
{ {
player.SoundLocation = _workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3"; fileLocation = _workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3";
} }
else else
{ {
MessageBox.Show("The file '" + listBoxEntity.SelectedItem.ToString() + "' couldn't be found.", "File Not Found"); MessageBox.Show("The file '" + listBoxEntity.SelectedItem.ToString() + "' couldn't be found.", "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
{
btnRandom.Enabled = true;
}
randomIterationNumericUpDown.Enabled = true;
loopSelectedSoundCheckBox.Enabled = true;
return; return;
} }
player.Load();
player.PlaySync();
} }
else else
{ {
listBoxEntity.SelectedIndex = randomNum.Next(listBoxEntity.Items.Count); listBoxEntity.SelectedIndex = randomNum.Next(listBoxEntity.Items.Count);
if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav")) if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"))
{ {
player.SoundLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"; fileLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav";
} }
else if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3")) else if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3"))
{ {
player.SoundLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3"; fileLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3";
} }
else else
{ {
MessageBox.Show("The file '" + listBoxEntity.SelectedItem.ToString() + "' couldn't be found.", "File Not Found"); MessageBox.Show("The file '" + listBoxEntity.SelectedItem.ToString() + "' couldn't be found.", "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
{
btnRandom.Enabled = true;
}
randomIterationNumericUpDown.Enabled = true;
loopSelectedSoundCheckBox.Enabled = true;
return; return;
} }
player.Load();
player.PlaySync();
} }
//play the sound file
PlaySoundFile(fileLocation, listBoxEntity.SelectedItem.ToString(), false);
} }
//renable the controls //renable the controls
btnRandom.Enabled = true; if (soundboardTabControl.SelectedTab.Controls[0].Enabled == true)
{
btnRandom.Enabled = true;
}
randomIterationNumericUpDown.Enabled = true; randomIterationNumericUpDown.Enabled = true;
loopSelectedSoundCheckBox.Enabled = true; loopSelectedSoundCheckBox.Enabled = true;
} }
private void PlaySoundFile(string fileLocation, string fileName, bool willLoop = true)
{
Player.URL = fileLocation;
try
{
if (Player.settings.getMode("loop"))
{
if (!willLoop)
{
Player.settings.setMode("loop", false);
Player.controls.play();
}
else
{
Player.controls.play();
}
Player.settings.setMode("loop", true);
}
else
{
Player.controls.play();
}
}
catch (InvalidOperationException Ex)
{
MessageBox.Show("The file '" + fileName + "' couldn't be played.", "Invalid Sound File", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
private void loopSelectedSoundCheckBox_CheckedChanged(object sender, EventArgs e) private void loopSelectedSoundCheckBox_CheckedChanged(object sender, EventArgs e)
{ {
if (loopSelectedSoundCheckBox.Checked == true) if (loopSelectedSoundCheckBox.Checked == true)
{ {
willLoopSound = true; Player.settings.setMode("loop", true);
} }
else else
{ {
willLoopSound = false; Player.settings.setMode("loop", false);
player.Stop(); Player.close();
} }
} }
private void playRandomSoundBothColumns(int iterations) private void playRandomSoundBothColumns(int iterations)
{ {
int tempRandomNumber;
string fileLocation;
listBoxEntity = (ListBox)soundboardTabControl.SelectedTab.Controls[0];
for (int i = 0; i <= iterations; i++)
{
tempRandomNumber = randomNum.Next(0, soundboardTabControl.TabCount);
if (soundboardTabControl.TabPages[tempRandomNumber].Controls[0].Enabled == true)
{
soundboardTabControl.SelectedIndex = tempRandomNumber;
if (soundboardTabControl.SelectedIndex == 0)
{
if (File.Exists(_workingDirectory + "\\" + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"))
{
fileLocation = _workingDirectory + "\\" + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav";
}
else if (File.Exists(_workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3"))
{
fileLocation = _workingDirectory + "\\" + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3";
}
else
{
return;
}
}
else
{
soundboardTabControl.SelectedIndex = tempRandomNumber;
listBoxEntity.SelectedIndex = randomNum.Next(listBoxEntity.Items.Count);
if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"))
{
fileLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav";
}
else if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3"))
{
fileLocation = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3";
}
else
{
return;
}
}
PlaySoundFile(fileLocation, soundboardTabControl.SelectedTab.Text, false);
}
else
{
playRandomSoundBothColumns(iterations);
}
}
} }
private void mainMenuFileShowOnDisk_Click(object sender, EventArgs e) private void mainMenuFileShowOnDisk_Click(object sender, EventArgs e)
{ {
string filePath;
string arg;
listBoxEntity = (ListBox)soundboardTabControl.SelectedTab.Controls[0]; listBoxEntity = (ListBox)soundboardTabControl.SelectedTab.Controls[0];
if ((String)listBoxEntity.SelectedItem == null)
{
MessageBox.Show("No sound file selected...", soundboardTabControl.SelectedTab.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (soundboardTabControl.SelectedIndex == 0) if (soundboardTabControl.SelectedIndex == 0)
{ {
filePath = _workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"; if (File.Exists(_workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"))
arg = "/select, " + '"' + filePath + '"'; {
Process.Start("explorer.exe", arg); Process.Start("explorer.exe", "/select, " + '"' + _workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav" + '"');
}
else
{
Process.Start("explorer.exe", "/select, " + '"' + _workingDirectory + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3" + '"');
}
} }
else else
{ {
filePath = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"; if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav"))
if (File.Exists(filePath))
{ {
Process.Start("explorer.exe", "/select, " + '"' + filePath + '"'); Process.Start("explorer.exe", "/select, " + '"' + _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".wav" + '"');
} }
else if (File.Exists(_workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3")) else
{ {
filePath = _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3"; Process.Start("explorer.exe", "/select, " + '"' + _workingDirectory + "\\" + soundboardTabControl.SelectedTab.Text + "\\" + listBoxEntity.SelectedItem.ToString() + ".mp3" + '"');
Process.Start("explorer.exe", "/select, " + '"' + filePath + '"');
} }
} }
} }
@@ -334,11 +461,5 @@ namespace SoundBoard
{ {
Close(); Close();
} }
private void mainMenuPlayAll_Click(object sender, EventArgs e)
{
MessageBox.Show("Under construction", "To Be Added", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
mainMenuPlayAll.Checked = false;
}
} }
} }