public LiveHexUI(ISaveFileProvider sav, IPKMView editor) { SAV = sav; Remote = new LiveHexController(sav, editor); InitializeComponent(); TB_IP.Text = Properties.Settings.Default.LatestIP; // add an event to the editor // ReSharper disable once SuspiciousTypeConversion.Global BoxSelect = ((Control)sav).Controls.Find("CB_BoxSelect", true).FirstOrDefault() as ComboBox; if (BoxSelect != null) { BoxSelect.SelectedIndexChanged += ChangeBox; } var type = sav.GetType(); var fields = type.GetTypeInfo().DeclaredFields; var test = fields.First(z => z.Name == "EditEnv"); x = (SaveDataEditor <PictureBox>)test.GetValue(sav); x.Slots.Publisher.Subscribers.Add(this); TB_Port.Text = Remote.Bot.Port.ToString(); CenterToParent(); }
private readonly ComboBox?BoxSelect; // this is just us holding a reference; disposal is done by its parent #pragma warning restore CA2213 // Disposable fields should be disposed public LiveHeXUI(ISaveFileProvider sav, IPKMView editor) { SAV = sav; CurrentInjectionType = AutoLegality.Default.USBBotBasePreferred ? InjectorCommunicationType.USB : InjectorCommunicationType.SocketNetwork; Remote = new LiveHeXController(sav, editor, CurrentInjectionType); InitializeComponent(); this.TranslateInterface(WinFormsTranslator.CurrentLanguage); TB_IP.Text = AutoLegality.Default.LatestIP; SetInjectionTypeView(); // add an event to the editor // ReSharper disable once SuspiciousTypeConversion.Global BoxSelect = ((Control)sav).Controls.Find("CB_BoxSelect", true).FirstOrDefault() as ComboBox; if (BoxSelect != null) { BoxSelect.SelectedIndexChanged += ChangeBox; Closing += (s, e) => BoxSelect.SelectedIndexChanged -= ChangeBox; } var type = sav.GetType(); var fields = type.GetTypeInfo().DeclaredFields; var test = fields.First(z => z.Name == "EditEnv"); x = (SaveDataEditor <PictureBox>)test.GetValue(sav); x.Slots.Publisher.Subscribers.Add(this); TB_Port.Text = Remote.Bot.com.Port.ToString(); CenterToParent(); }
public void SetEditEnvironment(SaveDataEditor <PictureBox> value) { EditEnv = value; M.Env = value; menu.Editor = value; SAV = value.SAV; value.Slots.Publisher.Subscribers.Add(this); value.Slots.Publisher.Subscribers.Add(SL_Party); value.Slots.Publisher.Subscribers.Add(Box); value.Slots.Publisher.Subscribers.Add(SL_Extra); }
private void AddSaveData(string newSaveDataName = null) { // If there isn't an AllConditions instance yet, put a message in the console and return. if (!AllSavesData.Instance) { Debug.LogError("AllSavesData has not been created yet."); return; } // Create a condition based on the description. SaveData newSaveData = SaveDataEditor.createPersistentDataSave(); newSaveData.name = (newSaveDataName != null) ? newSaveDataName : "New SaveData"; ScriptableObjectUtility.AddScriptableObject(AllSavesData.Instance, ref newSaveData, ref AllSavesData.Instance.saveDatas, "Created new SaveData" ); }