Files
OpenRec/Setup.cs
2022-02-18 19:03:37 -05:00

48 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
namespace start
{
class Setup
{
public static void setup()
{
Console.WriteLine("Setting up...");
Directory.CreateDirectory("SaveData\\Profile\\");
if (!(File.Exists("SaveData\\avatar.txt")))
{
File.WriteAllText("SaveData\\avatar.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/avatar.txt"));
}
else if (File.ReadAllText("SaveData\\avatar.txt") == "")
{
File.WriteAllText("SaveData\\avatar.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/avatar.txt"));
}
if (!(File.Exists("SaveData\\avataritems.txt")))
{
File.WriteAllText("SaveData\\avataritems.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/avataritems.txt"));
}
if (!(File.Exists("SaveData\\equipment.txt")))
{
File.WriteAllText("SaveData\\equipment.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/equipment.txt"));
}
if (!(File.Exists("SaveData\\Profile\\username.txt")))
{
File.WriteAllText("SaveData\\Profile\\username.txt", "DefaultUsername");
}
if (!(File.Exists("SaveData\\settings.txt")))
{
File.WriteAllText("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"));
}
Console.WriteLine("Done!");
Console.Clear();
}
}
}