forked from automuteus/amonguscapture
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Console works again (though the console is very likely to change in t…
…he future)
- Loading branch information
Showing
13 changed files
with
251 additions
and
353 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 |
---|---|---|
|
@@ -49,4 +49,8 @@ | |
</Compile> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="PangoText" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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; | ||
using Config.Net; | ||
using Gtk; | ||
|
||
namespace AmongUsCapture_GTK | ||
{ | ||
public static class GtkSettings | ||
{ | ||
public static string StorageLocation = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "AmongUsCapture"); | ||
|
||
public static ConsoleInterface conInterface; | ||
|
||
public static void WriteLineToConsole(string time, string module, string severity, string message) | ||
{ | ||
if (conInterface != null) | ||
{ | ||
|
||
} | ||
} | ||
|
||
//Global persistent settings that are saved to a json file. Limited Types | ||
public static IGtkPersistentSettings PersistentSettings = new ConfigurationBuilder<IGtkPersistentSettings>().UseJsonFile(Path.Join(StorageLocation, "GtkSettings.json")).Build(); | ||
} | ||
|
||
|
||
public interface IGtkPersistentSettings | ||
{ | ||
//Types allowed: bool, double, int, long, string, TimeSpan, DateTime, Uri, Guid | ||
//DateTime is always converted to UTC | ||
bool skipHandlerInstall { get; set; } | ||
|
||
} | ||
|
||
} |
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
File renamed without changes.
File renamed without changes.
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,120 @@ | ||
using System.Drawing; | ||
using AmongUsCapture; | ||
using AmongUsCapture_GTK; | ||
using Castle.Components.DictionaryAdapter; | ||
using Discord.Commands; | ||
using GLib; | ||
using Gtk; | ||
using NLog; | ||
using Target = NLog.Targets.Target; | ||
using NLog.Targets; | ||
using NLog.Config; | ||
|
||
namespace AUCapture_GTK.ConsoleTypes; | ||
|
||
[Target("AUGTKConsole")] | ||
public sealed class NlogGTKConsoleTarget : TargetWithContext | ||
{ | ||
[RequiredParameter] | ||
public MainGTKWindow MainWindow { get; set; } | ||
|
||
protected override void Write(LogEventInfo logEvent) | ||
{ | ||
string logMessage = this.RenderLogEvent(this.Layout, logEvent); | ||
|
||
IDictionary<string, object> logProperties = this.GetAllProperties(logEvent); | ||
|
||
writeMessageToGTKWindow(logMessage, logProperties); | ||
} | ||
|
||
private void writeMessageToGTKWindow(string message, IDictionary<string, object> logProperties) | ||
{ | ||
MainWindow.AppendNewLineToConsole(message); | ||
} | ||
|
||
|
||
private Color GetColorForLogLevel(LogLevel level) | ||
{ | ||
// COME ON, NLOG. YOU COULDN'T HAVE PROVIDED A LIST OF THESE OR SOMETHING? | ||
switch (level.Ordinal) | ||
{ | ||
case 0: // | ||
return Color.Black; | ||
case 1: | ||
return Color.Blue; | ||
case 2: | ||
return Color.Gray; | ||
case 3: | ||
return Color.YellowGreen; | ||
case 4: | ||
return Color.Red; | ||
case 5: | ||
return Color.Red; | ||
default: | ||
return Color.White; | ||
} | ||
} | ||
|
||
private Color PlayerColorToColorOBJ(PlayerColor pColor) { | ||
var OutputCode = Color.White; | ||
switch (pColor) { | ||
case PlayerColor.Red: | ||
OutputCode = Color.Red; | ||
break; | ||
case PlayerColor.Blue: | ||
OutputCode = Color.RoyalBlue; | ||
break; | ||
case PlayerColor.Green: | ||
OutputCode = Color.Green; | ||
break; | ||
case PlayerColor.Pink: | ||
OutputCode = Color.Magenta; | ||
break; | ||
case PlayerColor.Orange: | ||
OutputCode = Color.Orange; | ||
break; | ||
case PlayerColor.Yellow: | ||
OutputCode = Color.Yellow; | ||
break; | ||
case PlayerColor.Black: | ||
OutputCode = Color.Gray; | ||
break; | ||
case PlayerColor.White: | ||
OutputCode = Color.White; | ||
break; | ||
case PlayerColor.Purple: | ||
OutputCode = Color.MediumPurple; | ||
break; | ||
case PlayerColor.Brown: | ||
OutputCode = Color.SaddleBrown; | ||
break; | ||
case PlayerColor.Cyan: | ||
OutputCode = Color.Cyan; | ||
break; | ||
case PlayerColor.Lime: | ||
OutputCode = Color.Lime; | ||
break; | ||
case PlayerColor.Maroon: | ||
OutputCode = Color.Maroon; | ||
break; | ||
case PlayerColor.Rose: | ||
OutputCode = Color.MistyRose; | ||
break; | ||
case PlayerColor.Banana: | ||
OutputCode = Color.LightGoldenrodYellow; | ||
break; | ||
case PlayerColor.Gray: | ||
OutputCode = Color.Gray; | ||
break; | ||
case PlayerColor.Tan: | ||
OutputCode = Color.Tan; | ||
break; | ||
case PlayerColor.Sunset: | ||
OutputCode = Color.LightSalmon; | ||
break; | ||
} | ||
|
||
return OutputCode; | ||
} | ||
|
||
} |
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
Oops, something went wrong.