예제 #1
0
파일: FormMain.cs 프로젝트: SlavaTenhi/SLMP
 //////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ//////////////////////////////////////////////////////////////
 private void buttonSkyrim_Click(object sender, EventArgs e)
 {
     label1.Focus();
     if (File.Exists(gameFolder + "TESV.exe"))
     {
         buttonSkyrim.Enabled = false;
         buttonSkyrim.MouseEnter -= new EventHandler(buttonSkyrim_MouseEnter);
         buttonSkyrim.MouseLeave -= new EventHandler(buttonSkyrim_MouseLeave);
         buttonSkyrim.BackgroundImage = BMbuttonlogoPressed;
         if (startWithGame != null)
         {
             if (File.Exists(startWithGame))
             {
                 Process.Start(startWithGame);
             }
         }
         if (waitBeforeStart != null)
         {
             int WaitTime = FuncParser.stringToInt(waitBeforeStart);
             if (WaitTime > 0)
             {
                 FuncMisc.ToggleButtons(this, false);
                 Thread.Sleep(WaitTime * 1000);
                 FuncMisc.ToggleButtons(this, true);
                 buttonSkyrim.Enabled = false;
             }
         }
         FuncMisc.RunProcess(gameFolder + "TESV.exe", "-forcesteamloader", SKSEExited, this);
     }
     else
     {
         MessageBox.Show("TESV.exe" + notFound);
     }
 }
예제 #2
0
 //////////////////////////////////////////////////////ГРАНИЦА ФУНКЦИИ//////////////////////////////////////////////////////////////
 private void button_Skyrim_Click(object sender, EventArgs e)
 {
     label1.Focus();
     if (File.Exists(pathGameFolder + "SKSE.exe"))
     {
         pressButtonEvent(button_Skyrim, BMbuttonlogoPressed, buttonSkyrim_MouseEnter, buttonSkyrim_MouseLeave);
         if (argsStartsWith != null && File.Exists(argsStartsWith))
         {
             FuncMisc.runProcess(argsStartsWith, null, null, null, false);
         }
         if (argsWaitBefore != null)
         {
             int WaitTime = FuncParser.stringToInt(argsWaitBefore);
             if (WaitTime > 0)
             {
                 FuncMisc.toggleButtons(this, false);
                 Thread.Sleep(WaitTime * 1000);
                 FuncMisc.toggleButtons(this, true);
                 button_Skyrim.Enabled = false;
             }
         }
         FuncMisc.runProcess(pathGameFolder + "SKSE.exe", "-forcesteamloader", SKSEExited, this, false);
     }
     else
     {
         MessageBox.Show("SKSE.exe" + notFound);
     }
 }
예제 #3
0
 private void comboBox_FPS_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (fps)
     {
         FormMain.maxFPS = FuncParser.stringToInt(comboBox_FPS.SelectedItem.ToString());
         FuncSettings.physicsFPS();
     }
 }
예제 #4
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (setupENB && fps)
     {
         FormMain.predictFPS = FuncParser.stringToInt(comboBox1.SelectedItem.ToString());
         FuncSettings.physicsFPS();
     }
 }
예제 #5
0
        private void refreshScreenResolution()
        {
            screenListW.Clear();
            screenListH.Clear();
            comboBoxResolutionTAB.Items.Clear();
            addResolution(FuncParser.intRead(FormMain.pathSkyrimPrefsINI, "Display", "iSize W"), FuncParser.intRead(FormMain.pathSkyrimPrefsINI, "Display", "iSize H"));
            bool fail = false;

            try
            {
                var scope = new ManagementScope();
                var query = new ObjectQuery("SELECT * FROM CIM_VideoControllerResolution");
                using (var searcher = new ManagementObjectSearcher(scope, query))
                {
                    var results = searcher.Get();
                    foreach (var result in results)
                    {
                        addResolution(FuncParser.stringToInt(result["HorizontalResolution"].ToString()), FuncParser.stringToInt(result["VerticalResolution"].ToString()));
                    }
                }
            }
            catch
            {
                fail = true;
            }
            if (fail || comboBoxResolutionTAB.Items.Count < 2)
            {
                foreach (string line in FuncResolutions.Resolutions())
                {
                    int divider = line.IndexOf("/");
                    addResolution(FuncParser.stringToInt(line.Remove(divider)), FuncParser.stringToInt(line.Remove(0, divider + 1)));
                }
            }
            comboBoxResolutionTAB.SelectedIndex = 0;
            setAspectRatioFiles();
        }
