예제 #1
0
        public void CampaignDataInitializer()
        {
            try
            {
                ObservableCollection <Campaigns> campaigndata = new ObservableCollection <Campaigns>();
                iniclass ddqlconfig    = new iniclass(PATH + "\\ddqlconfig.ini");
                int      CampaignCount = int.Parse(ddqlconfig.Read("General", "CampaignCount"));
                for (int i = 1; i <= CampaignCount; ++i)
                {
                    String str = ddqlconfig.Read("General", i.ToString());
                    campaigndata.Add(new Campaigns
                    {
                        Name    = ddqlconfig.Read(str, "NAME"),
                        ID      = ddqlconfig.Read(str, "ID"),
                        Side    = SideName[int.Parse(ddqlconfig.Read(str, "SIDE"))],
                        SCENERY = ddqlconfig.Read(str, "SCENERY")
                    });
                }
                CampaignDataGrid.DataContext = campaigndata;
            }

            catch (Exception ex)
            {
                MessageBox.Show("启动器调用CampaignDataInitializer时遇到问题:\n\r" + ex.Message, "致命错误", MessageBoxButton.OK);
                App.Current.Shutdown();
            }
        }
예제 #2
0
        public void LaunchChecker()
        {
            try
            {
                StreamWriter streamWriter = new StreamWriter(PATH + "\\spawn.ini");
                for (int i = 0; i < 9; ++i)
                {
                    streamWriter.WriteLine(Spawn[i]);
                }
                streamWriter.Close();
                iniclass spawn = new iniclass(PATH + "\\spawn.ini");
                iniclass ra2mo = new iniclass(PATH + "\\RA2MO.ini");

                if (Diff_Easy.IsChecked == true)
                {
                    spawn.Write("Settings", "DifficultyModeHuman", "0");
                    spawn.Write("Settings", "DifficultyModeComputer", "2");
                    ra2mo.Write("Options", "Difficulty", "0");
                }
                if (Diff_Medium.IsChecked == true)
                {
                    spawn.Write("Settings", "DifficultyModeHuman", "1");
                    spawn.Write("Settings", "DifficultyModeComputer", "1");
                    ra2mo.Write("Options", "Difficulty", "1");
                }
                if (Diff_Hard.IsChecked == true)
                {
                    spawn.Write("Settings", "DifficultyModeHuman", "2");
                    spawn.Write("Settings", "DifficultyModeComputer", "0");
                    ra2mo.Write("Options", "Difficulty", "2");
                }
                Campaigns tmp = (Campaigns)CampaignDataGrid.SelectedItem;
                spawn.Write("Settings", "Scenario", tmp.SCENERY + ".MAP");
                return;
            }

            catch (Exception ex)
            {
                MessageBox.Show("启动器调用LaunchChecker时遇到问题:\n\r" + ex.Message, "错误", MessageBoxButton.OK);
            }
        }
예제 #3
0
        private void Button_Confirm_Click(object sender, RoutedEventArgs e)//I don't think a button have any problem but a debug is needed
        {
            try
            {
                ScreenResolution_Custom_Width.Text  = ScreenResolution_Custom_Width.Text.Trim();
                ScreenResolution_Custom_Height.Text = ScreenResolution_Custom_Height.Text.Trim();
                iniclass ra2mo      = new iniclass(PATH + "\\RA2MO.ini");
                iniclass ddqlconfig = new iniclass(PATH + "\\ddqlconfig.ini");
                ra2mo.Write("Video", SettingString_Video[0], SettingWriterVideo(Set_Windowed.IsChecked));
                ra2mo.Write("Video", SettingString_Video[1], SettingWriterVideo(Set_Windowed_NoFrame.IsChecked));
                ra2mo.Write("Video", SettingString_Video[2], SettingWriterVideo(Set_BackBuffer.IsChecked));
                if (ScreenResolution_Standard.IsChecked == true)
                {
                    ddqlconfig.Write("Settings", "ScreenResolutionMode", 0.ToString());
                    ra2mo.Write("Video", "ScreenWidth", ScreenResolutions.Item1[ComboBox_ScreenResolution.SelectedIndex].Item1.ToString());
                    ra2mo.Write("Video", "ScreenHeight", ScreenResolutions.Item1[ComboBox_ScreenResolution.SelectedIndex].Item2.ToString());
                }
                else
                {
                    ddqlconfig.Write("Settings", "ScreenResolutionMode", 1.ToString());
                    ra2mo.Write("Video", "ScreenWidth", ScreenResolution_Custom_Width.Text);
                    ra2mo.Write("Video", "ScreenHeight", ScreenResolution_Custom_Height.Text);
                }
                ra2mo.Write("Compatibility", SettingString_Compatibility[0], SettingWriterCompatibility(Set_DDrawAccelerateion.IsChecked));
                ra2mo.Write("Compatibility", SettingString_Compatibility[1], SettingWriterCompatibility(Set_Windows8.IsChecked));
                ra2mo.Write("Compatibility", SettingString_Compatibility[2], SettingWriterCompatibility(Set_CursorLock.IsChecked));
                ra2mo.Write("Compatibility", "Renderer", Renderers[ComboBox_Renderers.SelectedIndex]);
                ddqlconfig.Write("Settings", "ScreenResolutionCustomWidth", ScreenResolution_Custom_Width.Text);
                ddqlconfig.Write("Settings", "ScreenResolutionCustomHeight", ScreenResolution_Custom_Height.Text);
                ddqlconfig.Write("Settings", "ScreenResolutionIndex", ComboBox_ScreenResolution.SelectedIndex.ToString());
                this.Close();
                return;
            }

            catch (Exception ex)
            {
                MessageBox.Show("启动器调用Button_Confirm_Click时遇到问题:\n\r" + ex.Message, "错误", MessageBoxButton.OK);
            }
        }
