diff --git a/CoordinateConverter/DCS/Aircraft/AH64/AH64.cs b/CoordinateConverter/DCS/Aircraft/AH64/AH64.cs index 05ad88f..bf2121c 100644 --- a/CoordinateConverter/DCS/Aircraft/AH64/AH64.cs +++ b/CoordinateConverter/DCS/Aircraft/AH64/AH64.cs @@ -735,7 +735,7 @@ public List ReadPointsFromAC(EPointType pointType) { case EPointType.Waypoint: case EPointType.Hazard: - if (!displayData.ContainsKey("PB1_1_b")) // we are not on the WPT/HZ page + if (!CheckOsbOptionEnabledForDisplayData(EKeyCode.MFD_T1, displayData, "WPTHZ")) // we are not on the WPT/HZ page { // go to the WPT/HZ page commands = new List() @@ -745,7 +745,7 @@ public List ReadPointsFromAC(EPointType pointType) } break; case EPointType.ControlMeasure: - if (!displayData.ContainsKey("PB2_3_b")) // we are not on the CTRLM page + if (!CheckOsbOptionEnabledForDisplayData(EKeyCode.MFD_T2, displayData, "CTRLM")) // we are not on the CTRLM page { // go to the CTRLM page commands = new List() @@ -755,7 +755,7 @@ public List ReadPointsFromAC(EPointType pointType) } break; case EPointType.Target: - if (!displayData.ContainsKey("PB5_9_b")) // we are not on the COORD (TGT/THRT) page + if (!CheckOsbOptionEnabledForDisplayData(EKeyCode.MFD_T5, displayData, "COORD")) // we are not on the COORD (TGT/THRT) page { // go to the COORD (TGT/THRT) page commands = new List() @@ -814,23 +814,51 @@ public List ReadPointsFromAC(EPointType pointType) Dictionary> displayDataKeysForLine = new Dictionary>() { - { 1, new List() { "PB24_21", "LABEL 1", "LABEL 2", "LABEL 5", "LABEL 6" } }, - { 2, new List() { "PB23_23", "LABEL 21", "LABEL 22", "LABEL 25", "LABEL 26" } }, - { 3, new List() { "PB22_25", "LABEL 41", "LABEL 42", "LABEL 45", "LABEL 46" } }, - { 4, new List() { "PB21_27", "LABEL 61", "LABEL 62", "LABEL 65", "LABEL 66" } }, - { 5, new List() { "PB20_29", "LABEL 81", "LABEL 82", "LABEL 85", "LABEL 86" } }, - { 6, new List() { "PB19_31", "LABEL 101", "LABEL 102", "LABEL 105", "LABEL 106" } } + { 1, new List() { "LABEL 1", "LABEL 2", "LABEL 5", "LABEL 6" } }, + { 2, new List() { "LABEL 21", "LABEL 22", "LABEL 25", "LABEL 26" } }, + { 3, new List() { "LABEL 41", "LABEL 42", "LABEL 45", "LABEL 46" } }, + { 4, new List() { "LABEL 61", "LABEL 62", "LABEL 65", "LABEL 66" } }, + { 5, new List() { "LABEL 81", "LABEL 82", "LABEL 85", "LABEL 86" } }, + { 6, new List() { "LABEL 101", "LABEL 102", "LABEL 105", "LABEL 106" } } }; for (int line = 1; line <= 6; line++) { - var keys = displayDataKeysForLine[line]; - if (!displayData.ContainsKey(keys[0])) + var labelIds = displayDataKeysForLine[line]; + + EKeyCode keyCode; + switch (line) + { + case 1: + keyCode = EKeyCode.MFD_L1; + break; + case 2: + keyCode = EKeyCode.MFD_L2; + break; + case 3: + keyCode = EKeyCode.MFD_L3; + break; + case 4: + keyCode = EKeyCode.MFD_L4; + break; + case 5: + keyCode = EKeyCode.MFD_L5; + break; + case 6: + keyCode = EKeyCode.MFD_L6; + break; + default: + throw new Exception("Unknown line number"); + } + + List lines = GetTextLinesForOsbForDisplayData(keyCode, displayData); + + if (lines.Count == 0) { break; // page done } - string pointIdStr = displayData[keys[0]]; // "W18", "H04", "T49", "C52" + string pointIdStr = lines.First(); // "W18", "H04", "T49", "C52" string pointIdentStr; @@ -860,10 +888,10 @@ public List ReadPointsFromAC(EPointType pointType) throw new Exception("Unknown point type"); } - pointIdentStr += displayData[keys[1]]; // "LZ", "TU", "ZU", "AE" - string pointFreetextStr = displayData[keys[2]]; // "W18", "TWR", "Z23", "T90" - string pointMGRSStr = displayData[keys[3]]; // "37T DL 0192 5672" - string pointElevationStr = displayData[keys[4]]; // "17 FT" + pointIdentStr += displayData[labelIds[0]]; // "LZ", "TU", "ZU", "AE" + string pointFreetextStr = displayData[labelIds[1]]; // "W18", "TWR", "Z23", "T90" + string pointMGRSStr = displayData[labelIds[2]]; // "37T DL 0192 5672" + string pointElevationStr = displayData[labelIds[3]]; // "17 FT" // parse the data EPointIdent pointIdent = (EPointIdent)Enum.Parse(typeof(EPointIdent), pointIdentStr); @@ -1026,7 +1054,7 @@ public int ClearPoints(EPointType pointType, int startIdx, int endIdx) /// The display data for the display at the time /// A directory of the internal dcs push button names and it's associated text. /// Invalid key - key - static public Dictionary GetDictionaryForDisplayDataOnPB(AH64.EKeyCode key, Dictionary displayData) + static public Dictionary GetDictionaryOnOsbForDisplayData(AH64.EKeyCode key, Dictionary displayData) { string dcsInternalKeyName = "PB"; switch (key) @@ -1118,23 +1146,20 @@ static public Dictionary GetDictionaryForDisplayDataOnPB(AH64.EK /// The line number to get, 0 indexed. /// The text for the line on that push button /// Not enough lines, or no text at all. - static public string GetLineForDisplayDataOnPB(AH64.EKeyCode key, Dictionary displayData, uint line) + static public List GetTextLinesForOsbForDisplayData(AH64.EKeyCode key, Dictionary displayData) { - var dictForPB = GetDictionaryForDisplayDataOnPB(key, displayData); - // we need to discard the box key (ending with _b) - // order keys by ID (as int) - dictForPB = dictForPB.Where(kvp => !kvp.Key.EndsWith("_b")).OrderBy(kvp => int.Parse(kvp.Key.Substring(kvp.Key.LastIndexOf('_') + 1))).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - + var dictForPB = GetDictionaryOnOsbForDisplayData(key, displayData); // Keys for the lines on the displays are in the form of PB_ // where key is the pushbuton internal name in DCS (starting with T1, going clockwise around the OSBs) // and id is a seemingly arbitrary number, but they are strictly ordered by line number // and then return the line-th entry in the dictionary // when sorted by the id. - if (dictForPB.Count < line) - { - throw new System.ArgumentException("No text at that line. number of lines: " + dictForPB.Count.ToString() + " but wanted line: " + line.ToString(), nameof(line)); - } - return dictForPB.ElementAt((int)line).Value; + + // we need to discard the box key (ending with _b) + // order keys by ID (as int) + dictForPB = dictForPB.Where(kvp => !kvp.Key.EndsWith("_b")).OrderBy(kvp => int.Parse(kvp.Key.Substring(kvp.Key.LastIndexOf('_') + 1))).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + return dictForPB.Select(kvp => kvp.Value).ToList(); } /// @@ -1146,9 +1171,9 @@ static public string GetLineForDisplayDataOnPB(AH64.EKeyCode key, Dictionary /// true if the option in display data is enabled on the push button; otherwise, false. /// - static public bool IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode key, Dictionary displayData, string checkAgainst = null) + static public bool CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode key, Dictionary displayData, string checkAgainst = null) { - var displayDataForPB = GetDictionaryForDisplayDataOnPB(key, displayData); + var displayDataForPB = GetDictionaryOnOsbForDisplayData(key, displayData); // check all values if any contains the checkAgainst string if (!string.IsNullOrEmpty(checkAgainst)) diff --git a/CoordinateConverter/DCS/Aircraft/AH64/AH64DTCData.cs b/CoordinateConverter/DCS/Aircraft/AH64/AH64DTCData.cs index 5b9df1c..5c737d5 100644 --- a/CoordinateConverter/DCS/Aircraft/AH64/AH64DTCData.cs +++ b/CoordinateConverter/DCS/Aircraft/AH64/AH64DTCData.cs @@ -1645,9 +1645,9 @@ public ELaserCodeProgrammSelector CurrentLaserCodeProgrammSelector get { // read the current selected laser code for programming from the weapons page - List commands= new List(); + List commands = new List(); int device = (int)(IsPilot ? AH64.EDeviceCode.PLT_LMFD : AH64.EDeviceCode.CPG_LMFD); - + // go to weapons page commands.Add(new DCSCommand(device, (int)AH64.EKeyCode.MFD_WPN)); // go to code page @@ -1686,7 +1686,7 @@ public ELaserCodeProgrammSelector CurrentLaserCodeProgrammSelector return ELaserCodeProgrammSelector.Lrfd; } - string setString = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_T2, message.CockpitDisplayData[displayToRead], 1); + string setString = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_T2, message.CockpitDisplayData[displayToRead]).ElementAt(1); switch (setString) { case "LST": diff --git a/CoordinateConverter/DCS/Aircraft/AH64/AH64TSDOptionData.cs b/CoordinateConverter/DCS/Aircraft/AH64/AH64TSDOptionData.cs index 89d9ea7..97ee070 100644 --- a/CoordinateConverter/DCS/Aircraft/AH64/AH64TSDOptionData.cs +++ b/CoordinateConverter/DCS/Aircraft/AH64/AH64TSDOptionData.cs @@ -986,7 +986,7 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) switch (kvp.Key) { case EScreens.TSD_MAP: - stringToCheck = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_B2, displayData, 1); + stringToCheck = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_B2, displayData).ElementAt(1); switch (stringToCheck) { case "NAV": @@ -999,7 +999,7 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) throw new System.Exception("Expected 'NAV' or 'ATK' on B2, but found \"" + stringToCheck + "\""); } - stringToCheck = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_L2, displayData, 1); + stringToCheck = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_L2, displayData).ElementAt(1); switch (stringToCheck) { case "DIG": @@ -1018,9 +1018,9 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) throw new System.Exception("Expected 'DIG', 'CHART', 'SAT' or 'STICK' on L2, but found \"" + stringToCheck + "\""); } - result.Center = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R3, displayData, "CTR") ? ECenter.Center : ECenter.Depressed; + result.Center = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R3, displayData, "CTR") ? ECenter.Center : ECenter.Depressed; - stringToCheck = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_R5, displayData, 1); + stringToCheck = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_R5, displayData).ElementAt(1); switch (stringToCheck) { case "TRK-UP": @@ -1036,12 +1036,12 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) throw new System.Exception("Expected 'TRK-UP', 'HDG-UP' or 'N-UP' on R5, but found \"" + stringToCheck + "\""); } - result.Grid = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_T5, displayData, "GRID") ? EGrid.Grid_Normal : EGrid.Grid_None; + result.Grid = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_T5, displayData, "GRID") ? EGrid.Grid_Normal : EGrid.Grid_None; break; case EScreens.TSD_MAP_DIG: - result.Gray = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_T4, displayData, "GRAY") ? EGray.Gray : EGray.Green_and_gray; + result.Gray = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_T4, displayData, "GRAY") ? EGray.Gray : EGray.Green_and_gray; - stringToCheck = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_L4, displayData, 1); + stringToCheck = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_L4, displayData).ElementAt(1); switch (stringToCheck) { case "NONE": @@ -1057,7 +1057,7 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) throw new System.Exception("Expected 'NONE', 'ELEV' or 'A/C' on L4, but found \"" + stringToCheck + "\""); } - stringToCheck = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_L5, displayData, 1); + stringToCheck = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_L5, displayData).ElementAt(1); switch (stringToCheck) { case "NONE": @@ -1082,7 +1082,7 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) throw new System.Exception("Expected 'NONE', '50', '100', '200', '500' or '1000' on L5, but found \"" + stringToCheck + "\""); } - string ffdStr = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_L6, displayData, 1); + string ffdStr = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_L6, displayData).ElementAt(1); switch (ffdStr) { case "NONE": @@ -1102,7 +1102,7 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) } break; case EScreens.TSD_MAP_SAT: - string satLevelStr = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_L3, displayData, 1); + string satLevelStr = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_L3, displayData).ElementAt(1); switch (satLevelStr) { case "5M": @@ -1145,44 +1145,44 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) } break; case EScreens.TSD_SHOW_NAV: - result.NavWpData = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L2, displayData, "WAYPOINT DATA") ? EFilter.Show : EFilter.Hide; - result.NavInactiveZones = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L3, displayData, "INACTIVE ZONES") ? EFilter.Show : EFilter.Hide; - result.NavObstacles = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L4, displayData, "OBSTACLES") ? EFilter.Show : EFilter.Hide; - result.NavCursor = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L5, displayData, " CURSOR") ? EFilter.Show : EFilter.Hide; - result.NavCursorInfo = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L6, displayData, "CURSR\nINFO") ? EFilter.Show : EFilter.Hide; - result.NavHSI = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R4, displayData, "HSI") ? EFilter.Show : EFilter.Hide; - result.NavEndurance = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R5, displayData, "ENDR") ? EFilter.Show : EFilter.Hide; - result.NavWind = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R6, displayData, "WIND") ? EFilter.Show : EFilter.Hide; + result.NavWpData = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L2, displayData, "WAYPOINT DATA") ? EFilter.Show : EFilter.Hide; + result.NavInactiveZones = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L3, displayData, "INACTIVE ZONES") ? EFilter.Show : EFilter.Hide; + result.NavObstacles = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L4, displayData, "OBSTACLES") ? EFilter.Show : EFilter.Hide; + result.NavCursor = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L5, displayData, " CURSOR") ? EFilter.Show : EFilter.Hide; + result.NavCursorInfo = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L6, displayData, "CURSR\nINFO") ? EFilter.Show : EFilter.Hide; + result.NavHSI = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R4, displayData, "HSI") ? EFilter.Show : EFilter.Hide; + result.NavEndurance = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R5, displayData, "ENDR") ? EFilter.Show : EFilter.Hide; + result.NavWind = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R6, displayData, "WIND") ? EFilter.Show : EFilter.Hide; break; case EScreens.TSD_SHOW_ATK: - result.AtkCurrentRoute = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L2, displayData, "CURRENT ROUTE") ? EFilter.Show : EFilter.Hide; - result.AtkInactiveZones = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L3, displayData, "INACTIVE ZONES") ? EFilter.Show : EFilter.Hide; - result.AtkFCRObstacles = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L4, displayData, "FCR TGTS/OBSTACLES") ? EFilter.Show : EFilter.Hide; - result.AtkCursor = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L5, displayData, " CURSOR") ? EFilter.Show : EFilter.Hide; - result.AtkCursorInfo = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L6, displayData, "CURSR\nINFO") ? EFilter.Show : EFilter.Hide; - result.AtkHSI = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R4, displayData, "HSI") ? EFilter.Show : EFilter.Hide; - result.AtkEndurance = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R5, displayData, "ENDR") ? EFilter.Show : EFilter.Hide; - result.AtkWind = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R6, displayData, "WIND") ? EFilter.Show : EFilter.Hide; + result.AtkCurrentRoute = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L2, displayData, "CURRENT ROUTE") ? EFilter.Show : EFilter.Hide; + result.AtkInactiveZones = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L3, displayData, "INACTIVE ZONES") ? EFilter.Show : EFilter.Hide; + result.AtkFCRObstacles = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L4, displayData, "FCR TGTS/OBSTACLES") ? EFilter.Show : EFilter.Hide; + result.AtkCursor = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L5, displayData, " CURSOR") ? EFilter.Show : EFilter.Hide; + result.AtkCursorInfo = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L6, displayData, "CURSR\nINFO") ? EFilter.Show : EFilter.Hide; + result.AtkHSI = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R4, displayData, "HSI") ? EFilter.Show : EFilter.Hide; + result.AtkEndurance = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R5, displayData, "ENDR") ? EFilter.Show : EFilter.Hide; + result.AtkWind = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R6, displayData, "WIND") ? EFilter.Show : EFilter.Hide; break; case EScreens.TSD_SHOW_COORD_NAV: - result.NavFriendlyUnits = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L2, displayData, "CONTROL MEASURES") ? EFilter.Show : EFilter.Hide; - result.NavFriendlyUnits = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L3, displayData, "FRIENDLY UNITS") ? EFilter.Show : EFilter.Hide; - result.NavEnemyUnits = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L4, displayData, "ENEMY UNITS") ? EFilter.Show : EFilter.Hide; - result.NavTargets = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L5, displayData, "PLANNED TGTS/THREATS") ? EFilter.Show : EFilter.Hide; - result.NavLines = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R1, displayData, "LINES") ? EFilter.Show : EFilter.Hide; - result.NavAreas = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R2, displayData, "AREAS") ? EFilter.Show : EFilter.Hide; + result.NavCtrlMeasures = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L2, displayData, "CONTROL MEASURES") ? EFilter.Show : EFilter.Hide; + result.NavFriendlyUnits = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L3, displayData, "FRIENDLY UNITS") ? EFilter.Show : EFilter.Hide; + result.NavEnemyUnits = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L4, displayData, "ENEMY UNITS") ? EFilter.Show : EFilter.Hide; + result.NavTargets = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L5, displayData, "PLANNED TGTS/THREATS") ? EFilter.Show : EFilter.Hide; + result.NavLines = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R1, displayData, "LINES") ? EFilter.Show : EFilter.Hide; + result.NavAreas = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R2, displayData, "AREAS") ? EFilter.Show : EFilter.Hide; break; case EScreens.TSD_SHOW_COORD_ATK: - result.AtkFriendlyUnits = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L2, displayData, "CONTROL MEASURES") ? EFilter.Show : EFilter.Hide; - result.AtkFriendlyUnits = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L3, displayData, "FRIENDLY UNITS") ? EFilter.Show : EFilter.Hide; - result.AtkEnemyUnits = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L4, displayData, "ENEMY UNITS") ? EFilter.Show : EFilter.Hide; - result.AtkTargets = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L5, displayData, "PLANNED TGTS/THREATS") ? EFilter.Show : EFilter.Hide; - result.AtkLines = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R1, displayData, "LINES") ? EFilter.Show : EFilter.Hide; - result.AtkAreas = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R2, displayData, "AREAS") ? EFilter.Show : EFilter.Hide; - result.AtkShotAt = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R3, displayData, "SHOT") ? EFilter.Show : EFilter.Hide; + result.AtkCtrlMeasures = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L2, displayData, "CONTROL MEASURES") ? EFilter.Show : EFilter.Hide; + result.AtkFriendlyUnits = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L3, displayData, "FRIENDLY UNITS") ? EFilter.Show : EFilter.Hide; + result.AtkEnemyUnits = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L4, displayData, "ENEMY UNITS") ? EFilter.Show : EFilter.Hide; + result.AtkTargets = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L5, displayData, "PLANNED TGTS/THREATS") ? EFilter.Show : EFilter.Hide; + result.AtkLines = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R1, displayData, "LINES") ? EFilter.Show : EFilter.Hide; + result.AtkAreas = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R2, displayData, "AREAS") ? EFilter.Show : EFilter.Hide; + result.AtkShotAt = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R3, displayData, "SHOT") ? EFilter.Show : EFilter.Hide; break; case EScreens.TSD_SHOW_THREAT: - string visStr = AH64.GetLineForDisplayDataOnPB(AH64.EKeyCode.MFD_R1, displayData, 1); + string visStr = AH64.GetTextLinesForOsbForDisplayData(AH64.EKeyCode.MFD_R1, displayData).ElementAt(1); switch (visStr) { case "THRT": @@ -1195,8 +1195,8 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) throw new System.Exception("Expected 'THRT' or 'OWN' on R1, but found \"" + visStr + "\""); } - result.AseThreats = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L2, displayData, "ASE THREATS") ? EFilter.Show : EFilter.Hide; - result.VisShade = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_L6, displayData, "VIS\nSHADE") ? EFilter.Show : EFilter.Hide; + result.AseThreats = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L2, displayData, "ASE THREATS") ? EFilter.Show : EFilter.Hide; + result.VisShade = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_L6, displayData, "VIS\nSHADE") ? EFilter.Show : EFilter.Hide; // switch to OWN if (result.ThreatVis == EVis.Threat) @@ -1227,10 +1227,10 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) } // we are now in OWN, read data - result.VisOwnOwn = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R2, displayData, "OWN") ? EFilter.Show : EFilter.Hide; - result.VisOwnTrnPt = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R3, displayData, "TRN PT") ? EFilter.Show : EFilter.Hide; - result.VisOwnGhost = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R4, displayData, "GHOST") ? EFilter.Show : EFilter.Hide; - result.VisOwnRings = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R6, displayData, "RINGS") ? EFilter.Show : EFilter.Hide; + result.VisOwnOwn = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R2, displayData, "OWN") ? EFilter.Show : EFilter.Hide; + result.VisOwnTrnPt = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R3, displayData, "TRN PT") ? EFilter.Show : EFilter.Hide; + result.VisOwnGhost = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R4, displayData, "GHOST") ? EFilter.Show : EFilter.Hide; + result.VisOwnRings = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R6, displayData, "RINGS") ? EFilter.Show : EFilter.Hide; // switch over to THRT commands = new List() @@ -1258,11 +1258,11 @@ static public AH64TSDOptionData ReadFromAC(bool isPilot) displayData = message.CockpitDisplayData[displayToRead]; // read THRT - result.VisThreatACQ = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R2, displayData, "ACQ") ? EFilter.Show : EFilter.Hide; - result.VisThreatTrnPt = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R3, displayData, "TRN PT") ? EFilter.Show : EFilter.Hide; - result.VisThreatFCR = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R4, displayData, "FCR/RFI") ? EFilter.Show : EFilter.Hide; - result.VisThreatThreats = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R5, displayData, "THREATS") ? EFilter.Show : EFilter.Hide; - result.visThreatTargets = AH64.IsOptionInDisplayDataEnabledOnPB(AH64.EKeyCode.MFD_R6, displayData, "TARGETS") ? EFilter.Show : EFilter.Hide; + result.VisThreatACQ = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R2, displayData, "ACQ") ? EFilter.Show : EFilter.Hide; + result.VisThreatTrnPt = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R3, displayData, "TRN PT") ? EFilter.Show : EFilter.Hide; + result.VisThreatFCR = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R4, displayData, "FCR/RFI") ? EFilter.Show : EFilter.Hide; + result.VisThreatThreats = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R5, displayData, "THREATS") ? EFilter.Show : EFilter.Hide; + result.visThreatTargets = AH64.CheckOsbOptionEnabledForDisplayData(AH64.EKeyCode.MFD_R6, displayData, "TARGETS") ? EFilter.Show : EFilter.Hide; break; } } diff --git a/CoordinateConverter/MainForm.cs b/CoordinateConverter/MainForm.cs index 525c648..2bce480 100644 --- a/CoordinateConverter/MainForm.cs +++ b/CoordinateConverter/MainForm.cs @@ -21,7 +21,7 @@ namespace CoordinateConverter /// public partial class MainForm : Form { - private readonly GitHub.Version VERSION = new GitHub.Version(0, 12, 2); + private readonly GitHub.Version VERSION = new GitHub.Version(0, 12, 3); #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public static readonly Color ERROR_COLOR = Color.Pink; diff --git a/Installer/Installer.wixproj b/Installer/Installer.wixproj index c3888d8..02dea08 100644 --- a/Installer/Installer.wixproj +++ b/Installer/Installer.wixproj @@ -1,9 +1,9 @@  - Version=0.12.2 + Version=0.12.3 - Version=0.12.2 + Version=0.12.3