-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
91 lines (84 loc) · 3.83 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/////////////////////////////////////////////////////////////////////////
// ironide: A cross-platform package manager. //
// Created by scrundaegames: @scrundae on YouTube and Twitter (sadly) //
// My website is: https://scrundae.github.io //
// Thanks! //
/////////////////////////////////////////////////////////////////////////
using System;
using System.IO;
using System.Net;
using System.Runtime.CompilerServices;
using ironide.Scripting;
namespace ironide {
public class Program {
public static void Main(string[] args) {
Console.WriteLine("\n--- ironide ACTIVE ---\n");
//Console.WriteLine(args[0]);
if (args.Length == 0) {
Console.WriteLine(@"IRONIDE PATCHER
Created by scrundaegames: @scrundae on YouTube and Twitter (sadly)
ironide allows you to download and install different applications.
Usage: ironide [<mode>] [<options>]
These are the available modes:
MODE DESC
--install Allows you to run ironide install scripts
--curver Shows the current ironide and OS version.
--cat Shows the install script that will be run.
You have not provided any commands. The session will now end. Good bye!
--- ironide INACTIVE ---
");
}
else {
if (args[0] == "--install") {
try {
WebClient client = new WebClient();
client.DownloadFile(new Uri(args[1]), "AU-TEMP");
string[] data = File.ReadAllLines("AU-TEMP");
Interpreter.Interpret(data);
}
catch (WebException ex) {
Console.WriteLine($"Error getting: {ex.Message}");
}
catch (IOException ex) {
Console.WriteLine($"Error reading or writing temporary file: {ex.Message}");
}
catch (Exception ex) {
Console.WriteLine($"An unexpected error occurred: {ex.Message}");
}
}
else if (args[0] == "--curver") {
Console.WriteLine("-= ironide by Harry \"scrundae\" Collins =-");
Console.WriteLine("ironide version: 1.0");
Console.WriteLine($"OS version: {System.Environment.OSVersion}");
Console.WriteLine("\n--- ironide INACTIVE ---\n");
}
else if (args[0] == "--cat") {
try {
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"[{args[1]}]");
Console.ForegroundColor = ConsoleColor.Gray;
WebClient client = new WebClient();
client.DownloadFile(new Uri(args[1]), "AU-TEMP");
string[] data = File.ReadAllLines("AU-TEMP");
foreach (string line in data) {
Console.WriteLine(line);
}
Console.WriteLine("\n--- ironide INACTIVE ---\n");
}
catch (WebException ex) {
Console.WriteLine($"Error getting: {ex.Message}");
}
catch (IOException ex) {
Console.WriteLine($"Error reading or writing temporary file: {ex.Message}");
}
catch (Exception ex) {
Console.WriteLine($"An unexpected error occurred: {ex.Message}");
}
}
else {
Console.WriteLine("Invalid arguments.");
}
}
}
}
}