예제 #4
0
        public void SettingInitializer()
        {
            try
            {
                iniclass ra2mo      = new iniclass(PATH + "\\RA2MO.ini");
                iniclass ddqlconfig = new iniclass(PATH + "\\ddqlconfig.ini");
                iniclass renderer   = new iniclass(PATH + "\\Resources\\Renderers.ini");

                //read RA2MO.ini
                for (int i = 0; i < 3; ++i)
                {
                    String str = ra2mo.Read("Video", SettingString_Video[i]);
                    SettingList_Video[i] = SettingChecker(str);
                }
                for (int i = 0; i < 3; ++i)
                {
                    String str = ra2mo.Read("Compatibility", SettingString_Compatibility[i]);
                    SettingList_Compatibility[i] = SettingChecker(str);
                }
                Set_Windowed.IsChecked           = SettingList_Video[0];
                Set_Windowed_NoFrame.IsChecked   = SettingList_Video[1];
                Set_BackBuffer.IsChecked         = SettingList_Video[2];
                Set_DDrawAccelerateion.IsChecked = SettingList_Compatibility[0];
                Set_Windows8.IsChecked           = SettingList_Compatibility[1];
                Set_CursorLock.IsChecked         = SettingList_Compatibility[2];
                if (!SettingList_Video[0] && SettingList_Video[1])
                {
                    ra2mo.Write("Video", SettingString_Video[1], "False");
                    SettingList_Video[1]           = false;
                    SettingString_Video[1]         = "False";
                    Set_Windowed_NoFrame.IsChecked = false;
                }
                WindowedFrameChecker();

                //read Renderers.ini
                String RendererNow = ra2mo.Read("Compatibility", "Renderer");
                String s           = renderer.Read("Renderers", totalRendererNums.ToString());
                while (s != String.Empty)
                {
                    Renderers.Add(s);
                    if (s == RendererNow)
                    {
                        ComboBox_Renderers.SelectedIndex = totalRendererNums;
                    }
                    ++totalRendererNums;
                    s = renderer.Read("Renderers", totalRendererNums.ToString());
                }
                ComboBox_Renderers.ItemsSource = Renderers;

                //read Screen resolutions
                ScreenResolution_Custom_Width.Text  = ddqlconfig.Read("Settings", "ScreenResolutionCustomWidth");
                ScreenResolution_Custom_Height.Text = ddqlconfig.Read("Settings", "ScreenResolutionCustomHeight");

                for (int i = 0; i < 16; ++i)
                {
                    if (StdandardScreenResolutions[i].Item1 <= ScreenWidth && StdandardScreenResolutions[i].Item2 <= ScreenHeight)
                    {
                        ScreenResolutions.Item1.Add(StdandardScreenResolutions[i]);
                        ScreenResolutions.Item2.Add(StdandardScreenResolutions[i].Item1.ToString() + 'X' + StdandardScreenResolutions[i].Item2.ToString());
                    }
                }
                ComboBox_ScreenResolution.ItemsSource   = ScreenResolutions.Item2;
                ComboBox_ScreenResolution.SelectedIndex = int.Parse(ddqlconfig.Read("Settings", "ScreenResolutionIndex"));

                if (ddqlconfig.Read("Settings", "ScreenResolutionMode") == "0")
                {
                    ScreenResolution_Standard.IsChecked = true;
                }
                else
                {
                    ScreenResolution_Custom.IsChecked = true;
                }

                return;
            }

            catch (Exception ex)
            {
                MessageBox.Show("启动器调用SettingInitializer时遇到问题:\n\r" + ex.Message, "错误", MessageBoxButton.OK);
                this.Close();
            }
        }