mirror of
https://gitea.tendokyu.moe/yellowberry/WACCALauncher.git
synced 2026-09-22 22:58:00 +03:00
Oops, All Rewritten!
This commit is contained in:
+26
-14
@@ -1,10 +1,6 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -18,21 +14,29 @@ namespace WACCALauncher
|
||||
|
||||
public static Screen CurrentScreen = Screen.PrimaryScreen;
|
||||
|
||||
public static bool IsCorrectRes()
|
||||
public static bool IsCorrectRes(Screen selected = null)
|
||||
{
|
||||
return CurrentScreen.Bounds.Width == 1080
|
||||
&& CurrentScreen.Bounds.Height == 1920;
|
||||
var screen = selected ?? CurrentScreen;
|
||||
|
||||
// 1080p vertical resolution
|
||||
var correctPixelRes = screen.Bounds.Width == 1080
|
||||
&& screen.Bounds.Height == 1920;
|
||||
|
||||
// 9:16 aspect ratio check
|
||||
var correctAspect = (screen.Bounds.Width / screen.Bounds.Height) == 0.5625;
|
||||
|
||||
return correctPixelRes || correctAspect;
|
||||
}
|
||||
|
||||
public static bool IsCorrectVer()
|
||||
public static bool IsRecommendedWinVer()
|
||||
{
|
||||
// ensures Enterprise 2016 LTSB is used
|
||||
// Enterprise 2016 LTSB is recommended, for various reasons
|
||||
return BuildNumber == 14393 && ReleaseId == 1607;
|
||||
}
|
||||
|
||||
public static bool IsCorrectEnv()
|
||||
public static bool IsRecommendedEnv()
|
||||
{
|
||||
return IsCorrectRes() && IsCorrectVer();
|
||||
return IsCorrectRes() && IsRecommendedWinVer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -41,9 +45,17 @@ namespace WACCALauncher
|
||||
[STAThread]
|
||||
private static void Main()
|
||||
{
|
||||
// for testing
|
||||
if(Screen.AllScreens.Length > 1)
|
||||
CurrentScreen = Screen.AllScreens[1];
|
||||
// if we have multiple screens, try to start on one with proper resolution, if any
|
||||
if (Screen.AllScreens.Length > 1)
|
||||
{
|
||||
foreach (Screen screen in Screen.AllScreens)
|
||||
{
|
||||
if (IsCorrectRes(screen))
|
||||
{
|
||||
CurrentScreen = screen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// when running as system shell, we must set our working directory manually
|
||||
var whereAmI = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
|
||||
Reference in New Issue
Block a user