-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
117 lines (94 loc) · 4.5 KB
/
Program.cs
File metadata and controls
117 lines (94 loc) · 4.5 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
using System.Diagnostics;
using Newtonsoft.Json;
using Spectre.Console;
namespace ChannelLauncher;
public static class Program
{
public static async Task Main(string[] args)
{
Console.Title = "Momentum Launcher";
AnsiConsole.MarkupLine("Welcome, " + Environment.UserName + ", to the [underline blue]Momentum launcher.[/]");
AnsiConsole.MarkupLine("You can select an option using the arrow keys [underline blue]UP[/] and [underline blue]DOWN.[/]");
string appdata = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MomentumLauncher";
if (!Directory.Exists(appdata))
{
AnsiConsole.MarkupLine("[yellow]Appdata folder is missing, creating one for you...[/]");
Directory.CreateDirectory(appdata);
}
var option = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title("[blue]What do you want to do[/]?")
.PageSize(3)
.AddChoices(new[]
{
"Start game", "Change fortnite path", "Exit"
}));
switch (option)
{
case "Start game":
if (!File.Exists(appdata + "\\path.txt"))
{
Console.Clear();
AnsiConsole.MarkupLine("[red]Fortnite path is missing, please set it first![/]");
Main(args);
}
if (!File.Exists(appdata + "\\email.txt") || !File.Exists(appdata + "\\password.txt"))
{
Console.Clear();
AnsiConsole.MarkupLine("[red]Please Enter Your Email and Password! (Account Made From Discord Bot.)[/]");
Console.Write("Email: ");
string email = Console.ReadLine();
File.WriteAllText(appdata + "\\email.txt", email);
Console.Write("Password: ");
string password = Console.ReadLine();
File.WriteAllText(appdata + "\\password.txt", password);
AnsiConsole.MarkupLine("[green]Email and Password Saved![/]");
}
if (!File.Exists("redirect.json"))
{
string fileContent = "{ \"name\": \"Buzz.dll\", \"download\": \"https://cdn.nexusfn.net/file/2023/06/TV.dll\" }";
File.WriteAllText("redirect.json", fileContent);
}
string fileData = File.ReadAllText("redirect.json");
var jsonData = JsonConvert.DeserializeObject<Dictionary<string, object>>(fileData);
if (!jsonData.TryGetValue("name", out var dllNameObject) || !(dllNameObject is string dllName))
{
throw new Exception("Invalid JSON structure: 'name' key is missing or not a string");
}
if (!jsonData.TryGetValue("download", out var dllDownloadObject) || !(dllDownloadObject is string dllDownload))
{
throw new Exception("Invalid JSON structure: 'download' key is missing or not a string");
}
if (!dllName.EndsWith(".dll"))
{
dllName += ".dll";
}
MomentumLauncher.Utilities.StartGame(File.ReadAllText(appdata + "\\path.txt"), dllDownload, dllName);
AnsiConsole.MarkupLine("Starting the client");
break;
case "Change fortnite path":
AnsiConsole.MarkupLine("Please enter the path to your fortnite folder");
string setPath = AnsiConsole.Ask<string>("Path: ");
string fortnitePath = Path.Combine(setPath, "FortniteGame", "Binaries", "Win64");
if (Directory.Exists(fortnitePath))
{
Console.WriteLine(fortnitePath);
File.WriteAllText(appdata + "\\path.txt", setPath);
Console.Clear();
AnsiConsole.MarkupLine("Path changed, you can now start the game");
Main(args);
}
else
{
Console.WriteLine(fortnitePath);
AnsiConsole.MarkupLine("[red]Path is invalid![/]");
Main(args);
}
break;
case "Exit":
Environment.Exit(0);
break;
}
Console.ReadKey(true);
}
}