Rename IsOSX to IsMacOS in Utils and usages

This commit is contained in:
2dust 2025-11-09 10:52:46 +08:00
parent e20c11c1a7
commit 4da59cd767
10 changed files with 12 additions and 12 deletions

View file

@ -998,7 +998,7 @@ public class Utils
public static bool IsLinux() => OperatingSystem.IsLinux(); public static bool IsLinux() => OperatingSystem.IsLinux();
public static bool IsOSX() => OperatingSystem.IsMacOS(); public static bool IsMacOS() => OperatingSystem.IsMacOS();
public static bool IsNonWindows() => !OperatingSystem.IsWindows(); public static bool IsNonWindows() => !OperatingSystem.IsWindows();
@ -1020,7 +1020,7 @@ public class Utils
{ {
try try
{ {
if (IsWindows() || IsOSX()) if (IsWindows() || IsMacOS())
{ {
return false; return false;
} }

View file

@ -26,7 +26,7 @@ public static class AutoStartupHandler
await SetTaskLinux(); await SetTaskLinux();
} }
} }
else if (Utils.IsOSX()) else if (Utils.IsMacOS())
{ {
await ClearTaskOSX(); await ClearTaskOSX();

View file

@ -33,7 +33,7 @@ public static class SysProxyHandler
await ProxySettingLinux.SetProxy(Global.Loopback, port, exceptions); await ProxySettingLinux.SetProxy(Global.Loopback, port, exceptions);
break; break;
case ESysProxyType.ForcedChange when Utils.IsOSX(): case ESysProxyType.ForcedChange when Utils.IsMacOS():
await ProxySettingOSX.SetProxy(Global.Loopback, port, exceptions); await ProxySettingOSX.SetProxy(Global.Loopback, port, exceptions);
break; break;
@ -45,7 +45,7 @@ public static class SysProxyHandler
await ProxySettingLinux.UnsetProxy(); await ProxySettingLinux.UnsetProxy();
break; break;
case ESysProxyType.ForcedClear when Utils.IsOSX(): case ESysProxyType.ForcedClear when Utils.IsMacOS():
await ProxySettingOSX.UnsetProxy(); await ProxySettingOSX.UnsetProxy();
break; break;

View file

@ -67,7 +67,7 @@ public class CoreAdminManager
try try
{ {
var shellFileName = Utils.IsOSX() ? Global.KillAsSudoOSXShellFileName : Global.KillAsSudoLinuxShellFileName; var shellFileName = Utils.IsMacOS() ? Global.KillAsSudoOSXShellFileName : Global.KillAsSudoLinuxShellFileName;
var shFilePath = await FileUtils.CreateLinuxShellFile("kill_as_sudo.sh", EmbedUtils.GetEmbedText(shellFileName), true); var shFilePath = await FileUtils.CreateLinuxShellFile("kill_as_sudo.sh", EmbedUtils.GetEmbedText(shellFileName), true);
if (shFilePath.Contains(' ')) if (shFilePath.Contains(' '))
{ {

View file

@ -61,7 +61,7 @@ public partial class CoreConfigSingboxService
} }
var tunInbound = JsonUtils.Deserialize<Inbound4Sbox>(EmbedUtils.GetEmbedText(Global.TunSingboxInboundFileName)) ?? new Inbound4Sbox { }; var tunInbound = JsonUtils.Deserialize<Inbound4Sbox>(EmbedUtils.GetEmbedText(Global.TunSingboxInboundFileName)) ?? new Inbound4Sbox { };
tunInbound.interface_name = Utils.IsOSX() ? $"utun{new Random().Next(99)}" : "singbox_tun"; tunInbound.interface_name = Utils.IsMacOS() ? $"utun{new Random().Next(99)}" : "singbox_tun";
tunInbound.mtu = _config.TunModeItem.Mtu; tunInbound.mtu = _config.TunModeItem.Mtu;
tunInbound.auto_route = _config.TunModeItem.AutoRoute; tunInbound.auto_route = _config.TunModeItem.AutoRoute;
tunInbound.strict_route = _config.TunModeItem.StrictRoute; tunInbound.strict_route = _config.TunModeItem.StrictRoute;

View file

@ -313,7 +313,7 @@ public class UpdateService(Config config, Func<bool, string, Task> updateFunc)
_ => null, _ => null,
}; };
} }
else if (Utils.IsOSX()) else if (Utils.IsMacOS())
{ {
return RuntimeInformation.ProcessArchitecture switch return RuntimeInformation.ProcessArchitecture switch
{ {

View file

@ -511,7 +511,7 @@ public class MainWindowViewModel : MyReactiveObject
{ {
ProcUtils.ProcessStart("xdg-open", path); ProcUtils.ProcessStart("xdg-open", path);
} }
else if (Utils.IsOSX()) else if (Utils.IsMacOS())
{ {
ProcUtils.ProcessStart("open", path); ProcUtils.ProcessStart("open", path);
} }

View file

@ -504,7 +504,7 @@ public class StatusBarViewModel : MyReactiveObject
{ {
return AppManager.Instance.LinuxSudoPwd.IsNotEmpty(); return AppManager.Instance.LinuxSudoPwd.IsNotEmpty();
} }
else if (Utils.IsOSX()) else if (Utils.IsMacOS())
{ {
return AppManager.Instance.LinuxSudoPwd.IsNotEmpty(); return AppManager.Instance.LinuxSudoPwd.IsNotEmpty();
} }

View file

@ -26,7 +26,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
Height = sizeItem.Height; Height = sizeItem.Height;
var workingArea = (Screens.ScreenFromWindow(this) ?? Screens.Primary).WorkingArea; var workingArea = (Screens.ScreenFromWindow(this) ?? Screens.Primary).WorkingArea;
var scaling = (Utils.IsOSX() ? null : VisualRoot?.RenderScaling) ?? 1.0; var scaling = (Utils.IsMacOS() ? null : VisualRoot?.RenderScaling) ?? 1.0;
var x = workingArea.X + ((workingArea.Width - (Width * scaling)) / 2); var x = workingArea.X + ((workingArea.Width - (Width * scaling)) / 2);
var y = workingArea.Y + ((workingArea.Height - (Height * scaling)) / 2); var y = workingArea.Y + ((workingArea.Height - (Height * scaling)) / 2);

View file

@ -142,7 +142,7 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
tbAutoRunTip.IsVisible = false; tbAutoRunTip.IsVisible = false;
} }
else if (Utils.IsOSX()) else if (Utils.IsMacOS())
{ {
txbSettingsExceptionTip.IsVisible = false; txbSettingsExceptionTip.IsVisible = false;
panSystemProxyAdvanced.IsVisible = false; panSystemProxyAdvanced.IsVisible = false;