<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Eto
{
	/// <summary>
	/// Operating system platform information
	/// </summary>
	/// <remarks>
	/// Access this information from <see cref="EtoEnvironment.Platform"/>
	/// </remarks>
	public sealed class OperatingSystemPlatform
	{
		/// <summary>
		/// Gets a value indicating that the current .NET runtime is mono
		/// </summary>
		public bool IsMono { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is windows system
		/// </summary>
		public bool IsWindows { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is a unix-based system
		/// </summary>
		/// <remarks>
		/// This will be true for both Unix (e.g. OS X) and all Linux variants.
		/// </remarks>
		public bool IsUnix { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is a Mac OS X system
		/// </summary>
		public bool IsMac { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is a Linux system
		/// </summary>
		public bool IsLinux { get; private set; }

		[DllImport ("libc")]
		static extern int uname (IntPtr buf);

		static string GetUnixType ()
		{
			IntPtr buf = IntPtr.Zero;
			string osName = "";
			try {
				buf = Marshal.AllocHGlobal (8192);
				if (uname (buf) == 0)
					osName = Marshal.PtrToStringAnsi (buf);
			}
			catch {
			}
			finally {
				if (buf != IntPtr.Zero)
					Marshal.FreeHGlobal (buf);
			}
			return osName;

		}

		/// <summary>
		/// Initializes a new instance of the OperatingSystemPlatform class
		/// </summary>
		public OperatingSystemPlatform ()
		{
			if (Type.GetType ("Mono.Runtime", false) != null)
				IsMono = true;

			switch (System.Environment.OSVersion.Platform) {
			case PlatformID.MacOSX:
				IsMac = true;
				IsUnix = true;
				break;
			case PlatformID.Unix:
				IsUnix = true;
				switch (GetUnixType ().ToLowerInvariant ()) {
				case "darwin": IsMac = true; break;
				case "linux": IsLinux = true; break;
				}
				break;
			default:
			case PlatformID.Win32NT:<commit_msg>Mac: Fix detecting mono runtime when using Xamarin.Mac linker by testing for additional type<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Eto
{
	/// <summary>
	/// Operating system platform information
	/// </summary>
	/// <remarks>
	/// Access this information from <see cref="EtoEnvironment.Platform"/>
	/// </remarks>
	public sealed class OperatingSystemPlatform
	{
		/// <summary>
		/// Gets a value indicating that the current .NET runtime is mono
		/// </summary>
		public bool IsMono { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is windows system
		/// </summary>
		public bool IsWindows { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is a unix-based system
		/// </summary>
		/// <remarks>
		/// This will be true for both Unix (e.g. OS X) and all Linux variants.
		/// </remarks>
		public bool IsUnix { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is a Mac OS X system
		/// </summary>
		public bool IsMac { get; private set; }

		/// <summary>
		/// Gets a value indicating that the current OS is a Linux system
		/// </summary>
		public bool IsLinux { get; private set; }

		[DllImport ("libc")]
		static extern int uname (IntPtr buf);

		static string GetUnixType ()
		{
			IntPtr buf = IntPtr.Zero;
			string osName = "";
			try {
				buf = Marshal.AllocHGlobal (8192);
				if (uname (buf) == 0)
					osName = Marshal.PtrToStringAnsi (buf);
			}
			catch {
			}
			finally {
				if (buf != IntPtr.Zero)
					Marshal.FreeHGlobal (buf);
			}
			return osName;

		}

		/// <summary>
		/// Initializes a new instance of the OperatingSystemPlatform class
		/// </summary>
		public OperatingSystemPlatform ()
		{
			if (Type.GetType ("Mono.Runtime", false) != null || Type.GetType ("Mono.Interop.IDispatch", false) != null)
				IsMono = true;

			switch (System.Environment.OSVersion.Platform) {
			case PlatformID.MacOSX:
				IsMac = true;
				IsUnix = true;
				break;
			case PlatformID.Unix:
				IsUnix = true;
				switch (GetUnixType ().ToLowerInvariant ()) {
				case "darwin": IsMac = true; break;
				case "linux": IsLinux = true; break;
				}
				break;
			default:
			case PlatformID.Win32NT:
{'fraction_non_alphanumeric': 0.12898965441338323, 'fraction_numerical': 0.0030816640986132513, 'mean_word_length': 2.676375404530744, 'pattern_counts': {'":': 4, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6328349', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1402, 'n_words': 478}