mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Initial commit
This commit is contained in:
40
KfChatDotNetCli/Program.cs
Normal file
40
KfChatDotNetCli/Program.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using CommandLine;
|
||||
using NLog;
|
||||
|
||||
namespace KfChatDotNetCli
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public class Options
|
||||
{
|
||||
[Option('t', "token", Required = false, Default = null, HelpText = "XF session token from the 'xf_session' cookie")]
|
||||
public string XfSessionToken { get; set; } = null!;
|
||||
|
||||
[Option("debug", Required = false, Default = false, HelpText = "Enable debug logging")]
|
||||
public bool Debug { get; set; }
|
||||
[Option('r', "room", Required = true, HelpText = "Room ID to join on start")]
|
||||
public int RoomId { get; set; }
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
Parser.Default.ParseArguments<Options>(args).WithParsed(CliOptions);
|
||||
}
|
||||
|
||||
static void CliOptions(Options options)
|
||||
{
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13;
|
||||
if (options.Debug)
|
||||
{
|
||||
foreach (var rule in LogManager.Configuration.LoggingRules)
|
||||
{
|
||||
rule.EnableLoggingForLevel(LogLevel.Debug);
|
||||
}
|
||||
}
|
||||
|
||||
new ChatCliMain(options.XfSessionToken, options.RoomId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user