2024-09-15 22:47:45 -06:00
|
|
|
package com.ridgebotics.ridgescout.utility;
|
2024-07-28 15:49:44 -06:00
|
|
|
|
2024-09-15 22:47:45 -06:00
|
|
|
import com.ridgebotics.ridgescout.scoutingData.fields;
|
|
|
|
|
import com.ridgebotics.ridgescout.scoutingData.transfer.transferType;
|
|
|
|
|
import com.ridgebotics.ridgescout.types.frcEvent;
|
|
|
|
|
import com.ridgebotics.ridgescout.types.input.inputType;
|
2024-07-28 15:49:44 -06:00
|
|
|
|
|
|
|
|
public class DataManager {
|
|
|
|
|
public static String evcode;
|
|
|
|
|
public static frcEvent event;
|
|
|
|
|
public static void reload_event(){
|
2024-09-14 16:14:50 -06:00
|
|
|
evcode = getevcode();
|
2025-01-24 14:12:17 -07:00
|
|
|
|
|
|
|
|
if(evcode.equals("unset")) return;
|
|
|
|
|
|
2024-09-14 16:14:50 -06:00
|
|
|
event = frcEvent.decode(fileEditor.readFile(evcode + ".eventdata"));
|
2025-01-24 14:12:17 -07:00
|
|
|
|
|
|
|
|
if(event == null) {
|
|
|
|
|
AlertManager.error("Failed to load event!");
|
|
|
|
|
settingsManager.setEVCode("unset");
|
|
|
|
|
evcode = "unset";
|
|
|
|
|
}
|
2024-07-28 15:49:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getevcode() {
|
2024-09-20 15:59:35 -06:00
|
|
|
return settingsManager.getEVCode();
|
2024-07-28 15:49:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static inputType[][] match_values;
|
|
|
|
|
public static inputType[] match_latest_values;
|
|
|
|
|
public static transferType[][] match_transferValues;
|
|
|
|
|
public static void reload_match_fields(){
|
2025-02-17 22:47:39 -07:00
|
|
|
try {
|
|
|
|
|
match_values = fields.load(fields.matchFieldsFilename);
|
|
|
|
|
match_latest_values = match_values[match_values.length - 1];
|
|
|
|
|
match_transferValues = transferType.get_transfer_values(match_values);
|
|
|
|
|
} catch (Exception e){
|
|
|
|
|
AlertManager.error(e);
|
|
|
|
|
}
|
2024-07-28 15:49:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static inputType[][] pit_values;
|
|
|
|
|
public static inputType[] pit_latest_values;
|
|
|
|
|
public static transferType[][] pit_transferValues;
|
|
|
|
|
public static void reload_pit_fields(){
|
2025-02-17 22:47:39 -07:00
|
|
|
try {
|
|
|
|
|
pit_values = fields.load(fields.pitsFieldsFilename);
|
|
|
|
|
pit_latest_values = pit_values[pit_values.length-1];
|
|
|
|
|
pit_transferValues = transferType.get_transfer_values(pit_values);
|
|
|
|
|
} catch (Exception e){
|
|
|
|
|
AlertManager.error(e);
|
|
|
|
|
}
|
2024-07-28 15:49:44 -06:00
|
|
|
}
|
|
|
|
|
}
|