diff --git a/.gitignore b/.gitignore index d16a3d1..90acf30 100644 --- a/.gitignore +++ b/.gitignore @@ -366,7 +366,5 @@ FodyWeavers.xsd *.txt #folders -/DiscordBotWindowsUI/ -/WindowsUI/ -/BUILDS/ +/Plugins/ /DiscordBot.rar diff --git a/CMD_LevelingSystem/CMD_LevelingSystem.csproj b/CMD_LevelingSystem/CMD_LevelingSystem.csproj deleted file mode 100644 index 1fc57d3..0000000 --- a/CMD_LevelingSystem/CMD_LevelingSystem.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net6.0 - enable - enable - bin\ - - - - - - - diff --git a/CMD_LevelingSystem/Level.cs b/CMD_LevelingSystem/Level.cs deleted file mode 100644 index 1fd129a..0000000 --- a/CMD_LevelingSystem/Level.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Discord; -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager; -using PluginManager.Interfaces; -using PluginManager.Others; - -namespace CMD_LevelingSystem; - -internal class Level : DBCommand -{ - public string Command => "level"; - - public List Aliases => new() { "lvl" }; - - public string Description => "Display tour current level"; - - public string Usage => "level"; - - public bool requireAdmin => false; - - public async void ExecuteServer(SocketCommandContext context) - { - if (!File.Exists(Config.GetValue("LevelingSystemPath") + $"/{context.Message.Author.Id}.dat")) - { - await context.Channel.SendMessageAsync("You are now unranked !"); - return; - } - - var user = await Functions.ConvertFromJson(Config.GetValue("LevelingSystemPath") + $"/{context.Message.Author.Id}.dat"); - if (user == null) - { - await context.Channel.SendMessageAsync("You are now unranked !"); - return; - } - - var builder = new EmbedBuilder(); - var r = new Random(); - builder.WithColor(r.Next(256), r.Next(256), r.Next(256)); - builder.AddField("Current Level", user.CurrentLevel, true) - .AddField("Current EXP", user.CurrentEXP, true) - .AddField("Required Exp", user.RequiredEXPToLevelUp, true); - builder.WithTimestamp(DateTimeOffset.Now); - await context.Channel.SendMessageAsync(embed: builder.Build()); - } -} diff --git a/CMD_LevelingSystem/User.cs b/CMD_LevelingSystem/User.cs deleted file mode 100644 index bf26b87..0000000 --- a/CMD_LevelingSystem/User.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Discord.WebSocket; - -namespace CMD_LevelingSystem; - -public class DiscordUser -{ - public string Username { get; set; } - public ushort DiscordTag { get; set; } - public ulong userID { get; set; } -} - -public class User -{ - public DiscordUser user { get; set; } - public int CurrentLevel { get; set; } - public long CurrentEXP { get; set; } - public long RequiredEXPToLevelUp { get; set; } -} diff --git a/CMD_Utils/CMD_Utils.csproj b/CMD_Utils/CMD_Utils.csproj deleted file mode 100644 index 8ac772b..0000000 --- a/CMD_Utils/CMD_Utils.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net6.0 - bin\ - - - - ..\BUILDS\ - prompt - none - false - - - - - - - diff --git a/CMD_Utils/FlipCoin.cs b/CMD_Utils/FlipCoin.cs deleted file mode 100644 index 77c63bf..0000000 --- a/CMD_Utils/FlipCoin.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; - -using System.Collections.Generic; - -namespace CMD_Utils; - -internal class FlipCoin : DBCommand -{ - public string Command => "flip"; - - public List Aliases => null; - - public string Description => "Flip a coin"; - - public string Usage => "flip"; - - public bool requireAdmin => false; - - public async void ExecuteDM(SocketCommandContext context) => ExecuteServer(context); - public async void ExecuteServer(SocketCommandContext context) - { - var random = new System.Random(); - var r = random.Next(1, 3); - if (r == 1) - await context.Message.Channel.SendMessageAsync("Heads"); - else - await context.Message.Channel.SendMessageAsync("Tails"); - } -} diff --git a/CMD_Utils/Poll.cs b/CMD_Utils/Poll.cs deleted file mode 100644 index 941fc1a..0000000 --- a/CMD_Utils/Poll.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections.Generic; - -using Discord; -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; -using PluginManager.Others; - -namespace CMD_Utils; - -public class Poll : DBCommand -{ - public string Command => "poll"; - - public List Aliases => null; - - public string Description => "Create a poll with options"; - - public string Usage => "poll [This-is-question] [This-is-answer-1] [This-is-answer-2] ... "; - - public bool requireAdmin => true; - - public async void ExecuteServer(SocketCommandContext context) - { - var question = context.Message.Content.Split(' ')[1].Replace('-', ' '); - var answers = Functions.MergeStrings(context.Message.Content.Split(' '), 2).Split(' '); - var embedBuilder = new EmbedBuilder(); - embedBuilder.Title = question; - var len = answers.Length; - for (var i = 0; i < len; i++) embedBuilder.AddField($"Answer {i + 1}", answers[i].Replace('-', ' '), true); - var msg = await context.Channel.SendMessageAsync(embed: embedBuilder.Build()); - - var emotes = new List(); - emotes.Add(Emoji.Parse(":one:")); - emotes.Add(Emoji.Parse(":two:")); - emotes.Add(Emoji.Parse(":three:")); - emotes.Add(Emoji.Parse(":four:")); - emotes.Add(Emoji.Parse(":five:")); - emotes.Add(Emoji.Parse(":six:")); - - for (var i = 0; i < len; i++) await msg.AddReactionAsync(emotes[i]); - } -} diff --git a/CMD_Utils/Random.cs b/CMD_Utils/Random.cs deleted file mode 100644 index 9fba292..0000000 --- a/CMD_Utils/Random.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; - -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; - -public class Random : DBCommand -{ - public string Command => "random"; - - public List Aliases => new() { "rnd" }; - - public string Description => "random number between number1 and number2"; - - public string Usage => "random [number1] [number2]"; - public bool requireAdmin => false; - - public async void ExecuteDM(SocketCommandContext context) => ExecuteServer(context); - - public async void ExecuteServer(SocketCommandContext context) - { - try - { - var msg = context.Message.Content; - var a = int.Parse(msg.Split(' ')[1]); - var b = int.Parse(msg.Split(' ')[2]); - - if (a > b) - { - var temp = a; - a = b; - b = temp; - } - - await context.Message.Channel.SendMessageAsync("Your random generated number is " + new System.Random().Next(a, b)); - } - catch - { - await context.Message.Channel.SendMessageAsync("Invalid numbers or no numbers:\nUsage: " + Usage); - } - } -} diff --git a/EVE_LevelingSystem/EVE_LevelingSystem.csproj b/EVE_LevelingSystem/EVE_LevelingSystem.csproj deleted file mode 100644 index cf07d6d..0000000 --- a/EVE_LevelingSystem/EVE_LevelingSystem.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - - - - - diff --git a/EVE_LevelingSystem/Level.cs b/EVE_LevelingSystem/Level.cs deleted file mode 100644 index 68ece34..0000000 --- a/EVE_LevelingSystem/Level.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Discord; -using Discord.WebSocket; - -using EVE_LevelingSystem.LevelingSystemCore; - -using PluginManager; -using PluginManager.Interfaces; -using PluginManager.Others; - -namespace EVE_LevelingSystem -{ - internal class Level : DBEvent - { - public string name => "Leveling System Event Handler"; - public string description => "The Leveling System Event Handler"; - - internal static Settings globalSettings = new(); - - - public async void Start(DiscordSocketClient client) - { - Directory.CreateDirectory("./Data/Resources/LevelingSystem"); - if (!Config.ContainsKey("LevelingSystemPath")) - Config.AddValueToVariables("LevelingSystemPath", "./Data/Resources/LevelingSystem", true); - if (!Config.ContainsKey("LevelingSystemSettingsFile")) - Config.AddValueToVariables("LevelingSystemSettingsFile", "./Data/Resources/LevelingSystemSettings.txt", true); - //PluginManager.Config.AddValueToVariables - if (!File.Exists(Config.GetValue("LevelingSystemSettingsFile"))) - { - globalSettings = new Settings { TimeToWaitBetweenMessages = 5 }; - await Functions.SaveToJsonFile(Config.GetValue("LevelingSystemSettingsFile"), globalSettings); - } - else - globalSettings = await Functions.ConvertFromJson(Config.GetValue("LevelingSystemSettingsFile")); - - // Console.WriteLine(globalSettings.TimeToWaitBetweenMessages); - client.MessageReceived += ClientOnMessageReceived; - } - - private async Task ClientOnMessageReceived(SocketMessage arg) - { - if (arg.Author.IsBot || arg.IsTTS || arg.Content.StartsWith(Config.GetValue("prefix"))) return; - string userID = arg.Author.Id.ToString(); - User user; - if (File.Exists($"{Config.GetValue("LevelingSystemPath")}/{userID}.dat")) - { - user = await Functions.ConvertFromJson(Config.GetValue("LevelingSystemPath")! + $"/{userID}.dat"); - // Console.WriteLine(Config.GetValue("LevelingSystemPath")); - if (user.AddEXP()) await arg.Channel.SendMessageAsync($"{arg.Author.Mention} is now level {user.CurrentLevel}"); - await Functions.SaveToJsonFile(Config.GetValue("LevelingSystemPath") + $"/{userID}.dat", user); - return; - } - - user = new User { CurrentEXP = 0, CurrentLevel = 1, RequiredEXPToLevelUp = LevelCalculator.GetNextLevelRequiredEXP(1), user = new DiscordUser { DiscordTag = arg.Author.DiscriminatorValue, userID = arg.Author.Id, Username = arg.Author.Username } }; - if (user.AddEXP()) await arg.Channel.SendMessageAsync($"{arg.Author.Mention} is now level {user.CurrentLevel}"); - await Functions.SaveToJsonFile($"{Config.GetValue("LevelingSystemPath")}/{userID}.dat", user); - } - } -} diff --git a/EVE_LevelingSystem/LevelingSystemCore/LevelCalculator.cs b/EVE_LevelingSystem/LevelingSystemCore/LevelCalculator.cs deleted file mode 100644 index 0359c6b..0000000 --- a/EVE_LevelingSystem/LevelingSystemCore/LevelCalculator.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using PluginManager; - -namespace EVE_LevelingSystem.LevelingSystemCore -{ - internal static class LevelCalculator - { - internal static List OnWaitingList = new(); - - internal static Int64 GetNextLevelRequiredEXP(int currentLevel) - { - return currentLevel * 8 + 24; - } - - internal static void LevelUp(this User user) - { - user.CurrentEXP = 0; - user.RequiredEXPToLevelUp = GetNextLevelRequiredEXP(user.CurrentLevel); - user.CurrentLevel++; - } - - internal static bool AddEXP(this User user) - { - if (OnWaitingList.Contains(user.user.userID.ToString())) return false; - Random r = new Random(); - int exp = r.Next(Level.globalSettings.MinEXP, Level.globalSettings.MaxEXP + 1); - Int64 userXP = user.CurrentEXP; - Int64 reqEXP = user.RequiredEXPToLevelUp; - if (userXP + exp >= reqEXP) - { - user.LevelUp(); - user.CurrentEXP = exp - (reqEXP - userXP); - //Console.WriteLine("Level up"); - return true; - } - - user.CurrentEXP += exp; - - OnWaitingList.Add(user.user.userID.ToString()); - - - new Thread(() => - { - int minutesToWait = Level.globalSettings.TimeToWaitBetweenMessages; - Thread.Sleep(60000 * minutesToWait); - OnWaitingList.Remove(user.user.userID.ToString()); - } - ).Start(); - - return false; - } - } -} diff --git a/EVE_LevelingSystem/LevelingSystemCore/User.cs b/EVE_LevelingSystem/LevelingSystemCore/User.cs deleted file mode 100644 index b857392..0000000 --- a/EVE_LevelingSystem/LevelingSystemCore/User.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Discord; -using Discord.WebSocket; - -namespace EVE_LevelingSystem.LevelingSystemCore -{ - public class DiscordUser - { - public string Username { get; set; } - public ushort DiscordTag { get; set; } - public ulong userID { get; set; } - } - - public class User - { - public DiscordUser user { get; set; } - public int CurrentLevel { get; set; } - public long CurrentEXP { get; set; } - public long RequiredEXPToLevelUp { get; set; } - } -} \ No newline at end of file diff --git a/EVE_LevelingSystem/Settings.cs b/EVE_LevelingSystem/Settings.cs deleted file mode 100644 index 5225e9d..0000000 --- a/EVE_LevelingSystem/Settings.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace EVE_LevelingSystem -{ - public class Settings - { - public int TimeToWaitBetweenMessages { get; set; } - public int MinEXP { get; set; } - public int MaxEXP { get; set; } - } -} diff --git a/FreeGamesModule/Commands.cs b/FreeGamesModule/Commands.cs deleted file mode 100644 index 0571a50..0000000 --- a/FreeGamesModule/Commands.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Discord.Commands; - -using PluginManager.Interfaces; - -namespace FreeGamesModule -{ - public class Free : DBCommand - { - public string Command => "free"; - - public List? Aliases => null; - - public string Description => "Check out any free game"; - - public string Usage => "free [platform]"; - - public bool requireAdmin => false; - - public void ExecuteServer(SocketCommandContext context) - { - - } - } -} \ No newline at end of file diff --git a/FreeGamesModule/FreeGamesModule.csproj b/FreeGamesModule/FreeGamesModule.csproj deleted file mode 100644 index b468d70..0000000 --- a/FreeGamesModule/FreeGamesModule.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - diff --git a/MusicCommands/AudioFile.cs b/MusicCommands/AudioFile.cs deleted file mode 100644 index bd7b576..0000000 --- a/MusicCommands/AudioFile.cs +++ /dev/null @@ -1,35 +0,0 @@ -using AngleSharp.Dom; - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MusicCommands -{ - internal class AudioFile - { - internal string Name { get; set; } - internal string Url { get; set; } - - internal AudioFile(string name, string url) - { - Name = name; - Url = url; - } - - internal async Task DownloadAudioFile() - { - Process proc = new Process(); - proc.StartInfo.FileName = "MusicDownloader"; - proc.StartInfo.Arguments = $"{Url},{Name}"; - proc.StartInfo.UseShellExecute = false; - proc.StartInfo.RedirectStandardOutput = true; - - proc.Start(); - await proc.WaitForExitAsync(); - } - } -} diff --git a/MusicCommands/Data.cs b/MusicCommands/Data.cs deleted file mode 100644 index ac61ac7..0000000 --- a/MusicCommands/Data.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Discord; -using Discord.Audio; - -namespace MusicCommands; - -internal static class Data -{ - internal static IAudioClient audioClient = null; - internal static IVoiceChannel voiceChannel = null; - - internal static MusicPlayer MusicPlayer = null; - internal static MusicPlaylist Playlist = new(); -} diff --git a/MusicCommands/Leave.cs b/MusicCommands/Leave.cs deleted file mode 100644 index 6cbcf54..0000000 --- a/MusicCommands/Leave.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; - -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; - -namespace MusicCommands; - -internal class Leave : DBCommand -{ - public string Command => "leave"; - - public List Aliases => null; - - public string Description => "Leave the voice channel"; - - public string Usage => "leave"; - - public bool requireAdmin => false; - - public async void ExecuteServer(SocketCommandContext context) - { - if (Data.audioClient is not null && Data.voiceChannel is not null) - { - await Data.audioClient.StopAsync(); - await Data.voiceChannel.DisconnectAsync(); - } - - if (Data.Playlist is not null) - { - Data.Playlist.ClearQueue(); - Data.Playlist = new(); - } - - if (Data.MusicPlayer is not null) - { - Data.MusicPlayer.Stop(); - Data.MusicPlayer = null; - } - } -} diff --git a/MusicCommands/MusicCommands.csproj b/MusicCommands/MusicCommands.csproj deleted file mode 100644 index 037f43c..0000000 --- a/MusicCommands/MusicCommands.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net6.0 - warnings - bin\ - Music Commands - - - - ../BUILDS/ - none - none - false - - - - - - - - - - - diff --git a/MusicCommands/MusicPlayer.cs b/MusicCommands/MusicPlayer.cs deleted file mode 100644 index e1c974a..0000000 --- a/MusicCommands/MusicPlayer.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.IO; -using System.Threading.Tasks; - -namespace MusicCommands; - -internal class MusicPlayer -{ - private Stream outputStream { get; } - internal AudioFile NowPlaying = null; - - internal bool isPlaying, isPaused; - - public MusicPlayer(Stream outputChannel) - { - outputStream = outputChannel; - } - - public async Task Play(Stream source, int byteSize, AudioFile songPlaying) - { - isPlaying = true; - NowPlaying = songPlaying; - while (isPlaying) - { - if (isPaused) - continue; - - var bits = new byte[byteSize]; - var read = await source.ReadAsync(bits, 0, byteSize); - if (read == 0) - break; - try - { - await outputStream.WriteAsync(bits, 0, read); - } - catch - { - break; - } - } - - - await source.FlushAsync(); - await source.DisposeAsync(); - source.Close(); - await outputStream.FlushAsync(); - isPlaying = false; - } - - public void Stop() - { - isPlaying = false; - } -} diff --git a/MusicCommands/MusicPlaylist.cs b/MusicCommands/MusicPlaylist.cs deleted file mode 100644 index f514fb1..0000000 --- a/MusicCommands/MusicPlaylist.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MusicCommands -{ - internal class MusicPlaylist - { - internal MusicPlaylist() - { - Console.WriteLine("Initialized playlist."); - } - - public Queue QueueList = new(); - - public void Enqueue(AudioFile query) => QueueList.Enqueue(query); - public void ClearQueue() => QueueList.Clear(); - - public int Count => QueueList.Count; - public AudioFile GetNextSong => QueueList.Dequeue(); - public AudioFile WhatIsNext => QueueList.Peek(); - } -} diff --git a/MusicCommands/Pause.cs b/MusicCommands/Pause.cs deleted file mode 100644 index d8b95ec..0000000 --- a/MusicCommands/Pause.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; - -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; - -namespace MusicCommands; - -internal class Pause : DBCommand -{ - public string Command => "pause"; - - public List Aliases => null; - - public string Description => "Pause/Unpause the music that is currently running"; - - public string Usage => "pause"; - - public bool requireAdmin => false; - - public void ExecuteServer(SocketCommandContext context) - { - Data.MusicPlayer.isPaused = !Data.MusicPlayer.isPaused; - } -} diff --git a/MusicCommands/Play.cs b/MusicCommands/Play.cs deleted file mode 100644 index 21a6984..0000000 --- a/MusicCommands/Play.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -using Discord; -using Discord.Audio; -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; -using PluginManager.Others; - -namespace MusicCommands; - -internal class Play : DBCommand -{ - public string Command => "play"; - - public List Aliases => new() { "p" }; - - public string Description => "Play music from a file"; - - public string Usage => "play [name/url]"; - - public bool requireAdmin => false; - - public async void ExecuteServer(SocketCommandContext context) - { - Directory.CreateDirectory("Music"); - var path = "./Music/"; - string[] splitted = context.Message.Content.Split(' '); - if (splitted.Length < 2) - return; - do - { - if (splitted.Length == 2 && splitted[1].Contains("youtube.com") || splitted[1].Contains("youtu.be")) - { - var url = splitted[1]; - path += $"{Functions.CreateMD5(url)}"; - if (File.Exists(path)) - { - Data.Playlist.Enqueue(new AudioFile(path, null)); - } - else - { - var file = new AudioFile(path, url); - await file.DownloadAudioFile(); - Data.Playlist.Enqueue(file); - } - } - else - { - var searchString = splitted.MergeStrings(1); - path += $"{Functions.CreateMD5(searchString)}"; - if (File.Exists(path)) - { - Data.Playlist.Enqueue(new AudioFile(path, null)); - } - else - { - await context.Channel.SendMessageAsync("Searching for " + searchString); - var file = new AudioFile(path, searchString); - await file.DownloadAudioFile(); - Data.Playlist.Enqueue(file); - if (Data.MusicPlayer is null) - await context.Channel.SendMessageAsync("Playing: " + searchString); - } - } - - if (Data.MusicPlayer is not null) - { - await context.Channel.SendMessageAsync("Queued your request: " + splitted.MergeStrings(1)); - return; - } - } - while (false); // run only one time ! - - - Data.voiceChannel = (context.User as IGuildUser)?.VoiceChannel; - - if (Data.voiceChannel == null) - { - await context.Channel.SendMessageAsync("User must be in a voice channel, or a voice channel must be passed as an argument."); - return; - } - - if (Data.audioClient is null) - { - Data.audioClient = await Data.voiceChannel.ConnectAsync(true); - Data.MusicPlayer = null; - } - - - using (var discordChanneAudioOutStream = Data.audioClient.CreatePCMStream(AudioApplication.Mixed)) - { - Data.MusicPlayer ??= new MusicPlayer(discordChanneAudioOutStream); - while (Data.Playlist.Count > 0) - { - var nowPlaying = Data.Playlist.GetNextSong; - using (var ffmpeg = CreateStream(nowPlaying.Name)) - using (var ffmpegOutputBaseStream = ffmpeg.StandardOutput.BaseStream) - { - await Data.MusicPlayer.Play(ffmpegOutputBaseStream, 1024, nowPlaying); - Console.WriteLine("Finished playing from " + nowPlaying.Url); - } - } - - Data.MusicPlayer = null; - } - } - - private static Process CreateStream(string path) - { - return Process.Start(new ProcessStartInfo { FileName = "ffmpeg", Arguments = $"-hide_banner -loglevel panic -i \"{path}\" -ac 2 -f s16le -ar 48000 pipe:1", UseShellExecute = false, RedirectStandardOutput = true }); - } -} diff --git a/MusicCommands/Skip.cs b/MusicCommands/Skip.cs deleted file mode 100644 index 7082342..0000000 --- a/MusicCommands/Skip.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; - -namespace MusicCommands -{ - public class Skip : DBCommand - { - public string Command => "skip"; - - public List Aliases => null; - - public string Description => "skip the music that is currently running"; - - public string Usage => "skip"; - - public bool requireAdmin => false; - - public async void ExecuteServer(SocketCommandContext context) - { - var loadedSong = Data.MusicPlayer.NowPlaying; - - if (loadedSong is null || Data.MusicPlayer.isPlaying == false) - { - await context.Message.Channel.SendMessageAsync("There is no music playing"); - return; - } - - Data.MusicPlayer.isPlaying = false; - await context.Message.Channel.SendMessageAsync($"You have skipped {loadedSong.Name}"); - } - } -} diff --git a/MusicCommands/queue.cs b/MusicCommands/queue.cs deleted file mode 100644 index d60eba3..0000000 --- a/MusicCommands/queue.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using Discord.Commands; -using Discord.WebSocket; - -using PluginManager.Interfaces; - -namespace MusicCommands -{ - public class queue : DBCommand - { - public string Command => "queue"; - public List Aliases => new() { "q" }; - - public string Description => "check queue"; - - public string Usage => "queue"; - - public bool requireAdmin => false; - - public async void ExecuteServer(SocketCommandContext context) - { - await context.Channel.SendMessageAsync($"You have {Data.Playlist.Count} items in queue"); - } - } -} diff --git a/Roles/AddRole.cs b/Roles/AddRole.cs deleted file mode 100644 index cf4090e..0000000 --- a/Roles/AddRole.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.IO.Compression; -using System.Runtime.CompilerServices; - -using Discord; -using Discord.Commands; -using Discord.Rest; -using Discord.WebSocket; - -using Microsoft.Win32.SafeHandles; - -using PluginManager.Interfaces; -using PluginManager.Others; - -using Roles.Internals; - -namespace Roles -{ - public class AddRole : DBCommand - { - public string Command => "addrole"; - - public List Aliases => new() { "ar", "addr", "roleadd" }; - - public string Description => "Role options"; - - public string Usage => "addrole [user1] [user2] ... [role1] [role2] ..."; - - public bool requireAdmin => true; - - public async void ExecuteServer(SocketCommandContext context) - { - if (context.Message.MentionedUsers.Count == 0 || context.Message.MentionedRoles.Count == 0) - { - await context.Channel.SendMessageAsync($"Invalid invocation\nUsage:{Usage}"); - return; - } - - try - { - var users = context.Message.MentionedUsers; - var roles = context.Message.MentionedRoles; - - foreach (var user in users) - { - foreach (var role in roles) - { - try - { - await ((SocketGuildUser)context.Guild.GetUser(user.Id)).AddRoleAsync(role); - await context.Channel.SendMessageAsync($"User {user.Mention} got role : {role.Name}"); - } - catch (Exception ex) { ex.WriteErrFile(); } - } - } - } - catch (Exception ex) - { - await context.Channel.SendMessageAsync(ex.Message); - } - } - } -} diff --git a/Roles/Internals/RoleManagement.cs b/Roles/Internals/RoleManagement.cs deleted file mode 100644 index edcf616..0000000 --- a/Roles/Internals/RoleManagement.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Discord; -using Discord.WebSocket; -using PluginManager.Others; - -namespace Roles.Internals -{ - internal static class RoleManagement - { - internal static async void AddRole(this SocketGuildUser user, string roleName) - { - string role = roleName; - IRole? r = user.Guild.Roles.FirstOrDefault(rl => rl.Name == role || rl.Mention == role); - if (r is null) - throw new Exception("The role does not exist"); - - try - { - await user.AddRoleAsync(r); - } - catch (Exception ex) - { - if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase)) - throw new Exception("Insufficient permissions"); - } - } - - internal static async void AddRole(this SocketGuildUser user, IRole role) - { - try - { - await user.AddRoleAsync(role); - } - catch (Exception ex) - { - if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase)) - throw new Exception("Insufficient permissions"); - } - } - - internal static async void AddRoles(this SocketGuildUser user, string[] roleNames) - { - foreach (string rolename in roleNames) - { - string roleName = rolename; - IRole? r = user.Guild.Roles.FirstOrDefault(rl => rl.Name == roleName || rl.Mention == roleName); - if (r is null) - throw new Exception("The role does not exist"); - - try - { - await user.AddRoleAsync(r); - } - catch (Exception ex) - { - if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase)) - throw new Exception("Insufficient permissions"); - } - } - } - - internal static async void AddRoles(this SocketGuildUser user, IEnumerable roles) - { - try - { - await user.AddRolesAsync(roles); - } - catch (Exception ex) - { - if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase)) - throw new Exception("Insufficient permissions"); - } - } - } -} diff --git a/Roles/Roles.csproj b/Roles/Roles.csproj deleted file mode 100644 index b468d70..0000000 --- a/Roles/Roles.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - diff --git a/SethDiscordBot.sln b/SethDiscordBot.sln index 4ed213c..e45ebde 100644 --- a/SethDiscordBot.sln +++ b/SethDiscordBot.sln @@ -13,31 +13,31 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Events", "Events", "{A290C0 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Commands", "Commands", "{449FA364-0B72-43FF-B3A3-806E2916200E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_Utils", "CMD_Utils\CMD_Utils.csproj", "{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_Utils", "Plugins\CMD_Utils\CMD_Utils.csproj", "{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MusicCommands", "MusicCommands\MusicCommands.csproj", "{B1B4976E-5112-4217-B57B-3A03C5207B6E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MusicCommands", "Plugins\MusicCommands\MusicCommands.csproj", "{B1B4976E-5112-4217-B57B-3A03C5207B6E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EVE_LevelingSystem", "EVE_LevelingSystem\EVE_LevelingSystem.csproj", "{EEC445DC-0C4B-43EA-8694-606BA0390B77}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EVE_LevelingSystem", "Plugins\EVE_LevelingSystem\EVE_LevelingSystem.csproj", "{EEC445DC-0C4B-43EA-8694-606BA0390B77}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_LevelingSystem", "CMD_LevelingSystem\CMD_LevelingSystem.csproj", "{1A4E49FF-9A0A-4C54-AF35-CFFBA64353D9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_LevelingSystem", "Plugins\CMD_LevelingSystem\CMD_LevelingSystem.csproj", "{1A4E49FF-9A0A-4C54-AF35-CFFBA64353D9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "Roles\Roles.csproj", "{954F2AA9-6624-4554-946D-0F17B84487C3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "Plugins\Roles\Roles.csproj", "{954F2AA9-6624-4554-946D-0F17B84487C3}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Others", "Others", "{727BBA0B-9114-4BC8-B9A8-3F461449A564}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Updater", "Updater\Updater.csproj", "{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Updater", "Plugins\Updater\Updater.csproj", "{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeGamesModule", "FreeGamesModule\FreeGamesModule.csproj", "{8959C766-414D-4EF8-BC85-9928B30AAF0A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeGamesModule", "Plugins\FreeGamesModule\FreeGamesModule.csproj", "{8959C766-414D-4EF8-BC85-9928B30AAF0A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordBotWindowsUI", "DiscordBotWindowsUI\DiscordBotWindowsUI.csproj", "{EFE12083-F9FE-4807-8E39-809E0391BAF0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordBotWindowsUI", "Plugins\DiscordBotWindowsUI\DiscordBotWindowsUI.csproj", "{EFE12083-F9FE-4807-8E39-809E0391BAF0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsUI", "WindowsUI\WindowsUI.csproj", "{ECF79CD3-789E-476D-8512-CE0FAF71ADF5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsUI", "Plugins\WindowsUI\WindowsUI.csproj", "{ECF79CD3-789E-476D-8512-CE0FAF71ADF5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlashCommands", "SlashCommands\SlashCommands.csproj", "{56D7545A-6DCF-4996-A1A5-40180CE9DE10}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlashCommands", "Plugins\SlashCommands\SlashCommands.csproj", "{56D7545A-6DCF-4996-A1A5-40180CE9DE10}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Slash", "Slash", "{0B1FD8FA-35D3-4DC1-9D98-6178247B29CA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlashRandom", "SlashRandom\SlashRandom.csproj", "{23A4778E-A65C-44B7-A82C-AE2A35103E8D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlashRandom", "Plugins\SlashRandom\SlashRandom.csproj", "{23A4778E-A65C-44B7-A82C-AE2A35103E8D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -112,6 +112,7 @@ Global {727BBA0B-9114-4BC8-B9A8-3F461449A564} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E} {24616F7E-E2E9-45A3-8A44-AB51FCD2D525} = {727BBA0B-9114-4BC8-B9A8-3F461449A564} {8959C766-414D-4EF8-BC85-9928B30AAF0A} = {449FA364-0B72-43FF-B3A3-806E2916200E} + {EFE12083-F9FE-4807-8E39-809E0391BAF0} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E} {ECF79CD3-789E-476D-8512-CE0FAF71ADF5} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012} {56D7545A-6DCF-4996-A1A5-40180CE9DE10} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012} {0B1FD8FA-35D3-4DC1-9D98-6178247B29CA} = {449FA364-0B72-43FF-B3A3-806E2916200E} diff --git a/SlashCommands/Initializer.cs b/SlashCommands/Initializer.cs deleted file mode 100644 index e1a7e55..0000000 --- a/SlashCommands/Initializer.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Discord.WebSocket; - -using PluginManager; -using PluginManager.Interfaces; - -using SlashCommands.Items; - -namespace SlashCommands -{ - public class Initializer : DBEvent - { - public string name => "Slash command engine"; - - public string description => "The slash commands initializer and engine"; - - public async void Start(DiscordSocketClient client) - { - if(!Config.ContainsKey("ServerID") || Config.GetValue("ServerID") == "null" || Config.GetValue("ServerID").Length != 18) - { - Console.WriteLine("Invalid Server ID. Change config.json from file and restart bot"); - await Task.Delay(2000); - return; - } - - SlashCommandLoader loader = new SlashCommandLoader("./Data/Plugins/SlashCommands/", "dll", client); - loader.FileLoaded += (args) => Console.WriteLine(args[0] + " => " + args[1]); - loader.PluginLoaded += (args) => Console.WriteLine(args[0] + " => " + args[1]); - Globals.commands = await loader.Load(); - - client.SlashCommandExecuted += async (args) => - { - foreach (var cmd in Globals.commands) - { - if (cmd.Command == args.Data.Name) - { - await cmd.ExecuteServer(args); - return; - } - } - }; - } - } -} \ No newline at end of file diff --git a/SlashCommands/Items/DBSlashCommand.cs b/SlashCommands/Items/DBSlashCommand.cs deleted file mode 100644 index a41137e..0000000 --- a/SlashCommands/Items/DBSlashCommand.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Discord.WebSocket; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Serialization; - -namespace SlashCommands.Items -{ - public interface DBSlashCommand - { - string Command { get; } - string Description { get; } - string Usage { get; } - bool requireAdmin { get; } - bool PrivateResponse { get; } - Task ExecuteServer(SocketSlashCommand command); - Task InitializeCommand(DiscordSocketClient client); - } -} diff --git a/SlashCommands/Items/Globals.cs b/SlashCommands/Items/Globals.cs deleted file mode 100644 index 85bd3f1..0000000 --- a/SlashCommands/Items/Globals.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlashCommands.Items -{ - internal class Globals - { - internal static List commands = null; - } -} diff --git a/SlashCommands/Items/SlashCommandLoader.cs b/SlashCommands/Items/SlashCommandLoader.cs deleted file mode 100644 index 9367c26..0000000 --- a/SlashCommands/Items/SlashCommandLoader.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Discord.WebSocket; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace SlashCommands.Items -{ - public class SlashCommandLoader - { - internal DiscordSocketClient client; - - internal delegate void FileLoadedEventHandler(string[] args); - - internal delegate void PluginLoadedEventHandler(string[] args); - - internal event FileLoadedEventHandler? FileLoaded; - - internal event PluginLoadedEventHandler? PluginLoaded; - - private string location, extension; - internal SlashCommandLoader(string location, string extension, DiscordSocketClient client) - { - this.location = location; - this.extension = extension; - this.client = client; - } - - internal async Task> Load() - { - List slashCommands = new(); - var files = Directory.GetFiles(location, $"*.{extension}", SearchOption.AllDirectories); - foreach(var file in files) - { - Assembly.LoadFrom(file); - if(FileLoaded != null) - { - var args = new string[] { file, "Loaded" }; - FileLoaded.Invoke(args); - } - } - - try - { - var interfaceType = typeof(DBSlashCommand); - var types = AppDomain.CurrentDomain.GetAssemblies() - .SelectMany(a => a.GetTypes()) - .Where(p => interfaceType.IsAssignableFrom(p) && p.IsClass) - .ToArray(); - - foreach(var type in types) - { - try - { - var plugin = (DBSlashCommand)Activator.CreateInstance(type); - slashCommands.Add(plugin); - if (PluginLoaded != null) - { - var args = new string[] { plugin.Command, "Loaded successfully" }; - PluginLoaded.Invoke(args); - - await plugin.InitializeCommand(client); - } - } - catch { - var args = new string[] { type.Name, "Failed to load" }; - PluginLoaded!.Invoke(args); - } - - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - - return slashCommands; - } - - - } -} diff --git a/SlashCommands/SlashCommands.csproj b/SlashCommands/SlashCommands.csproj deleted file mode 100644 index b468d70..0000000 --- a/SlashCommands/SlashCommands.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - diff --git a/SlashRandom/SlashRandom.cs b/SlashRandom/SlashRandom.cs deleted file mode 100644 index 0db6b16..0000000 --- a/SlashRandom/SlashRandom.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Discord; -using Discord.WebSocket; - -using PluginManager; -using PluginManager.Interfaces; - -using SlashCommands.Items; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CMD_Utils -{ - public class SlashRandom : DBSlashCommand - { - public string Command => "random"; - - public string Description => "Random number"; - - public string Usage => "random [min] [max]"; - - public bool requireAdmin => false; - - public bool PrivateResponse => true; - - public async Task InitializeCommand(DiscordSocketClient client) - { - var guildCommand = new SlashCommandBuilder(); - guildCommand.WithName(Command); - guildCommand.WithDescription(Description); - guildCommand.AddOption(new SlashCommandOptionBuilder() - .WithName("min") - .WithDescription("Minimum number") - .WithRequired(true) - .WithType(ApplicationCommandOptionType.Integer)); - guildCommand.AddOption(new SlashCommandOptionBuilder() - .WithName("max") - .WithDescription("Maximum number") - .WithRequired(true) - .WithType(ApplicationCommandOptionType.Integer)); - await client.GetGuild(ulong.Parse(Config.GetValue("ServerID"))).CreateApplicationCommandAsync(guildCommand.Build()); - } - - public async Task ExecuteServer(SocketSlashCommand command) - { - var commandArguments = command.Data.Options.ToArray(); - - if (commandArguments.Count() == 0) - { - await command.RespondAsync("Please provide a min and max value", ephemeral: true); - return; - } - - var min = (int)commandArguments[0].Value; - var max = (int)commandArguments[1].Value; - - - await command.RespondAsync("User generated number: " + new System.Random().Next(min, max + 1), ephemeral: PrivateResponse); - - } - } -} diff --git a/SlashRandom/SlashRandom.csproj b/SlashRandom/SlashRandom.csproj deleted file mode 100644 index 2724402..0000000 --- a/SlashRandom/SlashRandom.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - diff --git a/Updater/.gitignore b/Updater/.gitignore deleted file mode 100644 index 8afdcb6..0000000 --- a/Updater/.gitignore +++ /dev/null @@ -1,454 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# Tye -.tye/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -## -## Visual studio for Mac -## - - -# globs -Makefile.in -*.userprefs -*.usertasks -config.make -config.status -aclocal.m4 -install-sh -autom4te.cache/ -*.tar.gz -tarballs/ -test-results/ - -# Mac bundle stuff -*.dmg -*.app - -# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# JetBrains Rider -.idea/ -*.sln.iml - -## -## Visual Studio Code -## -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json diff --git a/Updater/App.axaml b/Updater/App.axaml deleted file mode 100644 index 828d949..0000000 --- a/Updater/App.axaml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Updater/App.axaml.cs b/Updater/App.axaml.cs deleted file mode 100644 index a9165e5..0000000 --- a/Updater/App.axaml.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; - -namespace Updater -{ - public partial class App : Application - { - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } - - public override void OnFrameworkInitializationCompleted() - { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - desktop.MainWindow = new MainWindow() { Width = 250, Height = 50 }; - } - - base.OnFrameworkInitializationCompleted(); - } - } -} diff --git a/Updater/MainWindow.axaml b/Updater/MainWindow.axaml deleted file mode 100644 index 439b8e5..0000000 --- a/Updater/MainWindow.axaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/Updater/MainWindow.axaml.cs b/Updater/MainWindow.axaml.cs deleted file mode 100644 index 2aa21e1..0000000 --- a/Updater/MainWindow.axaml.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Avalonia.Controls; - -using System; -using System.Diagnostics; -using System.IO; -using System.IO.Compression; -using System.Net; - -using System.Threading.Tasks; - -namespace Updater -{ - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - - Activated += (sender, e) => FormActive(); - } - - public async void FormActive() - { - if (Program.Command != "/update") - return; - await Task.Delay(3000); - WebClient c = new WebClient(); - Directory.CreateDirectory("./Updater/Downloads"); - await c.DownloadFileTaskAsync(Program.Link, "./Updater/Downloads/Update.zip"); - await Task.Run(() => ZipFile.ExtractToDirectory("./Updater/Downloads/Update.zip", Program.Location, true)); - Process.Start(Program.AppToOpen); - File.Delete("./Updater/Downloads/Update.zip"); - Environment.Exit(0); - } - } -} diff --git a/Updater/Program.cs b/Updater/Program.cs deleted file mode 100644 index e42859e..0000000 --- a/Updater/Program.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Controls.ApplicationLifetimes; - -using System; - -namespace Updater -{ - internal class Program - { - - public static string Command, Link, AppToOpen, Location; - - // Initialization code. Don't use any Avalonia, third-party APIs or any - // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. - [STAThread] - public static void Main(string[] args) - { - Command = args[0]; - Link = args[1]; - AppToOpen = args[2]; - Location = string.Join(' ', args, 3, args.Length - 3); - BuildAvaloniaApp() - .StartWithClassicDesktopLifetime(args); - } - - // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UsePlatformDetect() - .LogToTrace(); - } -} diff --git a/Updater/Updater.csproj b/Updater/Updater.csproj deleted file mode 100644 index 2524f5b..0000000 --- a/Updater/Updater.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - WinExe - net6.0 - enable - - copyused - true - - - - - - - - - - - - - - - - -