correct relay loop error
This commit is contained in:
parent
958aceaa6b
commit
a44b80c7d2
4 changed files with 27 additions and 4 deletions
|
|
@ -77,6 +77,7 @@ namespace BetterSecondBot.BetterRelayService
|
||||||
string[] needBits = new string[]{ "asJson", "sourceType", "sourceFilter", "targetType", "targetConfig" };
|
string[] needBits = new string[]{ "asJson", "sourceType", "sourceFilter", "targetType", "targetConfig" };
|
||||||
while (found == true)
|
while (found == true)
|
||||||
{
|
{
|
||||||
|
found = false;
|
||||||
bool configfound = true;
|
bool configfound = true;
|
||||||
Dictionary<string, string> config = new Dictionary<string, string>();
|
Dictionary<string, string> config = new Dictionary<string, string>();
|
||||||
foreach(string a in needBits)
|
foreach(string a in needBits)
|
||||||
|
|
@ -93,8 +94,9 @@ namespace BetterSecondBot.BetterRelayService
|
||||||
}
|
}
|
||||||
if(configfound == false)
|
if(configfound == false)
|
||||||
{
|
{
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
found = true;
|
||||||
bool asJson = false;
|
bool asJson = false;
|
||||||
bool.TryParse(config["asJson"], out asJson);
|
bool.TryParse(config["asJson"], out asJson);
|
||||||
ApplyRelayConfig(config["sourceType"], config["sourceFilter"], config["targetType"], config["targetConfig"], asJson);
|
ApplyRelayConfig(config["sourceType"], config["sourceFilter"], config["targetType"], config["targetConfig"], asJson);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace BetterSecondBot
|
||||||
{
|
{
|
||||||
public bool Exited { get { return exitBot; } }
|
public bool Exited { get { return exitBot; } }
|
||||||
protected bool exitBot = false;
|
protected bool exitBot = false;
|
||||||
protected SecondBot Bot;
|
protected SecondBot Bot = null;
|
||||||
protected BetterAtHome betterAtHomeService;
|
protected BetterAtHome betterAtHomeService;
|
||||||
protected BetterTracking betterTracking;
|
protected BetterTracking betterTracking;
|
||||||
protected advertsService Adverts;
|
protected advertsService Adverts;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,13 @@ namespace BetterSecondbot.Tracking
|
||||||
public BetterTracking(Cli setcontroler)
|
public BetterTracking(Cli setcontroler)
|
||||||
{
|
{
|
||||||
controler = setcontroler;
|
controler = setcontroler;
|
||||||
if(controler.getBot().getMyConfig.Setting_Tracker.ToLowerInvariant() == "false")
|
if (controler.getBot() == null)
|
||||||
|
{
|
||||||
|
LogFormater.Info("Tracker - error no bot");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SecondBot bot = controler.getBot();
|
||||||
|
if (bot.getMyConfig.Setting_Tracker.ToLowerInvariant() == "false")
|
||||||
{
|
{
|
||||||
LogFormater.Info("Tracker - Disabled because set to false");
|
LogFormater.Info("Tracker - Disabled because set to false");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,22 @@ namespace BetterSecondBotShared.Json
|
||||||
|
|
||||||
public static string GetProp(JsonConfig reply, string arg)
|
public static string GetProp(JsonConfig reply, string arg)
|
||||||
{
|
{
|
||||||
return reply.GetType().GetProperty(arg, BindingFlags.Public | BindingFlags.Instance).GetValue(reply).ToString();
|
Type T = reply.GetType();
|
||||||
|
if(T == null)
|
||||||
|
{
|
||||||
|
return "- ERROR no type -";
|
||||||
|
}
|
||||||
|
PropertyInfo Pi = T.GetProperty(arg, BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
if(Pi == null)
|
||||||
|
{
|
||||||
|
return "- ERROR no prop -";
|
||||||
|
}
|
||||||
|
object val = Pi.GetValue(reply);
|
||||||
|
if(val == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return val.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SetPropTypeAndValue(JsonConfig reply,PropertyInfo prop,string arg,string arg_type,string arg_value_default)
|
protected void SetPropTypeAndValue(JsonConfig reply,PropertyInfo prop,string arg,string arg_type,string arg_value_default)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue