Quovadis Posted January 16, 2013 Share Posted January 16, 2013 Im currently studying C# and almost finished the console part. Each time I do a project , I try to add something funny and unexpected to kinda to show my teacher I can do research and surpise him. For this project I have to do a console application. What I wanted to do is to implement a method that plays an audio file. I already got it working perfectly now the only problem is that my teacher will probably find it before opening the .exe He always read the whole code before doing so and since its a little competition between me and him I would love to find a way to hide it from him. I have to give him the whole solution of the project in visual studio. Would there be a way to hide if from what is shown in visual studio? Like to call a method that would get the method from another file that isnt in the solution? PS: I want to put a wav of the nyan cat song. Should piss him enough haha Quote Link to comment Share on other sites More sharing options...
Clan Friend SunLight Posted January 16, 2013 Clan Friend Share Posted January 16, 2013 It sounds hard to do, you could try to obfuscate it a bit, but he would find out imho (or at least he'll find a part that's not clear, and he will try to understand what it does). I don't know how you play sounds in c#, do you call a windows api? Maybe you could getprocaddress from an encrypted (even in a simple way) name, and encrypt the filename likewise. Quote Link to comment Share on other sites More sharing options...
Quovadis Posted January 16, 2013 Author Share Posted January 16, 2013 something like private void soundPlaySound() { SoundPlayer playSound = new SoundPlayer(@"path); playSound.Play(); } Quote Link to comment Share on other sites More sharing options...
Clan Friend SunLight Posted January 17, 2013 Clan Friend Share Posted January 17, 2013 (edited) That way it's obvious, hmm... I don't know c# much, but maybe you can open a different process to play the sound, for example windows media player or vlc string lol = @"path to vlc encrypted in some way or it's obvious"; string asdasd = @"path to wav encrypted"; the encryption can be really basic, e.g. adding x to each character, you encrypt with another little program you don't give him call a funtion or do something to decrypt those names in real time, then System.Diagnostics.Process.Start(lol, asdasd); it will call vlc media player to play the wav Actually if you do System.Diagnostics.Process.Start(sound_filename_string) it will open it as if you doubleclick, i.e. it will open the associated media player in the system. It's still obvious, but at least it would give him some trouble edit: actually, if you could turn the sound into a self-playing .exe (i think there is some software to do it, but I never tried), and you run that exe with that function above, it would be even better... Edited January 17, 2013 by SunLight Quote Link to comment Share on other sites More sharing options...
PiNoY Posted January 17, 2013 Share Posted January 17, 2013 Maybe, create a separate program that is of type TSR (terminate and stay resident program) , and probably run that program before your teacher sits down in front of that visual studio PC. The TSR sits down and waits for the trigger key to be activated. Once activated, it will auto play the song. So when your teacher presses Page Down or Down Arrow keys (which is usually being done when viewing source codes) that would activate the TSR trigger and automatically plays the songto piss of your teacher. Do at your own risk ofcourse! Quote Link to comment Share on other sites More sharing options...
Clan Friend SunLight Posted January 17, 2013 Clan Friend Share Posted January 17, 2013 You could write a dll with a function to load and play the sound, then call it, but I think it would be cheating since you must give him all the source code, you can't write a separate part without giving him the source of that part Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.