Skip to content

Commit

Permalink
Update 23.10.4
Browse files Browse the repository at this point in the history
- Attempts were made to fix memory leaking
  • Loading branch information
yagdev committed Oct 4, 2023
1 parent f4ea74b commit 0e95095
Show file tree
Hide file tree
Showing 95 changed files with 736 additions and 64 deletions.
2 changes: 1 addition & 1 deletion DiscordRPCAttempt2/DiscordRPCAttempt2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<Title>Discord Spotify Lyrics RPC</Title>
<Version>23.10.3</Version>
<Version>23.10.4</Version>
<Authors>YAG-dev</Authors>
<Company>YAG-dev</Company>
<Product>Discord Spotify Lyrics RPC</Product>
Expand Down
129 changes: 78 additions & 51 deletions DiscordRPCAttempt2/Settings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ public Settings()
}
public async void PerformLyricShit()
{
startthread:
var handler = new SocketsHttpHandler
{
ConnectTimeout = TimeSpan.FromSeconds(5)
};
try
using (var client2 = new HttpClient(handler))
{
if (startshit == 1)
try
{
var spotify = new SpotifyClient(Toki);
SpotifyAPI.Web.PlayerCurrentlyPlayingRequest request2 = new SpotifyAPI.Web.PlayerCurrentlyPlayingRequest();
var track = spotify.Player.GetCurrentlyPlaying(request2);
try
if (startshit == 1)
{
using (var client2 = new HttpClient(handler))
var spotify = new SpotifyClient(Toki);
SpotifyAPI.Web.PlayerCurrentlyPlayingRequest request2 = new SpotifyAPI.Web.PlayerCurrentlyPlayingRequest();
var track = spotify.Player.GetCurrentlyPlaying(request2);
try
{

try
{
var url = "https://api.spotify.com/v1/me/player/currently-playing";
Expand All @@ -141,6 +141,7 @@ public async void PerformLyricShit()
SongID = Title2;
SongTitleReloadedAlgo = reader.ReadLine();
SongTitleReloadedAlgo = reader.ReadLine();
reader.Close();
SongTitleReloadedAlgo = SongTitleReloadedAlgo.Remove(0, 14);
SongTitleReloadedAlgo = SongTitleReloadedAlgo.Remove(SongTitleReloadedAlgo.Length - 2, 2);
if (SongID == SongIDCache)
Expand All @@ -149,10 +150,11 @@ public async void PerformLyricShit()
{
timestamp = "";
var reader2 = new StringReader(Lyrics);
startchicanery:
startchicanery:
Lyrics2 = reader2.ReadLine();
if (Lyrics2.Contains("startTimeMs"))
{

Lyrics2 = Lyrics2.Remove(0, 15);
Lyrics2 = Lyrics2.Remove(Lyrics2.Length - 2, 2);
string TimestampNewAlgo2 = "";
Expand All @@ -161,6 +163,7 @@ public async void PerformLyricShit()
startchicanerynewprogressalgo:
if (TimestampNewAlgo2.Contains("progress_ms"))
{
reader4.Close();
TimestampNewAlgo2 = TimestampNewAlgo2.Remove(0, 18);
TimestampNewAlgo2 = TimestampNewAlgo2.Remove(TimestampNewAlgo2.Length - 1, 1);
timestamp = TimestampNewAlgo2;
Expand Down Expand Up @@ -191,11 +194,13 @@ public async void PerformLyricShit()
{
goto startchicanery;
}
reader2.Close();
}
catch (Exception)
{
LyricCache = "";
}

}
else
{
Expand Down Expand Up @@ -228,6 +233,7 @@ public async void PerformLyricShit()
TimestampNewAlgo2 = TimestampNewAlgo2.Remove(0, 18);
TimestampNewAlgo2 = TimestampNewAlgo2.Remove(TimestampNewAlgo2.Length - 1, 1);
timestamp = TimestampNewAlgo2;
reader4.Close();
}
else
{
Expand All @@ -250,15 +256,20 @@ public async void PerformLyricShit()
Lyrics2 = reader2.ReadLine();
goto startchicanery;
}
else
{
reader2.Close();
}
}
else
{
Lyrics2 = reader2.ReadLine();
goto startchicanery;
}
}
catch (Exception)
catch (Exception nn)
{
nn.Data.Clear();
LyricCache = "";
}
}
Expand Down Expand Up @@ -290,16 +301,17 @@ public async void PerformLyricShit()
AlbumName = reader3.ReadLine();
AlbumName = AlbumName.Remove(0, 16);
AlbumName = AlbumName.Remove(AlbumName.Length - 2, 2);

reader3.Close();
}
else
{
AlbumCoverBase2 = reader3.ReadLine();
goto albumchicanery;
}
}
catch (Exception)
catch (Exception ab)
{
ab.Data.Clear();
AlbumCoverBase2 = "https://cdn-icons-png.flaticon.com/512/8438/8438101.png";
}
try
Expand All @@ -320,8 +332,9 @@ public async void PerformLyricShit()
}
});
}
catch (Exception)
catch (Exception aa)
{
aa.Data.Clear();
throw new Exception();
}
}
Expand All @@ -332,42 +345,51 @@ public async void PerformLyricShit()
}
catch (Exception a)
{
a.Data.Clear();
//System.Windows.MessageBox.Show(a.Message + "Error 1");
client2.Dispose();
Thread.Sleep(1300);
Thread thread0 = new Thread(PerformLyricShit);
thread0.Start();
Thread thread3 = new Thread(PerformLyricShit);
thread3.Start();
}
}
catch (Exception r)
{
r.Data.Clear();
//System.Windows.MessageBox.Show(r.Message + "Error 2");
client2.Dispose();
Thread.Sleep(1300);
Thread thread0 = new Thread(PerformLyricShit);
thread0.Start();
Thread thread3 = new Thread(PerformLyricShit);
thread3.Start();
}
client2.Dispose();
Thread.Sleep(1300);
Thread thread2 = new Thread(PerformLyricShit);
thread2.Start();
}
catch (Exception ex)
{
//System.Windows.MessageBox.Show(ex.Message + "Error 3");
ex.Data.Clear();
client2.Dispose();
Thread thread0 = new Thread(RefreshAPICallable);
thread0.Start();
Thread.Sleep(1300);
Thread thread3 = new Thread(PerformLyricShit);
thread3.Start();
}
Thread.Sleep(1300);
Thread thread = new Thread(PerformLyricShit);
thread.Start();
}
catch (Exception ex)
{
//System.Windows.MessageBox.Show(ex.Message + "Error 3");
Thread thread0 = new Thread(RefreshAPICallable);
thread0.Start();
Thread.Sleep(1300);
Thread thread = new Thread(PerformLyricShit);
thread.Start();
}
}
}
catch(Exception e)
{
//System.Windows.MessageBox.Show(e.Message + "Error 4");
startshit = 1;
Thread.Sleep(1300);
Thread thread = new Thread(PerformLyricShit);
thread.Start();
catch (Exception e)
{
//System.Windows.MessageBox.Show(e.Message + "Error 4");
e.Data.Clear();
startshit = 1;
client2.Dispose();
Thread.Sleep(1300);
Thread thread3 = new Thread(PerformLyricShit);
thread3.Start();
}
}
albumline = 0;
}
Expand Down Expand Up @@ -413,9 +435,9 @@ public async void RefreshToken()
{
ConnectTimeout = TimeSpan.FromSeconds(5)
};
try
using (var client2 = new HttpClient(handler))
{
using (var client2 = new HttpClient(handler))
try
{
var url0 = "https://open.spotify.com/get_access_token?reason=transport&productType=web_player";
client2.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36");
Expand All @@ -440,6 +462,7 @@ public async void RefreshToken()
Int64 LocalTimeInt = Convert.ToInt64(LocalTime);
Int64 CalcTime = TokiExpirationInt - LocalTimeInt;
int CalcTimeInt = Convert.ToInt32(CalcTime + 10000);
reader2.Close();
if (CalcTimeInt < 0)
{
Thread.Sleep(10000);
Expand All @@ -448,16 +471,18 @@ public async void RefreshToken()
{
Thread.Sleep(CalcTimeInt);
}
Thread.Sleep(CalcTimeInt);
client2.Dispose();
Thread thread2 = new Thread(RefreshToken);
thread2.Start();
}
catch (Exception ej)
{
//System.Windows.MessageBox.Show(ej.Message + "Error 6");
ej.Data.Clear();
client2.Dispose();
Thread thread2 = new Thread(RefreshToken);
thread2.Start();
}
}
catch (Exception ej)
{
//System.Windows.MessageBox.Show(ej.Message + "Error 6");
Thread thread2 = new Thread(RefreshToken);
thread2.Start();
}
}
}
Expand All @@ -468,15 +493,16 @@ public async void RefreshAPI()
var newResponse = await new OAuthClient().RequestToken(new AuthorizationCodeRefreshRequest(_clientId, _secretId, TokiRefresh));
Toki = newResponse.AccessToken;
Thread.Sleep(3600000);
Thread thread = new Thread(RefreshAPI);
thread.Start();
Thread thread2 = new Thread(RefreshAPI);
thread2.Start();
}
catch (Exception en)
{
//System.Windows.MessageBox.Show(en.Message + "Error 7");
en.Data.Clear();
Thread.Sleep(2000);
Thread thread = new Thread(RefreshAPI);
thread.Start();
Thread thread2 = new Thread(RefreshAPI);
thread2.Start();
}
}
public async void RefreshAPICallable()
Expand All @@ -488,14 +514,15 @@ public async void RefreshAPICallable()
}
catch(Exception ep)
{
ep.Data.Clear();
//System.Windows.MessageBox.Show(ep.Message + "Error 8");
}
}
public async void UpdateCheck()
{
WebClient client = new WebClient();
string reply = client.DownloadString("https://www.dropbox.com/scl/fi/3we6tm5sv3o1aisssi41g/release.txt?rlkey=ry6xif19s2bp8uk50p7aer9xa&dl=1");
if (reply == "23.10.3")
if (reply == "23.10.4")
{
this.Dispatcher.Invoke(() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"DiscordRPCAttempt2/23.10.3": {
"DiscordRPCAttempt2/23.10.4": {
"dependencies": {
"DiscordRichPresence": "1.2.1.24",
"SpotifyAPI.Web": "7.0.0",
Expand Down Expand Up @@ -103,7 +103,7 @@
}
},
"libraries": {
"DiscordRPCAttempt2/23.10.3": {
"DiscordRPCAttempt2/23.10.4": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified DiscordRPCAttempt2/bin/Debug/net6.0-windows/DiscordRPCAttempt2.dll
Binary file not shown.
Binary file not shown.
Binary file modified DiscordRPCAttempt2/bin/Debug/net6.0-windows/DiscordRPCAttempt2.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

[assembly: System.Reflection.AssemblyCompanyAttribute("YAG-dev")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("23.10.3.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("23.10.3")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("23.10.4.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("23.10.4")]
[assembly: System.Reflection.AssemblyProductAttribute("Discord Spotify Lyrics RPC")]
[assembly: System.Reflection.AssemblyTitleAttribute("DiscordRPCAttempt2")]
[assembly: System.Reflection.AssemblyVersionAttribute("23.10.3.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("23.10.4.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
510c0246817c6dcda37a69e8f9d81900491fed1f
1c397697328c8b7d24b5689b2a2c022fee25b964
Binary file modified DiscordRPCAttempt2/obj/Debug/net6.0-windows/DiscordRPCAttempt2.dll
Binary file not shown.
Binary file not shown.
Binary file modified DiscordRPCAttempt2/obj/Debug/net6.0-windows/DiscordRPCAttempt2.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("YAG-dev")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("23.10.3.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("23.10.3")]
[assembly: System.Reflection.AssemblyProductAttribute("Discord Spotify Lyrics RPC")]
[assembly: System.Reflection.AssemblyTitleAttribute("DiscordRPCAttempt2")]
[assembly: System.Reflection.AssemblyVersionAttribute("23.10.3.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
510c0246817c6dcda37a69e8f9d81900491fed1f
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
is_global = true
build_property.ApplicationManifest =
build_property.StartupObject =
build_property.ApplicationDefaultFont =
build_property.ApplicationHighDpiMode =
build_property.ApplicationUseCompatibleTextRendering =
build_property.ApplicationVisualStyles =
build_property.TargetFramework = net6.0-windows
build_property.TargetPlatformMinVersion = 7.0
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = DiscordRPCAttempt2_4mwzvlod_wpftmp
build_property.ProjectDir = C:\Users\dinis\source\repos\DiscordRPCAttempt2\DiscordRPCAttempt2\
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DiscordRPCAttempt2
23.10.3.0
23.10.4.0

winexe
C#
Expand Down
Loading

0 comments on commit 0e95095

Please sign in to comment.