-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
77 lines (55 loc) · 2.28 KB
/
Program.cs
File metadata and controls
77 lines (55 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.IO;
using System.Media;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World! I will allow you to listen to Music via the Windows Command Line!");
Console.WriteLine("");
Console.WriteLine("Please note that as of now, I can only play WAV files. This is operating system restrcited.");
Console.WriteLine("");
Console.WriteLine("Program (C) 2020 keifmeister. Give credit where credit is due.");
Console.WriteLine("");
Console.WriteLine("Press 1 to drag and drop a wav file to play, or 2 to enter the directry manually.");
int input_1 = Convert.ToInt32(Console.ReadLine());
string input_2 = Convert.ToString(Console.ReadLine());
int aaction = input_1;
switch (aaction)
{
case 1:
SoundPlayer sPlayerq = new SoundPlayer();
sPlayerq.SoundLocation = input_2;
sPlayerq.PlaySync();
break;
case 2:
try
{
string searchQuery = input_2;
string folderName = @"C:\";
var directory = new DirectoryInfo(folderName);
var directories = directory.GetDirectories(searchQuery, SearchOption.AllDirectories);
var files = directory.GetFiles(searchQuery, SearchOption.AllDirectories);
foreach (var d in directories)
{
Console.WriteLine(d);
}
foreach (var f in files)
{
Console.WriteLine(f);
}
}
catch (Exception e)
{
//
}
SoundPlayer sPlayer2 = new SoundPlayer();
sPlayer2.SoundLocation = input_2;
sPlayer2.PlaySync();
break;
}
}
}
}