Skip to content

Commit

Permalink
Hacky fix to the discord issue
Browse files Browse the repository at this point in the history
Sorting on MainWindowHandle now, but this really only works because the choices for discord are 0 (for voice) and nonzero (for chat).

Self-healing ALSO happens to happen in the right order to give us the right handles back, but I don't feel great about this.
  • Loading branch information
ho0ber committed Jan 18, 2019
1 parent 7a09480 commit b120404
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions NK2Tray/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.9.0")]
[assembly: AssemblyFileVersion("0.0.9.0")]
[assembly: AssemblyVersion("0.0.10.0")]
[assembly: AssemblyFileVersion("0.0.10.0")]
7 changes: 5 additions & 2 deletions NK2Tray/SessionAndMeta.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using NAudio.CoreAudioApi;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace NK2Tray
Expand Down Expand Up @@ -40,12 +41,14 @@ public static List<SessionAndMeta> GetSessionMeta(ref SessionCollection sessions
foreach (var ident in sessionsByIdent.Keys.ToList())
{
Console.WriteLine("Working on " + ident);
var ordered = sessionsByIdent[ident].OrderBy(i => i.GetSessionInstanceIdentifier.Split('|').Last().Split('b').Last()).ToList();
//var ordered = sessionsByIdent[ident].OrderBy(i => i.GetSessionInstanceIdentifier.Split('|').Last().Split('b').Last()).ToList();
var ordered = sessionsByIdent[ident].OrderBy(i => (int)Process.GetProcessById((int)i.GetProcessID).MainWindowHandle).ToList();
bool dup = ordered.Count > 1;
for (int i = 0; i < ordered.Count; i++)
{
outSessions.Add(new SessionAndMeta(ordered[i], dup, i));
Console.WriteLine("" + i + ordered[i].GetSessionInstanceIdentifier);
var process = Process.GetProcessById((int)ordered[i].GetProcessID);
Console.WriteLine("" + i + " - " + ordered[i].GetSessionInstanceIdentifier + " - " + process.MainWindowTitle + " - " + (int)process.MainWindowHandle);
}
}

Expand Down

0 comments on commit b120404

Please sign in to comment.