예제 #1
0
        public MainForm()
        {
            InitializeComponent();

            Load += (_, __) =>
            {
                SDService.OnSDPluggedIn += (drive) =>
                {
                    //item 0 is always the SD status
                    MethodInvoker inv = () =>
                    {
                        SdStatusStrip.Image = Properties.Resources.green;
                        PopulateMenu();
                        InstallBtn.Enabled    = true;
                        InstallWebBtn.Enabled = true;
                    };
                    Invoke(inv);
                };
                SDService.OnSDRemoved += (drive) =>
                {
                    MethodInvoker inv = () =>
                    {
                        SdStatusStrip.Image = Properties.Resources.red;
                        Packages            = new Dictionary <Package, FileInfo>();
                        PackageView.Items.Clear();
                        InstallBtn.Enabled    = false;
                        InstallWebBtn.Enabled = false;
                    };
                    Invoke(inv);
                };
                SDService.Start();
            };
        }
예제 #2
0
        public Instructions()
        {
            InitializeComponent();

            Loaded += (_, __) =>
            {
                SDService.Validator      = IsSDCard;
                SDService.OnSDPluggedIn += (drive) =>
                {
                    foreach (DirectoryInfo info in drive.RootDirectory.GetDirectory("backup").GetDirectories())
                    {
                        if (IsValidBackupFolder(info))
                        {
                            CopyDump(drive, info);
                            Dispatcher.BeginInvoke(new Action(() => // Update on the UI thread
                            {
                                btn_next.IsEnabled = true;
                            }));
                            break;
                        }
                    }
                };
                SDService.OnSDRemoved += (drive) =>
                {
                    Dispatcher.BeginInvoke(new Action(() => // Update on the UI thread
                    {
                        btn_next.IsEnabled = false;
                    }));
                    SBK      = null;
                    TSECKeys = null;
                };
                SDService.Start();
            };
        }
예제 #3
0
 private void AutoLocBtn_Click(object sender, EventArgs e)
 {
     InstallBtn.Enabled       = false;
     InstallZipWebBtn.Enabled = false;
     InstallWebBtn.Enabled    = false;
     InstallZipBtn.Enabled    = false;
     Packages = new Dictionary <Package, FileInfo>();
     PackageView.Items.Clear();
     SDService.Start();
     ManualDir            = null;
     AutoLocBtn.Enabled   = false;
     ManualLocBtn.Enabled = true;
     StatusStrip.Visible  = true;
 }
예제 #4
0
        public PickSDPage()
        {
            InitializeComponent();

            Loaded += (_, __) =>
            {
                SDService.Validator      = IsSDCard;
                SDService.OnSDPluggedIn += (drive) =>
                {
                    KeysetFile = drive.RootDirectory.GetDirectory("switch").GetFile("prod.keys");
                    Dispatcher.Invoke(() => NextButton.IsEnabled = true); // update on UI thread
                };
                SDService.OnSDRemoved += (drive) =>
                {
                    HACGUIKeyset.Keyset = new HACGUIKeyset();
                    HACGUIKeyset.Keyset.LoadCommon();
                    Dispatcher.Invoke(() => NextButton.IsEnabled = false); // update on UI thread
                };

                SendLockpickButton.IsEnabled = InjectService.LibusbKInstalled;
                MountSDButton.IsEnabled      = InjectService.LibusbKInstalled;

                InjectService.DeviceInserted += () =>
                {
                    if (InjectService.LibusbKInstalled)
                    {
                        Dispatcher.Invoke(() =>
                        {
                            SendLockpickButton.IsEnabled = true;
                            MountSDButton.IsEnabled      = true;
                        });
                    }
                };

                InjectService.DeviceRemoved += () =>
                {
                    Dispatcher.Invoke(() =>
                    {
                        SendLockpickButton.IsEnabled = false;
                        MountSDButton.IsEnabled      = false;
                    });
                };

                RootWindow.Current.Submit(new Task(() => SDService.Start()));
            };
        }
예제 #5
0
        public PickSDPage()
        {
            InitializeComponent();

            Loaded += (_, __) =>
            {
                SDService.Validator      = IsSDCard;
                SDService.OnSDPluggedIn += (drive) =>
                {
                    KeysetFile = SDService.SDRoot.GetDirectory("switch").GetFile("prod.keys");
                    if (CopyKeyset())
                    {
                        Dispatcher.Invoke(() => NextButton.IsEnabled = true); // update on UI thread
                    }
                };
                SDService.OnSDRemoved += (drive) =>
                {
                    HACGUIKeyset.Keyset = new HACGUIKeyset();
                    HACGUIKeyset.Keyset.LoadCommon();
                    Dispatcher.Invoke(() => NextButton.IsEnabled = false); // update on UI thread
                };

                SendLockpickButton.IsEnabled = InjectService.LibusbKInstalled;
                MountSDEnabled = InjectService.LibusbKInstalled;
                Dispatcher.Invoke(() => UpdateSDButton());

                InjectService.DeviceInserted += () =>
                {
                    if (InjectService.LibusbKInstalled)
                    {
                        Dispatcher.Invoke(() =>
                        {
                            SendLockpickButton.IsEnabled = true;
                            MountSDEnabled = true;
                            UpdateSDButton();
                        });
                    }
                };

                InjectService.DeviceRemoved += () =>
                {
                    Dispatcher.Invoke(() =>
                    {
                        SendLockpickButton.IsEnabled = false;
                        MountSDEnabled = false;
                        UpdateSDButton();
                    });
                };

                InjectService.ErrorOccurred += () =>
                {
                    MessageBox.Show("An error occurred while trying to send the memloader ini data...");
                    MountSDLock = false;
                    Dispatcher.Invoke(() => UpdateSDButton());
                };

                InjectService.IniInjectFinished += () =>
                {
                    MountSDLock = false;
                    Dispatcher.Invoke(() => UpdateSDButton());
                };

                RootWindow.Current.Submit(new Task(() => SDService.Start()));
            };
        }