// /home/mrcheeks/Projects/Mono/neighbors/neighbors/Main.cs created with MonoDevelop // User: mrcheeks at 3:19 P 13/10/2007 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // // project created on 13/10/2007 at 3:19 P using System; using System.Collections; using System.IO; using System.Diagnostics; namespace neighbors { /// /// A class to bother the neighbours, be sure to add nasty noises to a directory /// exemples : cow.wav, gun.wav, laugh.wav, cough.wav, etc. :p, let the neighbors have fun... /// class SoundPlayer{ private string[] sounds; private String program; private int[] timers; public SoundPlayer(){ } public void Play(String song){ Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = this.program; p.StartInfo.Arguments = song; p.Start(); p.WaitForExit(); } public string[] GetSounds(){ return this.sounds; } public void SetSounds(string[] sounds){ this.sounds = sounds; } public void SetProgram(String program){ this.program = program; } public int[] GetTimers(){ return timers; } public void SetTimers(int[] timers){ this.timers = timers; } } class MainClass { public static void Main(string[] args) { SoundPlayer player = new SoundPlayer(); ArrayList sounds = new ArrayList(); DirectoryInfo di = new DirectoryInfo("/home/mrcheeks/Sounds"); FileInfo[] rgFiles = di.GetFiles(); player.SetSounds( new string[rgFiles.Length] ); for(int i = 0; i