-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔌 Fix several issues and add debug logging (#15)
* Added some clear error messages, made sure application runs only once. * Minor style changes * Added support for Garena client, and renamed Utils to LeagueMonitor for slight clarity * Fix error where League client has to be running, plus make the popups less obnoxious * Added option to start on boot. - Startup message is surpressed when the setting is on. - Checks whether the app is moved if the setting is on, and sets the new app location as the startup application * Most minor nitpick ever * 🎉 Version bump to 1.1.0 * Fix issue with people unable to connect to League of Legends because of an SSL issue * Prevent undefined behaviour when application isn't running as an administrator * Catch issues connecting to the League Client * Add all debug logging present * Remove unused file reference * Remove another reference to app manifest * Remove ancient files * Request admin when command line is null * Improve SSL checking
- Loading branch information
1 parent
692fdce
commit a1c5dd2
Showing
6 changed files
with
179 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using System.Security.Principal; | ||
|
||
namespace Conduit | ||
{ | ||
public static class Administrator | ||
{ | ||
public static bool IsAdmin() | ||
{ | ||
using (WindowsIdentity identity = WindowsIdentity.GetCurrent()) | ||
{ | ||
WindowsPrincipal principal = new WindowsPrincipal(identity); | ||
return principal.IsInRole(WindowsBuiltInRole.Administrator); | ||
} | ||
} | ||
|
||
public static void Elevate() | ||
{ | ||
var currentProcessInfo = new ProcessStartInfo | ||
{ | ||
UseShellExecute = true, | ||
WorkingDirectory = Environment.CurrentDirectory, | ||
FileName = Assembly.GetEntryAssembly().Location, | ||
Verb = "runas" | ||
}; | ||
|
||
Process.Start(currentProcessInfo); | ||
Environment.Exit(0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace Conduit | ||
{ | ||
public class DebugLogger | ||
{ | ||
public static DebugLogger Global = new DebugLogger("global.txt"); | ||
|
||
private StreamWriter writer; | ||
|
||
public DebugLogger(string fileName) | ||
{ | ||
writer = new StreamWriter(Path.Combine(Persistence.DATA_DIRECTORY, fileName), true); | ||
writer.AutoFlush = true; | ||
writer.WriteLine($"\n\n\n --- {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")} --- "); | ||
writer.WriteLine($"Started logging to {fileName}..."); | ||
} | ||
|
||
public void WriteError(string error) | ||
{ | ||
writer.WriteLine($"[ERROR {DateTime.Now.ToString("HH:mm:ss")}] {error}"); | ||
} | ||
|
||
public void WriteMessage(string message) | ||
{ | ||
writer.WriteLine($"[MSG {DateTime.Now.ToString("HH:mm:ss")}] {message}"); | ||
} | ||
|
||
public void WriteWarning(string warning) | ||
{ | ||
writer.WriteLine($"[WRN {DateTime.Now.ToString("HH:mm:ss")}] {warning}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters