forked from mooRceR/OpenQuest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.cs
More file actions
157 lines (153 loc) · 5.46 KB
/
Setup.cs
File metadata and controls
157 lines (153 loc) · 5.46 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
using OpenRec.Tools;
namespace start
{
class Setup
{
public static bool firsttime = false;
public static void setup()
{
Console.OutputEncoding = Encoding.Unicode;
// something something vault server uhh uhh ermm...
Console.WriteLine("Getting Data... [This may take a while! lots of files 🙀]");
Console.WriteLine();
CreateFolders();
if (!(File.Exists("SaveData\\App\\firsttime.txt")))
{
firsttime = true;
}
CreateLocalFileIfRequired("SaveData\\App\\firsttime.txt", "uhh just shows the app it's been ran before? 🤷");
CreateFileIfRequired("SaveData\\avatar.txt", "Download/avatar.txt");
if (File.ReadAllText("SaveData\\avatar.txt") == "")
{
File.WriteAllText("SaveData\\avatar.txt", GithubTool.GetString("Download/avatar.txt").Result);
}
CreateFileIfRequired("SaveData\\avataritems.txt", "Download/avataritems.txt");
CreateFileIfRequired("SaveData\\avataritems2.txt", "Download/avataritems2.txt");
CreateFileIfRequired("SaveData\\equipment.txt", "Download/equipment.txt");
CreateFileIfRequired("SaveData\\consumables.txt", "Download/consumables.txt");
CreateSaveDataIfRequired("consumables.txt");
CreateSaveDataIfRequired("gameconfigs.txt");
CreateSaveDataIfRequired("storefronts2.txt");
CreateSaveDataIfRequired("baserooms.txt");
CreateLocalFileIfRequired("SaveData\\Profile\\username.txt", ProfileTool.CreateName());
CreateLocalFileIfRequired("SaveData\\Profile\\level.txt", "10");
CreateLocalFileIfRequired("SaveData\\Profile\\userid.txt", new Random().Next().ToString());
CreateLocalFileIfRequired("SaveData\\myrooms.txt", "[]");
CreateLocalFileIfRequired("SaveData\\settings.txt", Newtonsoft.Json.JsonConvert.SerializeObject(api.Settings.CreateDefaultSettings()));
if (!(File.Exists("SaveData\\profileimage.png")))
{
File.WriteAllBytes("SaveData\\profileimage.png", new WebClient().DownloadData("https://github.com/OpenRecRoom/OpenRec/raw/main/profileimage.png"));
}
if (!(File.Exists("SaveData\\App\\privaterooms.txt")))
{
File.WriteAllText("SaveData\\App\\privaterooms.txt", "Disabled");
}
if (!(File.Exists("SaveData\\App\\showopenrecinfo.txt")))
{
File.WriteAllText("SaveData\\App\\showopenrecinfo.txt", "Enabled");
}
if (!(File.Exists("SaveData\\App\\facefeaturesadd.txt")))
{
File.WriteAllText("SaveData\\App\\facefeaturesadd.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/facefeaturesadd.txt"));
}
if (!File.Exists("SaveData\\Rooms\\Downloaded\\roomname.txt"))
{
try
{
api.CustomRooms.RoomGet("gogo9");
}
catch
{
Console.WriteLine("Failure ?? press any key to retry (I'm not sure what this is for :scream_cat:)");
Console.ReadKey();
setup();
}
}
Console.WriteLine("Done!");
Console.Clear();
}
static void CreateSaveDataIfRequired(string Name)
{
try
{
if (!File.Exists("SaveData\\" + Name))
{
using (StreamWriter SW = File.CreateText("SaveData\\" + Name))
{
SW.Write(GithubTool.GetString("Download/" + Name).Result);
SW.Close();
SW.Dispose();
}
}
Console.Write("█");
}
catch
{
Console.Write("⚠");
}
}
static void CreateFileIfRequired(string Path, string GithubDataPath)
{
try
{
if (!File.Exists(Path))
{
string S = GithubTool.GetString(GithubDataPath).Result;
using (StreamWriter SW = File.CreateText(Path))
{
SW.Write(S);
SW.Close();
SW.Dispose();
}
}
Console.Write("█");
}
catch
{
Console.Write("⚠");
}
}
static void CreateLocalFileIfRequired(string Path, string Content)
{
try
{
if (!File.Exists(Path))
{
using (StreamWriter SW = File.CreateText(Path))
{
SW.Write(Content);
SW.Close();
SW.Dispose();
}
}
Console.Write("█");
}
catch
{
Console.Write("⚠");
}
}
static void CreateFolders()
{
Directory.CreateDirectory("SaveData\\App\\");
Console.Write("█");
Directory.CreateDirectory("SaveData\\Profile\\");
Console.Write("█");
Directory.CreateDirectory("SaveData\\MultiProfiles\\");
Console.Write("█");
Directory.CreateDirectory("SaveData\\Images\\");
Console.Write("█");
Directory.CreateDirectory("SaveData\\Rooms\\");
Console.Write("█");
Directory.CreateDirectory("SaveData\\Images\\");
Console.Write("█");
Directory.CreateDirectory("SaveData\\Rooms\\Downloaded\\");
Console.Write("█");
}
}
}