void UpdateAliasesLink(int index) { string hostname = panel.HostNames[index].Value; string address = panel.Addresses[index].Value; if (!string.IsNullOrWhiteSpace(hostname) && !string.IsNullOrWhiteSpace(address)) { var newHostAlias = new HostAlias(hostname, address); if (HostAliases[index] == newHostAlias) { return; } HostAliases[index] = newHostAlias; Logger.Info($"{this}: Adding pair {hostname} -> {address} to resolver list."); ConnectionUtils.GlobalResolver[hostname] = address; ModuleListPanel.UpdateSimpleConfigurationSettings(); } else if (HostAliases[index] != default) { ConnectionUtils.GlobalResolver.Remove(HostAliases[index].Hostname); Logger.Info($"{this}: Removing {HostAliases[index].Hostname} from resolver list."); HostAliases[index] = default; ModuleListPanel.UpdateSimpleConfigurationSettings(); } }
void WritePanelToConfiguration() { var markers = new List <ARExecutableMarker>(); for (int index = 0; index < panel.Types.Count; index++) { var type = (ARMarkerType)panel.Types[index].Index; if (type == ARMarkerType.Unset) { continue; } if (!float.TryParse(panel.Sizes[index].Value, out float sizeInMm) || sizeInMm <= 0) { Logger.Info($"{this}: Ignoring size for entry {index}, cannot parse '{panel.Sizes[index].Value}' " + "into a positive number."); continue; } string code = panel.Codes[index].Value.Trim(); if (string.IsNullOrEmpty(code)) { Logger.Info($"{this}: Ignoring empty code for entry {index}."); continue; } ARExecutableMarker marker = new ARExecutableMarker { Type = type, Action = (ARMarkerAction)panel.Actions[index].Index, Code = code, SizeInMm = sizeInMm, }; markers.Add(marker); } Configuration = new ARMarkersConfiguration { MaxMarkerDistanceInM = 0.5f, Markers = markers.ToArray(), }; if (ARController.Instance != null) { ARController.Instance.MarkerExecutor.Configuration = Configuration; } ModuleListPanel.UpdateSimpleConfigurationSettings(); }