97 lines
2.6 KiB
C#
97 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace SecondBotEvents.Config
|
|
{
|
|
public class BasicConfig(bool fromENV, string fromFolder = "") : Config(fromENV, fromFolder)
|
|
{
|
|
protected override void MakeSettings()
|
|
{
|
|
filename = "basic";
|
|
settings.Add("Username");
|
|
settings.Add("Password");
|
|
settings.Add("LoginURI");
|
|
settings.Add("LogCommands");
|
|
settings.Add("DefaultHoverHeight");
|
|
settings.Add("MAC");
|
|
settings.Add("Id0");
|
|
settings.Add("StartLocation");
|
|
settings.Add("ReconnectDelaySecs");
|
|
settings.Add("MaxReconnectDelaySecs");
|
|
}
|
|
|
|
public string GetStartLocation()
|
|
{
|
|
return ReadSettingAsString("StartLocation", "last");
|
|
}
|
|
|
|
public double GetDefaultHoverHeight()
|
|
{
|
|
return ReadSettingAsDouble("DefaultHoverHeight", 0.1);
|
|
}
|
|
public bool GetLogCommands()
|
|
{
|
|
return ReadSettingAsBool("LogCommands", true);
|
|
}
|
|
public string GetUsername()
|
|
{
|
|
return ReadSettingAsString("Username","Firstname Lastname");
|
|
}
|
|
|
|
public string GetPassword()
|
|
{
|
|
return ReadSettingAsString("Password", "passwordHere");
|
|
}
|
|
|
|
public string GetFirstName()
|
|
{
|
|
|
|
string[] bits = GetUsername().Split(" ");
|
|
return bits[0];
|
|
}
|
|
|
|
public string GetLastName()
|
|
{
|
|
string[] bits = GetUsername().Split(" ");
|
|
if(bits.Length == 2)
|
|
{
|
|
return bits[1];
|
|
}
|
|
return "Resident";
|
|
}
|
|
|
|
public string GetLoginURI()
|
|
{
|
|
return ReadSettingAsString("LoginURI", "secondlife");
|
|
}
|
|
|
|
public string GetMAC()
|
|
{
|
|
return ReadSettingAsString("MAC", "");
|
|
}
|
|
|
|
public string GetId0()
|
|
{
|
|
return ReadSettingAsString("Id0", "");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Base reconnect delay in seconds. Doubles on each consecutive failure (exponential backoff).
|
|
/// Default: 120 seconds.
|
|
/// </summary>
|
|
public int GetReconnectDelaySecs()
|
|
{
|
|
return ReadSettingAsInt("ReconnectDelaySecs", 120);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Maximum reconnect delay cap in seconds for exponential backoff.
|
|
/// Default: 600 seconds (10 minutes).
|
|
/// </summary>
|
|
public int GetMaxReconnectDelaySecs()
|
|
{
|
|
return ReadSettingAsInt("MaxReconnectDelaySecs", 600);
|
|
}
|
|
}
|
|
}
|