Skip to content

Check for Updates button broken after latest cactbot update #263

@valarnin

Description

@valarnin

The latest cactbot update included the following commit which switched to using OverlayPlugin's ILogger interface rather than its own.
quisquous/cactbot@d07965a

Normally I'd PR a fix for this issue, but to be honest I have no idea what's going on in the corresponding button handler.

private void btnCactbotUpdate_Click(object sender, EventArgs e)
{
try
{
var asm = Assembly.Load("CactbotEventSource");
var checkerType = asm.GetType("Cactbot.VersionChecker");
var loggerType = asm.GetType("Cactbot.ILogger");
var configType = asm.GetType("Cactbot.CactbotEventSourceConfig");
var esList = container.Resolve<Registry>().EventSources;
IEventSource cactbotEs = null;
foreach (var es in esList)
{
if (es.Name == "Cactbot Config" || es.Name == "Cactbot")
{
cactbotEs = es;
break;
}
}
if (cactbotEs == null)
{
MessageBox.Show("Cactbot is loaded but it never registered with OverlayPlugin!", "Error");
return;
}
var cactbotConfig = cactbotEs.GetType().GetProperty("Config").GetValue(cactbotEs);
configType.GetField("LastUpdateCheck").SetValue(cactbotConfig, DateTime.MinValue);
var checker = checkerType.GetConstructor(new Type[] { loggerType }).Invoke(new object[] { cactbotEs });
checkerType.GetMethod("DoUpdateCheck", new Type[] {configType}).Invoke(checker, new object[] { cactbotConfig });
} catch(FileNotFoundException)
{
MessageBox.Show("Could not find Cactbot!", "Error");
} catch(Exception ex)
{
MessageBox.Show("Failed: " + ex.ToString(), "Error");
}
}

cc @ngld @quisquous

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions