Exemple #1
0
        public MainWindow()
        {
#if DEBUG
            if (!File.Exists("idzconfig.bin"))
            {
                MainWindow_new mwNew = new MainWindow_new();
                mwNew.ShowDialog();
                gameConfig = mwNew.newConfig;
                if (!gameConfig.XOrDInput)
                {
                    ControllerSettings cs = new ControllerSettings(gameConfig, gameConfig.XOrDInput);
                    cs.ShowDialog();
                }
            }
#endif
            AutoUpdater.Start("https://raw.githubusercontent.com/nzgamer41/ZeroLauncher/master/Autoupdate.xml");
            try
            {
                InitializeComponent();
                foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (nic.Supports(NetworkInterfaceComponent.IPv4) == false)
                    {
                        continue;
                    }
                    foreach (UnicastIPAddressInformation ip in nic.GetIPProperties().UnicastAddresses)
                    {
                        if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            networkAdapters.Add(nic);
                            comboBoxNetAdapter.Items.Add(nic.Name + " " + ip.Address.ToString());
                        }
                    }
                }

                if (File.Exists("idzconfig.bin"))
                {
                    gameConfig = ReadFromBinaryFile <IDZConfig>("idzconfig.bin");
                    updateUI();
                }
                else
                {
                    comboBoxNetAdapter.SelectedIndex = 0;
                    updateUI();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
        public MainWindow()
        {
#if DEBUG
            MainWindow_new mwNew = new MainWindow_new();
            mwNew.ShowDialog();
#endif
            AutoUpdater.Start("https://raw.githubusercontent.com/nzgamer41/ZeroLauncher/master/Autoupdate.xml");
            try
            {
                InitializeComponent();
                foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (nic.Supports(NetworkInterfaceComponent.IPv4) == false)
                    {
                        continue;
                    }
                    foreach (UnicastIPAddressInformation ip in nic.GetIPProperties().UnicastAddresses)
                    {
                        if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            networkAdapters.Add(nic);
                            comboBoxNetAdapter.Items.Add(nic.Name + " " + ip.Address.ToString());
                        }
                    }
                }

                if (File.Exists("idzconfig.bin"))
                {
                    gameConfig = ReadFromBinaryFile <IDZConfig>("idzconfig.bin");
                    int selAdapter = networkAdapters.FindIndex(x => x.Name == gameConfig.selectedNic);
                    comboBoxNetAdapter.SelectedIndex = selAdapter;
                    if (gameConfig.JapOrExp)
                    {
                        buttonJap.IsChecked = false;
                        buttonExp.IsChecked = true;
                    }
                    else if (gameConfig.JapOrExp == false)
                    {
                        buttonExp.IsChecked = false;
                        buttonJap.IsChecked = true;
                    }

                    textBoxGameAMFS.Text = gameConfig.AMFSDir;

                    checkBoxIdeal.IsChecked    = gameConfig.IdealLan;
                    checkBoxDistServ.IsChecked = gameConfig.DistServer;
                    if (gameConfig.restriction != 0)
                    {
                        restrictUpDown.Value = gameConfig.restriction;
                    }
                    else
                    {
                        restrictUpDown.Value = 97;
                    }
                    // When I implement a online AIME server this will be togglable
                    //checkBoxAime.IsChecked = gameConfig.ImitateMe;
                    string reg = "Japan";
                    if (gameConfig.JapOrExp)
                    {
                        reg = "Export";
                    }
                    string reg2 = "DInput";
                    if (gameConfig.XOrDInput)
                    {
                        reg2 = "XInput";
                    }
                }
                else
                {
                    comboBoxNetAdapter.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }