Skip to content

Commit

Permalink
Lia Lianghua "ruined" my Discord account
Browse files Browse the repository at this point in the history
* Changed some application IDs for displaying some DAWs due to my old Discord account's deletion. (#10)
* Added the alert box displaying part when an error occurs while connecting to Discord RPC server.
  • Loading branch information
Serena1432 committed Dec 27, 2023
1 parent 1d11cf8 commit 5d9c1e2
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 9,514 deletions.
Binary file modified DAWRPC.suo
Binary file not shown.
10 changes: 4 additions & 6 deletions DAWRPC/DAWRPC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DiscordRPC, Version=1.0.175.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Downloads\DiscordRPC.dll</HintPath>
<Reference Include="DiscordRPC">
<HintPath>.\DiscordRPC.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\Downloads\newtonsoft.json.12.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json">
<HintPath>.\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Expand Down
File renamed without changes.
27 changes: 24 additions & 3 deletions DAWRPC/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public Form1()
TimeSpan lastTotalProcessorTime, curTotalProcessorTime;
ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));

bool errorDisplayed = false;

private void Form1_Load(object sender, EventArgs e)
{
if (Process.GetProcessesByName("DAWRPC").Length > 1)
Expand Down Expand Up @@ -176,7 +178,7 @@ private void timer1_Tick(object sender, EventArgs e)
}
CPUUsage.Text = GetCPUUsage(Ab11Intro[0]) + "%";
RAMUsage.Text = GetRAMUsage(Ab11Intro[0]);
clientID = "908339193854455839";
clientID = "1189627743919411270";
versionText = Ab11Intro[0].Modules[0].FileVersionInfo.ProductVersion.ToString();
}
else if (Ab9Suite.Length != 0)
Expand Down Expand Up @@ -227,7 +229,7 @@ private void timer1_Tick(object sender, EventArgs e)
}
CPUUsage.Text = GetCPUUsage(Ab11Suite[0]) + "%";
RAMUsage.Text = GetRAMUsage(Ab11Suite[0]);
clientID = "908336471193313310";
clientID = "1189627361881235507";
versionText = Ab11Suite[0].Modules[0].FileVersionInfo.ProductVersion.ToString();
}
else if (Ab9Stan.Length != 0)
Expand Down Expand Up @@ -278,7 +280,7 @@ private void timer1_Tick(object sender, EventArgs e)
}
CPUUsage.Text = GetCPUUsage(Ab11Stan[0]) + "%";
RAMUsage.Text = GetRAMUsage(Ab11Stan[0]);
clientID = "908342510802317313";
clientID = "1189628515801366690";
versionText = Ab11Stan[0].Modules[0].FileVersionInfo.ProductVersion.ToString();
}
else if (Reaper.Length != 0)
Expand Down Expand Up @@ -370,24 +372,43 @@ private void timer1_Tick(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(readyEvent.User.Username)) discordUsername.Text = "Logged in as " + readyEvent.User.Username;
else discordUsername.Text = "No Discord user available";
errorDisplayed = false;
}
catch { }
};
client.OnConnectionFailed += (cfSender, cfEvent) =>
{
discordUsername.Text = "Connection failed";
notifyIcon1.Icon = (Icon)resources.GetObject("red");
if (!errorDisplayed)
{
MessageBox.Show("Cannot connect to Discord pipe " + cfEvent.FailedPipe.ToString() + ".", "DAWRPC Connection Error");
errorDisplayed = true;
}
};
client.OnError += (eSender, eEvent) =>
{
discordUsername.Text = "An error has been occurred";
notifyIcon1.Icon = (Icon)resources.GetObject("red");
if (!errorDisplayed)
{
MessageBox.Show("Cannot connect to Discord RPC server.\nCode " + eEvent.Code.ToString() + ": " + eEvent.Message, "DAWRPC Connection Error");
errorDisplayed = true;
}
};
client.OnConnectionEstablished += (eSender, eEvent) =>
{
if (!String.IsNullOrEmpty(discordUsernameGlobal)) discordUsername.Text = "Logged in as " + discordUsernameGlobal;
else discordUsername.Text = "No Discord user available";
notifyIcon1.Icon = (Icon)resources.GetObject("green");
errorDisplayed = false;
};
client.OnPresenceUpdate += (eSender, eEvent) =>
{
if (!String.IsNullOrEmpty(discordUsernameGlobal)) discordUsername.Text = "Logged in as " + discordUsernameGlobal;
else discordUsername.Text = "No Discord user available";
notifyIcon1.Icon = (Icon)resources.GetObject("green");
errorDisplayed = false;
};
client.Initialize();
currentDAWName = DAWName.Text;
Expand Down
File renamed without changes.
Binary file removed DAWRPC/bin/Debug/DAWRPC.exe
Binary file not shown.
Binary file removed DAWRPC/bin/Debug/DAWRPC.pdb
Binary file not shown.
Binary file removed DAWRPC/bin/Debug/DAWRPC.vshost.exe
Binary file not shown.
Loading

0 comments on commit 5d9c1e2

Please sign in to comment.