Beispiel #1
0
        private void BMSChanged()
        {
            try
            {
                statusAssign = Status.GetNeutralPos;

                LargeTab.SelectedIndex = 0;

                // Read Theater List
                TheaterList.PopulateAndSave(appReg, Dropdown_TheaterList);

                // Read BMS-FULL.key
                string fname     = appReg.GetInstallDir() + "\\User\\Config\\" + appReg.getKeyFileName();
                string fnameauto = appReg.GetInstallDir() + "\\User\\Config\\" + appReg.getAutoKeyFileName();
                if (!File.Exists(fnameauto))
                {
                    File.Copy(fname, fnameauto);
                }
                keyFile = new KeyFile(fnameauto, appReg);

                // Write Data Grid
                WriteDataGrid();
            }
            catch (Exception ex)
            {
                Diagnostics.WriteLogFile(ex);
                Close();
            }
        }
        /// <summary>
        /// Execute when launching this app.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // load command line.
                string[] args = Environment.GetCommandLineArgs();

                if (args.Length % 2 == 1)
                {
                    Dictionary <string, string> option = new Dictionary <string, string>();
                    for (int index = 1; index < args.Length; index += 2)
                    {
                        option.Add(args[index], args[index + 1]);
                    }
                    if (option.ContainsKey("/yame"))
                    {
                        if (option["/yame"] == "true")
                        {
                            FLG_YAME64 = true;
                        }
                    }

                    if (FLG_YAME64)
                    {
                        LargeTab.SelectedIndex  = 1;
                        Tab_Launcher.Visibility = Visibility.Collapsed;

                        Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
                        BackGroundBox1.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
                        BackGroundBox2.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
                        BackGroundBox3.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
                        BackGroundBox4.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
                        BackGroundImage.Opacity   = 0;

                        Button_Apply_YAME64.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        Button_Apply_YAME64.Visibility = Visibility.Hidden;
                    }
                }
            }
            catch (FileNotFoundException ex)
            {
                Console.WriteLine(ex.Message);

                StreamWriter sw = new StreamWriter("C:\\FBMSAltLauncherErrorLog.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
                sw.Write(ex.Message);
                sw.Close();

                MessageBox.Show("Error Log Saved To C:\\FBMSAltLauncherErrorLog.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);

                Close();
            }

            // Load UI Properties(Like Button Status).
            appProperties = new AppProperties(this);

            // Read Registry
            appReg = new AppRegInfo(this);

            if (appReg.getBMSVersion() == BMS_Version.UNDEFINED)
            {
                Close();
                return;
            }

            try
            {
                // Read Theater List
                TheaterList.Populate(appReg, Dropdown_TheaterList);

                // Get Devices
                deviceControl  = new DeviceControl(appReg);
                neutralButtons = new NeutralButtons[deviceControl.devList.Count];

                // Aquire joySticks
                AquireAll(true);

                // Reset All Axis Settings
                foreach (AxisName nme in axisNameList)
                {
                    inGameAxis[nme.ToString()] = new InGameAxAssgn();
                }
                joyAssign_2_inGameAxis();
                ResetAssgnWindow();

                // Read BMS-FULL.key
                string fname = appReg.GetInstallDir() + "\\User\\Config\\" + appReg.getKeyFileName();
                keyFile = new KeyFile(fname, appReg);

                // Write Data Grid
                WriteDataGrid();

                // Set Timer
                AxisMovingTimer.Tick    += AxisMovingTimer_Tick;
                AxisMovingTimer.Interval = new TimeSpan(0, 0, 0, 0, 16);

                KeyMappingTimer.Tick    += KeyMappingTimer_Tick;
                KeyMappingTimer.Interval = new TimeSpan(0, 0, 0, 0, 16);

                //System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
            }
            catch (FileNotFoundException ex)
            {
                Console.WriteLine(ex.Message);

                StreamWriter sw = new StreamWriter(appReg.GetInstallDir() + "\\Error.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
                sw.Write(ex.Message);
                sw.Close();

                MessageBox.Show("Error Log Saved To " + appReg.GetInstallDir() + "\\Error.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);

                Close();
            }
        }