public void Test_SysUtils() { #if __MonoCS__ Assert.IsTrue(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Unix, SysUtils.GetPlatformID()); Assert.IsFalse(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreNotEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #else Assert.IsFalse(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Win32NT, SysUtils.GetPlatformID()); Assert.IsTrue(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #endif // Assert.IsTrue(SysUtils.IsUnicodeEncoding(Encoding.UTF8)); Assert.IsFalse(SysUtils.IsUnicodeEncoding(Encoding.ASCII)); // Assembly asm = this.GetType().Assembly; var attr1 = SysUtils.GetAssemblyAttribute <AssemblyTitleAttribute>(asm); Assert.IsNotNull(attr1); Assert.AreEqual("GKTests", attr1.Title); Assert.Throws(typeof(ArgumentNullException), () => { SysUtils.GetAssemblyAttribute <AssemblyTitleAttribute>(null); }); }
public static void CheckUpdate() { try { #if __MonoCS__ DesktopType desktopType = SysUtils.GetDesktopType(); if (desktopType == DesktopType.Unity) { // In Ubuntu 1604 LTS (Unity desktop), this method leads to a // complete crash of the program at the level of X11, // but in the same version of Ubuntu and Xfce, everything is fine Logger.LogWrite("UpdateMan.CheckUpdate(): is not supported for Unity"); return; } #endif Thread worker = new Thread(WorkerMethod); worker.SetApartmentState(ApartmentState.STA); worker.IsBackground = true; worker.Start(); } catch (Exception ex) { Logger.LogWrite("UpdateMan.CheckUpdate(): " + ex.Message); } }
public void Test_SysUtils() { #if __MonoCS__ Assert.IsTrue(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Unix, SysUtils.GetPlatformID()); Assert.IsFalse(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreNotEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #else Assert.IsFalse(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Win32NT, SysUtils.GetPlatformID()); Assert.IsTrue(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #endif }