diff --git a/DAWRPC.suo b/DAWRPC.suo index a262aa8..157a960 100644 Binary files a/DAWRPC.suo and b/DAWRPC.suo differ diff --git a/DAWRPC/Form1.cs b/DAWRPC/Form1.cs index 60120a1..2aa2cb2 100644 --- a/DAWRPC/Form1.cs +++ b/DAWRPC/Form1.cs @@ -18,7 +18,7 @@ public Form1() InitializeComponent(); } - string currentDAWName = "None", version = "1.0"; + string currentDAWName = "None", version = "1.1", state = ""; DiscordRpcClient client; DateTime lastTime, curTime, startTimestamp; @@ -64,244 +64,273 @@ string GetRAMUsage(Process proc) private void timer1_Tick(object sender, EventArgs e) { - // Begin DAW Process Variables - var FLStudio = Process.GetProcessesByName("FL"); - var FLStudio64 = Process.GetProcessesByName("FL64"); - var Ab9Intro = Process.GetProcessesByName("Ableton Live 9 Intro"); - var Ab10Intro = Process.GetProcessesByName("Ableton Live 10 Intro"); - var Ab11Intro = Process.GetProcessesByName("Ableton Live 11 Intro"); - var Ab9Stan = Process.GetProcessesByName("Ableton Live 9 Standard"); - var Ab10Stan = Process.GetProcessesByName("Ableton Live 10 Standard"); - var Ab11Stan = Process.GetProcessesByName("Ableton Live 11 Standard"); - var Ab9Suite = Process.GetProcessesByName("Ableton Live 9 Suite"); - var Ab10Suite = Process.GetProcessesByName("Ableton Live 10 Suite"); - var Ab11Suite = Process.GetProcessesByName("Ableton Live 11 Suite"); - // End DAW Process Variables - string clientID = ""; - // Begin DAW Information Grabbing - if (FLStudio.Length != 0) + try { - DAWName.Text = "FL Studio"; - string title = FLStudio[0].MainWindowTitle; - if (title.Contains(" - FL Studio")) + // Begin DAW Process Variables + var FLStudio = Process.GetProcessesByName("FL"); + var FLStudio64 = Process.GetProcessesByName("FL64"); + var Ab9Intro = Process.GetProcessesByName("Ableton Live 9 Intro"); + var Ab10Intro = Process.GetProcessesByName("Ableton Live 10 Intro"); + var Ab11Intro = Process.GetProcessesByName("Ableton Live 11 Intro"); + var Ab9Stan = Process.GetProcessesByName("Ableton Live 9 Standard"); + var Ab10Stan = Process.GetProcessesByName("Ableton Live 10 Standard"); + var Ab11Stan = Process.GetProcessesByName("Ableton Live 11 Standard"); + var Ab9Suite = Process.GetProcessesByName("Ableton Live 9 Suite"); + var Ab10Suite = Process.GetProcessesByName("Ableton Live 10 Suite"); + var Ab11Suite = Process.GetProcessesByName("Ableton Live 11 Suite"); + var Reaper = Process.GetProcessesByName("reaper"); + // End DAW Process Variables + string clientID = ""; + // Begin DAW Information Grabbing + if (FLStudio.Length != 0) { - ProjectOpening.Text = title.Substring(0, title.Length - 15); - } - else - { - ProjectOpening.Text = "None"; - } - CPUUsage.Text = GetCPUUsage(FLStudio[0]) + "%"; - RAMUsage.Text = GetRAMUsage(FLStudio[0]); - clientID = "824353827704668163"; - } - else if (FLStudio64.Length != 0) - { - DAWName.Text = "FL Studio"; - string title = FLStudio64[0].MainWindowTitle; - if (title.Contains(" - FL Studio")) - { - ProjectOpening.Text = title.Substring(0, title.Length - 15); - } - else - { - ProjectOpening.Text = "None"; - } - CPUUsage.Text = GetCPUUsage(FLStudio64[0]) + "%"; - RAMUsage.Text = GetRAMUsage(FLStudio64[0]); - clientID = "824353827704668163"; - } - else if (Ab9Intro.Length != 0) - { - DAWName.Text = "Ableton Live 9 Intro"; - string title = Ab9Intro[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 9 Intro")) - { - ProjectOpening.Text = title.Substring(0, title.Length - 23); - } - else - { - ProjectOpening.Text = "None"; - } - CPUUsage.Text = GetCPUUsage(Ab9Intro[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab9Intro[0]); - clientID = "824924155534114896"; - } - else if (Ab10Intro.Length != 0) - { - DAWName.Text = "Ableton Live 10 Intro"; - string title = Ab10Intro[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 10 Intro")) - { - ProjectOpening.Text = title.Substring(0, title.Length - 24); - } - else - { - ProjectOpening.Text = "None"; - } - CPUUsage.Text = GetCPUUsage(Ab10Intro[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab10Intro[0]); - clientID = "824922704724492339"; - } - else if (Ab11Intro.Length != 0) - { - DAWName.Text = "Ableton Live 11 Intro"; - string title = Ab11Intro[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 11 Intro")) - { - ProjectOpening.Text = title.Substring(0, title.Length - 24); - } - else - { - ProjectOpening.Text = "None"; + DAWName.Text = "FL Studio"; + string title = FLStudio[0].MainWindowTitle; + if (title.Contains(" - FL Studio")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 15); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(FLStudio[0]) + "%"; + RAMUsage.Text = GetRAMUsage(FLStudio[0]); + clientID = "824353827704668163"; } - CPUUsage.Text = GetCPUUsage(Ab11Intro[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab11Intro[0]); - clientID = "824924504190091275"; - } - else if (Ab9Suite.Length != 0) - { - DAWName.Text = "Ableton Live 9 Suite"; - string title = Ab10Suite[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 9 Suite")) + else if (FLStudio64.Length != 0) { - ProjectOpening.Text = title.Substring(0, title.Length - 23); + DAWName.Text = "FL Studio"; + string title = FLStudio64[0].MainWindowTitle; + if (title.Contains(" - FL Studio")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 15); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(FLStudio64[0]) + "%"; + RAMUsage.Text = GetRAMUsage(FLStudio64[0]); + clientID = "824353827704668163"; } - else + else if (Ab9Intro.Length != 0) { - ProjectOpening.Text = "None"; + DAWName.Text = "Ableton Live 9 Intro"; + string title = Ab9Intro[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 9 Intro")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 23); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab9Intro[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab9Intro[0]); + clientID = "824924155534114896"; } - CPUUsage.Text = GetCPUUsage(Ab10Suite[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab10Suite[0]); - clientID = "824927510215131156"; - } - else if (Ab10Suite.Length != 0) - { - DAWName.Text = "Ableton Live 10 Suite"; - string title = Ab10Suite[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 10 Suite")) + else if (Ab10Intro.Length != 0) { - ProjectOpening.Text = title.Substring(0, title.Length - 24); + DAWName.Text = "Ableton Live 10 Intro"; + string title = Ab10Intro[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 10 Intro")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 24); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab10Intro[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab10Intro[0]); + clientID = "824922704724492339"; } - else + else if (Ab11Intro.Length != 0) { - ProjectOpening.Text = "None"; + DAWName.Text = "Ableton Live 11 Intro"; + string title = Ab11Intro[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 11 Intro")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 24); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab11Intro[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab11Intro[0]); + clientID = "824924504190091275"; } - CPUUsage.Text = GetCPUUsage(Ab10Suite[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab10Suite[0]); - clientID = "824354477720076309"; - } - else if (Ab11Suite.Length != 0) - { - DAWName.Text = "Ableton Live 11 Suite"; - string title = Ab11Suite[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 11 Suite")) + else if (Ab9Suite.Length != 0) { - ProjectOpening.Text = title.Substring(0, title.Length - 24); + DAWName.Text = "Ableton Live 9 Suite"; + string title = Ab10Suite[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 9 Suite")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 23); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab10Suite[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab10Suite[0]); + clientID = "824927510215131156"; } - else + else if (Ab10Suite.Length != 0) { - ProjectOpening.Text = "None"; + DAWName.Text = "Ableton Live 10 Suite"; + string title = Ab10Suite[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 10 Suite")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 24); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab10Suite[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab10Suite[0]); + clientID = "824354477720076309"; } - CPUUsage.Text = GetCPUUsage(Ab11Suite[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab11Suite[0]); - clientID = "824365569973288980"; - } - else if (Ab9Stan.Length != 0) - { - DAWName.Text = "Ableton Live 9 Standard"; - string title = Ab10Stan[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 9 Standard")) + else if (Ab11Suite.Length != 0) { - ProjectOpening.Text = title.Substring(0, title.Length - 26); + DAWName.Text = "Ableton Live 11 Suite"; + string title = Ab11Suite[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 11 Suite")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 24); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab11Suite[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab11Suite[0]); + clientID = "824365569973288980"; } - else + else if (Ab9Stan.Length != 0) { - ProjectOpening.Text = "None"; + DAWName.Text = "Ableton Live 9 Standard"; + string title = Ab10Stan[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 9 Standard")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 26); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab9Stan[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab9Stan[0]); + clientID = "824925290526408759"; } - CPUUsage.Text = GetCPUUsage(Ab9Stan[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab9Stan[0]); - clientID = "824925290526408759"; - } - else if (Ab10Stan.Length != 0) - { - DAWName.Text = "Ableton Live 10 Standard"; - string title = Ab10Stan[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 10 Standard")) + else if (Ab10Stan.Length != 0) { - ProjectOpening.Text = title.Substring(0, title.Length - 27); + DAWName.Text = "Ableton Live 10 Standard"; + string title = Ab10Stan[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 10 Standard")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 27); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab10Stan[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab10Stan[0]); + clientID = "824355553252999208"; } - else + else if (Ab11Stan.Length != 0) { - ProjectOpening.Text = "None"; + DAWName.Text = "Ableton Live 11 Standard"; + string title = Ab11Stan[0].MainWindowTitle; + if (title.Contains(" - Ableton Live 11 Standard")) + { + ProjectOpening.Text = title.Substring(0, title.Length - 27); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Ab11Stan[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Ab11Stan[0]); + clientID = "824365704890679347"; } - CPUUsage.Text = GetCPUUsage(Ab10Stan[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab10Stan[0]); - clientID = "824355553252999208"; - } - else if (Ab11Stan.Length != 0) - { - DAWName.Text = "Ableton Live 11 Standard"; - string title = Ab11Stan[0].MainWindowTitle; - if (title.Contains(" - Ableton Live 11 Standard")) + else if (Reaper.Length != 0) { - ProjectOpening.Text = title.Substring(0, title.Length - 27); + DAWName.Text = "REAPER"; + string title = Reaper[0].MainWindowTitle; + if (title.Contains(" - REAPER v")) + { + ProjectOpening.Text = title.Substring(0, title.IndexOf(" - REAPER v")); + } + else + { + ProjectOpening.Text = "None"; + } + CPUUsage.Text = GetCPUUsage(Reaper[0]) + "%"; + RAMUsage.Text = GetRAMUsage(Reaper[0]); + clientID = "825128795039465472"; + var registeredText = "unregistered"; + if (title.Contains("Registered to ")) registeredText = ", registered to " + title.Substring(title.IndexOf("Registered to ") + 14, title.Length - title.IndexOf("Registered to ") - 14); + state = "version " + title.Substring(title.IndexOf(" - REAPER v") + 11, 4) + registeredText + ", " + CPUUsage.Text + " of CPU usage, " + RAMUsage.Text + " of RAM usage"; } + // End DAW Process Information Grabbing else { + DAWName.Text = "None"; ProjectOpening.Text = "None"; } - CPUUsage.Text = GetCPUUsage(Ab11Stan[0]) + "%"; - RAMUsage.Text = GetRAMUsage(Ab11Stan[0]); - clientID = "824365704890679347"; - } - // End DAW Process Information Grabbing - else - { - DAWName.Text = "None"; - ProjectOpening.Text = "None"; - } - // Update DAWRPC Information - if (DAWName.Text != currentDAWName) - { - try - { - client = new DiscordRpcClient(clientID); - client.Initialize(); - currentDAWName = DAWName.Text; - startTimestamp = DateTime.UtcNow; - } - catch + // Update DAWRPC Information + if (DAWName.Text != currentDAWName) { - if (client != null) + try + { + client = new DiscordRpcClient(clientID); + client.Initialize(); + currentDAWName = DAWName.Text; + startTimestamp = DateTime.UtcNow; + } + catch { - client.Dispose(); + if (client != null) + { + client.Dispose(); + } } } - } - if (DAWName.Text != "None") - { - string details = "Opening project: " + ProjectOpening.Text; - if (ProjectOpening.Text == "None" || ProjectOpening.Text == "Untitled") details = "Opening an untitled project"; - client.SetPresence(new RichPresence() + if (DAWName.Text != "None") { - Timestamps = new Timestamps() - { - Start = startTimestamp - }, - Details = details, - State = CPUUsage.Text + " of CPU usage, " + RAMUsage.Text + " of RAM usage", - Assets = new Assets() + string details = "Opening project: " + ProjectOpening.Text; + // Default state for non-REAPER DAW + if (DAWName.Text != "REAPER") state = CPUUsage.Text + " of CPU usage, " + RAMUsage.Text + " of RAM usage"; + if (ProjectOpening.Text == "None" || ProjectOpening.Text == "Untitled") details = "Opening an untitled project"; + client.SetPresence(new RichPresence() { - LargeImageKey = "icon", - LargeImageText = "DAWRPC v" + version + " by Nico Levianth" - } - }); + Timestamps = new Timestamps() + { + Start = startTimestamp + }, + Details = details, + State = state, + Assets = new Assets() + { + LargeImageKey = "icon", + LargeImageText = "DAWRPC v" + version + " by Nico Levianth" + } + }); + } + else if (client != null) + { + client.Dispose(); + } } - else if (client != null) + catch { - client.Dispose(); + } } } diff --git a/DAWRPC/bin/Debug/DAWRPC.exe b/DAWRPC/bin/Debug/DAWRPC.exe index a779bfb..c6d102e 100644 Binary files a/DAWRPC/bin/Debug/DAWRPC.exe and b/DAWRPC/bin/Debug/DAWRPC.exe differ diff --git a/DAWRPC/bin/Debug/DAWRPC.pdb b/DAWRPC/bin/Debug/DAWRPC.pdb index 4029374..84807a0 100644 Binary files a/DAWRPC/bin/Debug/DAWRPC.pdb and b/DAWRPC/bin/Debug/DAWRPC.pdb differ diff --git a/DAWRPC/obj/Debug/DAWRPC.exe b/DAWRPC/obj/Debug/DAWRPC.exe index a779bfb..c6d102e 100644 Binary files a/DAWRPC/obj/Debug/DAWRPC.exe and b/DAWRPC/obj/Debug/DAWRPC.exe differ diff --git a/DAWRPC/obj/Debug/DAWRPC.pdb b/DAWRPC/obj/Debug/DAWRPC.pdb index 4029374..84807a0 100644 Binary files a/DAWRPC/obj/Debug/DAWRPC.pdb and b/DAWRPC/obj/Debug/DAWRPC.pdb differ diff --git a/README.md b/README.md index 27fb34b..ca747fc 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ It will show as the following: * FL Studio 11 or later * Ableton Live 9 Intro or later (doesn't support Lite, Beta and Trial version) +* REAPER ## Installation