예제 #6
0
 public FormMain()
 {
     InitializeComponent();
     Directory.SetCurrentDirectory(pathLauncherFolder);
     if (!Directory.Exists(pathDataFolder))
     {
         MessageBox.Show(@"Панель Управления должна располагаться по адресу: Директория Игры\Любая Папка\" + Environment.NewLine + Environment.NewLine + @"The Control Panel should be located at: Game Directory\Any Folder\");
         Environment.Exit(0);
     }
     string[] arguments = Environment.GetCommandLineArgs();
     if (arguments.Length > 0)
     {
         foreach (string line in arguments)
         {
             if (line.StartsWith("-s=", StringComparison.OrdinalIgnoreCase))
             {
                 argsStartsWith = line.Remove(0, 3);
             }
             else if (line.StartsWith("-w=", StringComparison.OrdinalIgnoreCase))
             {
                 argsWaitBefore = FuncParser.stringToInt(line.Remove(0, 3));
             }
         }
         arguments = null;
     }
     if (File.Exists(pathLauncherINI))
     {
         FuncParser.iniWrite(pathLauncherINI, "General", "Version_CP", panelFileVersion);
         int wLeft = FuncParser.intRead(pathLauncherINI, "General", "POS_WindowLeft");
         int wTop  = FuncParser.intRead(pathLauncherINI, "General", "POS_WindowTop");
         if (wLeft < 0 || wTop < 0)
         {
             StartPosition = FormStartPosition.CenterScreen;
         }
         else
         {
             if (wLeft > (Screen.PrimaryScreen.Bounds.Width - Size.Width))
             {
                 wLeft = Screen.PrimaryScreen.Bounds.Width - Size.Width;
             }
             if (wTop > (Screen.PrimaryScreen.Bounds.Height - Size.Height))
             {
                 wTop = Screen.PrimaryScreen.Bounds.Height - Size.Height;
             }
             StartPosition = FormStartPosition.Manual;
             Location      = new Point(wLeft, wTop);
         }
         settingsPreset = FuncParser.intRead(pathLauncherINI, "General", "SettingsPreset");
         if (settingsPreset < 0 || settingsPreset > 3)
         {
             settingsPreset = 2;
         }
         numberStyle = FuncParser.intRead(pathLauncherINI, "General", "NumberStyle");
         if (numberStyle < 1 || numberStyle > 2)
         {
             numberStyle = 1;
         }
         if (string.Equals(FuncParser.stringRead(pathLauncherINI, "General", "Language"), "EN", StringComparison.OrdinalIgnoreCase))
         {
             langTranslate = "EN";
             setLangTranslateEN();
         }
         else
         {
             setLangTranslateRU();
         }
         maxFPS = FuncParser.intRead(pathLauncherINI, "Game", "MaxFPS");
         if (maxFPS < 30 || maxFPS > 240)
         {
             maxFPS = 60;
         }
         if (!FuncParser.keyExists(pathLauncherINI, "Game", "ZFighting"))
         {
             FuncParser.iniWrite(pathLauncherINI, "Game", "ZFighting", "false");
         }
         int nearDistance = FuncParser.intRead(pathLauncherINI, "Game", "NearDistance");
         if (nearDistance < 15 || nearDistance > 25)
         {
             FuncParser.iniWrite(pathLauncherINI, "Game", "NearDistance", "18");
         }
         customFont = FuncParser.stringRead(pathLauncherINI, "Font", "CP_Font");
         if (customFont != null)
         {
             var ifc = new InstalledFontCollection();
             for (int i = ifc.Families.Length - 1; i >= 0; i--)
             {
                 if (ifc.Families[i].Name == customFont)
                 {
                     FuncMisc.supportStrikeOut(customFont);
                     FuncMisc.setFormFont(this);
                     break;
                 }
                 else if (i == 0)
                 {
                     customFont = null;
                 }
             }
             ifc = null;
         }
     }
     else
     {
         setLangTranslateRU();
         StartPosition = FormStartPosition.CenterScreen;
         closeControlPanel(this, new EventArgs());
     }
     if (!File.Exists(pathSkyrimPrefsINI) || !File.Exists(pathSkyrimINI))
     {
         resetSettings();
     }
     AppDomain.CurrentDomain.ProcessExit += new EventHandler(closeControlPanel);
     refreshStyle();
 }