begin code overhauls
This commit is contained in:
parent
9969e466d8
commit
eb1026f8f4
14 changed files with 544 additions and 197 deletions
|
@ -4,12 +4,37 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace Bot
|
||||
{
|
||||
[Serializable()]
|
||||
public class MainConfiguration : IConfig
|
||||
public sealed class MainConfiguration : IConfig
|
||||
{
|
||||
private static readonly object lck = new object();
|
||||
private static MainConfiguration inst = null;
|
||||
|
||||
static MainConfiguration() { }
|
||||
|
||||
public static MainConfiguration Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if(inst == null)
|
||||
{
|
||||
lock (lck)
|
||||
{
|
||||
inst = new MainConfiguration();
|
||||
inst.Load();
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
}
|
||||
public float ConfigVersion
|
||||
{
|
||||
get; set;
|
||||
|
@ -20,34 +45,40 @@ namespace Bot
|
|||
get; set;
|
||||
}
|
||||
|
||||
public string MainProgramDLL;
|
||||
public string first { get; set; }
|
||||
public string last { get; set; }
|
||||
public string password { get; set; }
|
||||
public string MainProgramDLL = "BlankBot.dll";
|
||||
public string first { get; set; } = "";
|
||||
public string last { get; set; } = "";
|
||||
public string password { get; set; } = "";
|
||||
|
||||
//public License LicenseKey { get; set; }
|
||||
public string ActivationCode { get; set; }
|
||||
public string ActivationCode { get; set; } = "";
|
||||
|
||||
public string GitPassword { get; set; }
|
||||
public string GitPassword { get; set; } = "NOT_SET";
|
||||
|
||||
public MainConfiguration()
|
||||
{
|
||||
public Dictionary<UUID, int> BotAdmins { get; set; } = new Dictionary<UUID, int>();
|
||||
|
||||
}
|
||||
|
||||
public static MainConfiguration Load()
|
||||
public void Load()
|
||||
{
|
||||
MainConfiguration X = new MainConfiguration();
|
||||
SerialManager sm = new SerialManager();
|
||||
try
|
||||
{
|
||||
X = sm.Read<MainConfiguration>("Main");
|
||||
return X;
|
||||
|
||||
MainProgramDLL = X.MainProgramDLL;
|
||||
first = X.first;
|
||||
last = X.last;
|
||||
ActivationCode = X.ActivationCode;
|
||||
password = X.password;
|
||||
GitPassword = X.GitPassword;
|
||||
BotAdmins = X.BotAdmins;
|
||||
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
Console.WriteLine("Main.json was not found");
|
||||
return new MainConfiguration();
|
||||
BotSession.Instance.Logger.info(true, "Main.json does not exist");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue