/// <inheritdoc /> public override void Init(ITorchBase torch) { base.Init(torch); Instance = this; var configFile = Path.Combine(StoragePath, "ShipFixer.cfg"); try { _config = Persistent <ShipFixerConfig> .Load(configFile); } catch (Exception e) { Log.Warn(e); } if (_config?.Data == null) { Log.Info("Create Default Config, because none was found!"); _config = new Persistent <ShipFixerConfig>(configFile, new ShipFixerConfig()); Save(); } ShipFixerCore.Init(); }
private bool CheckGridFound(long playerId, string gridName, IMyCharacter character) { ConcurrentBag <MyGroups <MyCubeGrid, MyGridPhysicalGroupData> .Group> groups; if (character == null) { groups = ShipFixerPlugin.FindGridGroupsForPlayer(gridName, playerId, Plugin.FactionFixEnabled); } else { groups = ShipFixerPlugin.FindLookAtGridGroup(character, playerId, Plugin.FactionFixEnabled); } CheckResult result = ShipFixerPlugin.CheckGroups(groups, out _, playerId, Plugin.FactionFixEnabled); if (result != CheckResult.OK) { WriteResponse(result); return(false); } return(true); }
public Control(ShipFixerPlugin plugin) : this() { Plugin = plugin; DataContext = plugin.Config; }