public Borderlands3Component(LiveSplitState state) { Debug.Listeners.Clear(); Debug.Listeners.Add(BL3TraceListener.Instance); pointerFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + pointerFileName; if (!File.Exists(pointerFilePath)) { DownloadPointerFile(); } else { CheckPointerFileForUpdate(); } PointerInfoReader.Initialize(); timerModel = new TimerModel() { CurrentState = state }; settings = new Borderlands3Settings(); memReader = new MemoryReader(timerModel, settings); CounterHandler.Init(settings); state.OnStart += memReader.OnTimerStart; }
public static void Init(Borderlands3Settings settings) { CounterHandler.settings = settings; Assembly counterAsm; try { counterAsm = Assembly.Load("LiveSplit.Counter"); if (counterAsm is null) { throw new FileNotFoundException(); } } catch (FileNotFoundException) { Debug.WriteLine("Unable to load 'LiveSplit.Counter', counter features will be disabled."); settings.SetSupportsCounter(false); return; } componentType = counterAsm.GetType("LiveSplit.UI.Components.CounterComponent"); Type counterType = counterAsm.GetType("LiveSplit.UI.Components.Counter"); Type settingsType = counterAsm.GetType("LiveSplit.UI.Components.CounterComponentSettings"); counterProperty = componentType.GetProperty("Counter"); settingsProperty = componentType.GetProperty("Settings"); textProperty = settingsType.GetProperty("CounterText"); incrementMethod = counterType.GetMethod("Increment"); resetMethod = counterType.GetMethod("Reset"); initalized = true; settings.SetSupportsCounter(true); }
public MemoryReader(TimerModel timerModel, Borderlands3Settings settings) { this.timerModel = timerModel; this.settings = settings; }