Exemple #1
0
        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 LiveHeXController(ISaveFileProvider boxes, IPKMView editor, InjectorCommunicationType ict)
        {
            SAV    = boxes;
            Editor = editor;
            var ValidVers = RamOffsets.GetValidVersions(boxes.SAV);

            Bot = new PokeSysBotMini(ValidVers[0], ict);
        }
 public PokeSysBotMini(LiveHeXVersion lv, InjectorCommunicationType ict)
 {
     Version   = lv;
     com       = RamOffsets.GetCommunicator(lv, ict);
     BoxStart  = RamOffsets.GetB1S1Offset(lv);
     SlotSize  = RamOffsets.GetSlotSize(lv);
     SlotCount = RamOffsets.GetSlotCount(lv);
     GapSize   = RamOffsets.GetGapSize(lv);
 }