private static int GetSysTrayWnd() { int rtInit = 0; try { OSName version = OS.GetVersion(); int num = Windows.FindWindow("Shell_TrayWnd", null); num = Windows.FindWindowEx(num, 0, "TrayNotifyWnd", null); if (version != OSName.Win2000 && version != OSName.WinXP && version != OSName.Win2003 && version != OSName.Win7) { return(num); } if (version == OSName.Win2000) { return(Windows.FindWindowEx(num, 0, "ToolbarWindow32", null)); } num = Windows.FindWindowEx(num, 0, "SysPager", null); rtInit = Windows.FindWindowEx(num, 0, "ToolbarWindow32", null); } catch (Exception ex) { LogManage.WriteLog(typeof(SysTray), ex); } return(rtInit); }
public void CheckOSName() { OSName winObj = new OSName("WINDOWS"); OSName winProp = OSName.Windows; OSName randomObj = new OSName("random"); OSName defaultObj = default(OSName); OSName conObj = new OSName(); Assert.Throws<ArgumentNullException>(() => { OSName nullObj = new OSName(null); }); Assert.Throws<ArgumentException>(() => { OSName emptyObj = new OSName(""); }); Assert.True(winObj == winProp); Assert.True(winObj != randomObj); Assert.True(defaultObj == conObj); Assert.False(winObj == defaultObj); Assert.False(winObj == randomObj); Assert.False(winObj != winProp); Assert.True(winObj.Equals(winProp)); Assert.True(conObj.Equals(defaultObj)); Assert.False(defaultObj.Equals(winProp)); Assert.False(winObj.Equals(null)); Assert.False(winObj.Equals("something")); Assert.Equal("WINDOWS", winObj.ToString()); Assert.Equal("WINDOWS", winProp.ToString()); Assert.Equal("", defaultObj.ToString()); Assert.Equal("", conObj.ToString()); Assert.Equal("random", randomObj.ToString()); Assert.Equal(winObj.GetHashCode(), winProp.GetHashCode()); Assert.Equal(0, defaultObj.GetHashCode()); Assert.Equal(defaultObj.GetHashCode(), conObj.GetHashCode()); }
/// <summary>刷新</summary> public void Init() { var osv = Environment.OSVersion; if (OSVersion.IsNullOrEmpty()) { OSVersion = osv.Version + ""; } if (OSName.IsNullOrEmpty()) { OSName = (osv + "").TrimStart("Microsoft").TrimEnd(OSVersion).Trim(); } if (Guid.IsNullOrEmpty()) { Guid = ""; } try { #if __CORE__ if (Runtime.Windows) { LoadWindowsInfo(); } else if (Runtime.Linux) { LoadLinuxInfo(); } #else if (Runtime.Windows) { LoadWindowsInfoFx(); } else if (Runtime.Linux) { LoadLinuxInfo(); } #endif } catch (Exception ex) { XTrace.WriteException(ex); } // window+netcore 不方便读取注册表,随机生成一个guid,借助文件缓存确保其不变 if (Guid.IsNullOrEmpty()) { Guid = "0-" + System.Guid.NewGuid().ToString(); } if (UUID.IsNullOrEmpty()) { UUID = "0-" + System.Guid.NewGuid().ToString(); } try { Refresh(); } catch { } }
private static Type GetImplementationOf <T>(OSName currentPlatform) { var types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(_ => _.GetTypes()); foreach (var t in types) { if (t.IsInterface || t.IsAbstract) { continue; } else { var attr = t.GetCustomAttribute <PlatformImplementationAttribute>(); if (attr != null) { if (typeof(T).IsAssignableFrom(t) || t.IsInstanceOfType(typeof(T))) { if (attr.Platform == currentPlatform) { return(t); } } } } } throw new PlatformNotSupportedException(); }
//取得系统托盘窗口的句柄 private static int GetSysTrayWnd() { OSName osn = OS.GetVersion(); int k = Windows.FindWindow("Shell_TrayWnd", null); k = Windows.FindWindowEx(k, 0, "TrayNotifyWnd", null); if (osn == OSName.Win2000 || osn == OSName.WinXP || osn == OSName.Win2003) { if (osn == OSName.Win2000) { k = Windows.FindWindowEx(k, 0, "ToolbarWindow32", null); return(k); } else { k = Windows.FindWindowEx(k, 0, "SysPager", null); k = Windows.FindWindowEx(k, 0, "ToolbarWindow32", null); return(k); } } else { return(k); } }
public void CheckOSName() { OSName winObj = new OSName("WINDOWS"); OSName winProp = OSName.Windows; OSName randomObj = new OSName("random"); OSName defaultObj = default(OSName); OSName conObj = new OSName(); Assert.Throws <ArgumentNullException>(() => { OSName nullObj = new OSName(null); }); Assert.Throws <ArgumentException>(() => { OSName emptyObj = new OSName(""); }); Assert.True(winObj == winProp); Assert.True(winObj != randomObj); Assert.True(defaultObj == conObj); Assert.False(winObj == defaultObj); Assert.False(winObj == randomObj); Assert.False(winObj != winProp); Assert.True(winObj.Equals(winProp)); Assert.True(conObj.Equals(defaultObj)); Assert.False(defaultObj.Equals(winProp)); Assert.False(winObj.Equals(null)); Assert.False(winObj.Equals("something")); Assert.Equal("WINDOWS", winObj.ToString()); Assert.Equal("WINDOWS", winProp.ToString()); Assert.Equal("", defaultObj.ToString()); Assert.Equal("", conObj.ToString()); Assert.Equal("random", randomObj.ToString()); Assert.Equal(winObj.GetHashCode(), winProp.GetHashCode()); Assert.Equal(0, defaultObj.GetHashCode()); Assert.Equal(defaultObj.GetHashCode(), conObj.GetHashCode()); }
/// <summary> /// Replace place-holders in url with values from this service /// </summary> /// <param name="url">Url to replace</param> /// <returns>Replaced url</returns> public string ReplaceUrl(string url) { return(url.Replace("###IPADDRESS###", LocalIPAddressString.UrlEncode()) .Replace("###REMOTEIPADDRESS###", RemoteIPAddressString.UrlEncode()) .Replace("###MACHINENAME###", FQDN.UrlEncode()) .Replace("###VERSION###", Version.UrlEncode()) .Replace("###GUID###", MachineGuid.UrlEncode()) .Replace("###OSNAME###", OSName.UrlEncode()) .Replace("###OSVERSION###", OSVersion.UrlEncode())); }
public static IEntryPointSearcher EntryPointSearcher(OSName osName) { switch (osName) { case OSName.Windows: return(new WinEntryPointSearcher()); default: throw new NotImplementedException($"Not find EntryPointSearcher for os '{osName}"); } }
public override int GetHashCode() { unchecked { var hashCode = ProcessorCount; hashCode = (hashCode * 397) ^ TotalPhysicalMemory.GetHashCode(); hashCode = (hashCode * 397) ^ (CommandLine?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessId?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Architecture?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OSName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OSVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (IpAddress?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (MachineName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (InstallId?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RuntimeVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Data?.GetCollectionHashCode() ?? 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = ProcessorCount; hashCode = (hashCode * 397) ^ TotalPhysicalMemory.GetHashCode(); hashCode = (hashCode * 397) ^ (CommandLine == null ? 0 : CommandLine.GetHashCode()); hashCode = (hashCode * 397) ^ (ProcessName == null ? 0 : ProcessName.GetHashCode()); hashCode = (hashCode * 397) ^ (ProcessId == null ? 0 : ProcessId.GetHashCode()); hashCode = (hashCode * 397) ^ (Architecture == null ? 0 : Architecture.GetHashCode()); hashCode = (hashCode * 397) ^ (OSName == null ? 0 : OSName.GetHashCode()); hashCode = (hashCode * 397) ^ (OSVersion == null ? 0 :OSVersion.GetHashCode()); hashCode = (hashCode * 397) ^ (IpAddress == null ? 0 : IpAddress.GetHashCode()); hashCode = (hashCode * 397) ^ (MachineName == null ? 0 : MachineName.GetHashCode()); hashCode = (hashCode * 397) ^ (InstallId == null ? 0 : InstallId.GetHashCode()); hashCode = (hashCode * 397) ^ (RuntimeVersion == null ? 0 : RuntimeVersion.GetHashCode()); hashCode = (hashCode * 397) ^ (Data == null ? 0 : Data.GetCollectionHashCode()); return(hashCode); } }
internal static string GetExe() { bool Is64 = Environment.Is64BitOperatingSystem; string exe = Is64 ? WIN10.X64 : WIN10.X32; OSName system = OSInfoTool.Caption(); switch (system) { case OSName.WindowsXP: exe = Is64 ? XP.X64 : XP.X32; break; case OSName.Windows7: exe = Is64 ? WIN7.X64 : WIN7.X32; break; case OSName.Windows8Or81: exe = Is64 ? WIN8.X64 : WIN8.X32; break; case OSName.Windows10: exe = Is64 ? WIN10.X64 : WIN10.X32; break; } string file = DirTool.Combine(AppDomain.CurrentDomain.BaseDirectory, Root, exe); return(file); }
/// <summary>刷新</summary> public void Init() { var machine_guid = ""; #if __CORE__ var osv = Environment.OSVersion; if (OSVersion.IsNullOrEmpty()) { OSVersion = osv.Version + ""; } if (OSName.IsNullOrEmpty()) { OSName = (osv + "").TrimStart("Microsoft").TrimEnd(OSVersion).Trim(); } if (Guid.IsNullOrEmpty()) { Guid = ""; } if (Runtime.Windows) { var str = ""; var os = ReadWmic("os", "Caption", "Version"); if (os != null) { if (os.TryGetValue("Caption", out str)) { OSName = str.TrimStart("Microsoft").Trim(); } if (os.TryGetValue("Version", out str)) { OSVersion = str; } } var csproduct = ReadWmic("csproduct", "Name", "UUID"); if (csproduct != null) { if (csproduct.TryGetValue("Name", out str)) { Product = str; } if (csproduct.TryGetValue("UUID", out str)) { UUID = str; } } // 不要在刷新里面取CPU负载,因为运行wmic会导致CPU负载很不准确,影响测量 var cpu = ReadWmic("cpu", "Name", "ProcessorId", "LoadPercentage"); if (cpu != null) { if (cpu.TryGetValue("Name", out str)) { Processor = str; } if (cpu.TryGetValue("ProcessorId", out str)) { CpuID = str; } if (cpu.TryGetValue("LoadPercentage", out str)) { CpuRate = (Single)(str.ToDouble() / 100); } } // 从注册表读取 MachineGuid str = Execute("reg", @"query HKLM\SOFTWARE\Microsoft\Cryptography /v MachineGuid"); if (!str.IsNullOrEmpty() && str.Contains("REG_SZ")) { Guid = str.Substring("REG_SZ", null).Trim(); } } // 特别识别Linux发行版 else if (Runtime.Linux) { var str = GetLinuxName(); if (!str.IsNullOrEmpty()) { OSName = str; } // 树莓派优先 Model var dic = ReadInfo("/proc/cpuinfo"); if (dic != null) { if (dic.TryGetValue("Model", out str) || dic.TryGetValue("Hardware", out str) || dic.TryGetValue("cpu model", out str) || dic.TryGetValue("model name", out str)) { Processor = str; } if (dic.TryGetValue("Serial", out str)) { CpuID = str; } } var mid = "/etc/machine-id"; if (!File.Exists(mid)) { mid = "/var/lib/dbus/machine-id"; } if (File.Exists(mid)) { Guid = File.ReadAllText(mid).Trim(); } var file = "/sys/class/dmi/id/product_uuid"; if (File.Exists(file)) { UUID = File.ReadAllText(file).Trim(); } file = "/sys/class/dmi/id/product_name"; if (File.Exists(file)) { Product = File.ReadAllText(file).Trim(); } var dmi = Execute("dmidecode")?.SplitAsDictionary(":", "\n"); if (dmi != null) { if (dmi.TryGetValue("ID", out str)) { CpuID = str.Replace(" ", null); } if (dmi.TryGetValue("UUID", out str)) { UUID = str; } if (dmi.TryGetValue("Product Name", out str)) { Product = str; } //if (TryFind(dmi, new[] { "Serial Number" }, out str)) Guid = str; } } #else //// 性能计数器的初始化非常耗时 //Task.Factory.StartNew(() => //{ // try // { // _cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total") // { // MachineName = "." // }; // _cpuCounter.NextValue(); // } // catch // { // _cpuCounter = null; // } //}); var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Cryptography"); if (reg != null) { machine_guid = reg.GetValue("MachineGuid") + ""; } if (machine_guid.IsNullOrEmpty()) { reg = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); if (reg != null) { machine_guid = reg.GetValue("MachineGuid") + ""; } } var ci = new ComputerInfo(); OSName = ci.OSFullName.TrimStart("Microsoft").Trim(); OSVersion = ci.OSVersion; Memory = ci.TotalPhysicalMemory; _cinfo = ci; Processor = GetInfo("Win32_Processor", "Name"); CpuID = GetInfo("Win32_Processor", "ProcessorId"); UUID = GetInfo("Win32_ComputerSystemProduct", "UUID"); Product = GetInfo("Win32_ComputerSystemProduct", "Name"); // 读取主板温度,不太准。标准方案是ring0通过IOPort读取CPU温度,太难在基础类库实现 var str = GetInfo("Win32_TemperatureProbe", "CurrentReading"); if (!str.IsNullOrEmpty()) { Temperature = str.ToDouble(); } else { str = GetInfo("MSAcpi_ThermalZoneTemperature", "CurrentTemperature"); if (!str.IsNullOrEmpty()) { Temperature = (str.ToDouble() - 2732) / 10.0; } } #endif if (!machine_guid.IsNullOrEmpty()) { Guid = machine_guid; } // window+netcore 不方便读取注册表,随机生成一个guid,借助文件缓存确保其不变 if (Guid.IsNullOrEmpty()) { Guid = "0-" + System.Guid.NewGuid().ToString(); } if (UUID.IsNullOrEmpty()) { UUID = "0-" + System.Guid.NewGuid().ToString(); } Refresh(); }
public static bool IsOperatingSystem(OSName osName) { return(OSName.Windows == osName); }
public static OSName GetVersion() { OSName result = default(OSName); try { OSVERSIONINFO oSVERSIONINFO = default(OSVERSIONINFO); oSVERSIONINFO.dwOSVersionInfoSize = (uint)Marshal.SizeOf(oSVERSIONINFO); if (OS.GetVersionEx(ref oSVERSIONINFO)) { if (oSVERSIONINFO.dwPlatformId == 2u) { switch (oSVERSIONINFO.dwMajorVersion) { case 3u: result = OSName.WinNT3; break; case 4u: result = OSName.WinNT4; break; case 5u: switch (oSVERSIONINFO.dwMinorVersion) { case 0u: result = OSName.Win2000; break; case 1u: result = OSName.WinXP; break; case 2u: result = OSName.Win2003; break; default: result = OSName.UNKNOWN; break; } break; case 6u: result = OSName.Win7; break; default: result = OSName.UNKNOWN; break; } } else { if (oSVERSIONINFO.dwMajorVersion == 4u) { uint dwMinorVersion = oSVERSIONINFO.dwMinorVersion; if (dwMinorVersion != 0u) { if (dwMinorVersion != 10u) { if (dwMinorVersion != 90u) { result = OSName.UNKNOWN; } else { result = OSName.WinME; } } else { result = OSName.Win98; } } else { result = OSName.Win95; } } else { result = OSName.UNKNOWN; } } } else { result = OSName.UNKNOWN; } } catch (Exception ex) { LogManage.WriteLog(typeof(OS), ex); } return(result); }
public static bool IsOperatingSystem(OSName osName) { return OSName.OSX == osName; }
public PlatformImplementationAttribute(OSName platform) { Platform = platform; }
private void LoadWindowsInfo() { #if NETCOREAPP //var machine_guid = ""; //var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Cryptography"); //if (reg != null) machine_guid = reg.GetValue("MachineGuid") + ""; //if (machine_guid.IsNullOrEmpty()) //{ // reg = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); // if (reg != null) machine_guid = reg.GetValue("MachineGuid") + ""; //} //var reg2 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"); //if (reg2 != null) //{ // OSName = reg2.GetValue("ProductName") + ""; // //OSVersion = reg2.GetValue("CurrentBuild") + ""; //} //Processor = GetInfo("Win32_Processor", "Name"); ////CpuID = GetInfo("Win32_Processor", "ProcessorId"); //var uuid = GetInfo("Win32_ComputerSystemProduct", "UUID"); //Product = GetInfo("Win32_ComputerSystemProduct", "Name"); //DiskID = GetInfo("Win32_DiskDrive", "SerialNumber"); //// UUID取不到时返回 FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF //if (!uuid.IsNullOrEmpty() && !uuid.EqualIgnoreCase("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", "00000000-0000-0000-0000-000000000000")) // UUID = uuid; ////// 可能因WMI导致读取UUID失败 ////if (UUID.IsNullOrEmpty()) ////{ //// var reg3 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"); //// if (reg3 != null) UUID = reg3.GetValue("ProductId") + ""; ////} //if (!machine_guid.IsNullOrEmpty()) Guid = machine_guid; #endif var str = ""; var os = ReadWmic("os", "Caption", "Version"); if (os != null) { if (os.TryGetValue("Caption", out str)) { OSName = str.TrimStart("Microsoft").Trim(); } if (os.TryGetValue("Version", out str)) { OSVersion = str; } } var csproduct = ReadWmic("csproduct", "Name", "UUID"); if (csproduct != null) { if (csproduct.TryGetValue("Name", out str)) { Product = str; } if (csproduct.TryGetValue("UUID", out str)) { UUID = str; } } var disk = ReadWmic("diskdrive", "serialnumber"); if (disk != null) { if (disk.TryGetValue("serialnumber", out str)) { DiskID = str?.Trim(); } } // 不要在刷新里面取CPU负载,因为运行wmic会导致CPU负载很不准确,影响测量 var cpu = ReadWmic("cpu", "Name", "ProcessorId", "LoadPercentage"); if (cpu != null) { if (cpu.TryGetValue("Name", out str)) { Processor = str; } //if (cpu.TryGetValue("ProcessorId", out str)) CpuID = str; if (cpu.TryGetValue("LoadPercentage", out str)) { CpuRate = (Single)(str.ToDouble() / 100); } } // 从注册表读取 MachineGuid str = Execute("reg", @"query HKLM\SOFTWARE\Microsoft\Cryptography /v MachineGuid"); if (!str.IsNullOrEmpty() && str.Contains("REG_SZ")) { Guid = str.Substring("REG_SZ", null).Trim(); } if (OSName.IsNullOrEmpty()) { OSName = RuntimeInformation.OSDescription.TrimStart("Microsoft").Trim(); } if (OSVersion.IsNullOrEmpty()) { OSVersion = Environment.OSVersion.Version.ToString(); } }
/// <summary>刷新</summary> public void Init() { #if __CORE__ var osv = Environment.OSVersion; if (OSVersion.IsNullOrEmpty()) { OSVersion = osv.Version + ""; } if (OSName.IsNullOrEmpty()) { OSName = (osv + "").TrimStart("Microsoft").TrimEnd(OSVersion).Trim(); } if (Guid.IsNullOrEmpty()) { Guid = ""; } if (Runtime.Windows) { var str = ""; var os = ReadWmic("os", "Caption", "Version"); if (os != null) { if (os.TryGetValue("Caption", out str)) { OSName = str.TrimStart("Microsoft").Trim(); } if (os.TryGetValue("Version", out str)) { OSVersion = str; } } var csproduct = ReadWmic("csproduct", "Name", "UUID"); if (csproduct != null) { if (csproduct.TryGetValue("Name", out str)) { Product = str; } if (csproduct.TryGetValue("UUID", out str)) { UUID = str; } } } // 特别识别Linux发行版 else if (Runtime.Linux) { var str = GetLinuxName(); if (!str.IsNullOrEmpty()) { OSName = str; } // 树莓派优先 Model var dic = ReadInfo("/proc/cpuinfo"); if (dic != null) { if (dic.TryGetValue("Model", out str) || dic.TryGetValue("Hardware", out str) || dic.TryGetValue("cpu model", out str) || dic.TryGetValue("model name", out str)) { Processor = str; } if (dic.TryGetValue("Serial", out str)) { CpuID = str; } } var mid = "/etc/machine-id"; if (!File.Exists(mid)) { mid = "/var/lib/dbus/machine-id"; } if (File.Exists(mid)) { Guid = File.ReadAllText(mid).Trim(); } var file = "/sys/class/dmi/id/product_uuid"; if (File.Exists(file)) { UUID = File.ReadAllText(file).Trim(); } file = "/sys/class/dmi/id/product_name"; if (File.Exists(file)) { Product = File.ReadAllText(file).Trim(); } var dmi = Execute("dmidecode")?.SplitAsDictionary(":", "\n"); if (dmi != null) { if (dmi.TryGetValue("ID", out str)) { CpuID = str.Replace(" ", null); } if (dmi.TryGetValue("UUID", out str)) { UUID = str; } if (dmi.TryGetValue("Product Name", out str)) { Product = str; } //if (TryFind(dmi, new[] { "Serial Number" }, out str)) Guid = str; } } #else // 性能计数器的初始化非常耗时 Task.Factory.StartNew(() => { _cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total") { MachineName = "." }; _cpuCounter.NextValue(); }); var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Cryptography"); if (reg != null) { Guid = reg.GetValue("MachineGuid") + ""; } if (Guid.IsNullOrEmpty()) { reg = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); if (reg != null) { Guid = reg.GetValue("MachineGuid") + ""; } } var ci = new ComputerInfo(); OSName = ci.OSFullName.TrimStart("Microsoft").Trim(); OSVersion = ci.OSVersion; Memory = ci.TotalPhysicalMemory; _cinfo = ci; Processor = GetInfo("Win32_Processor", "Name"); CpuID = GetInfo("Win32_Processor", "ProcessorId"); UUID = GetInfo("Win32_ComputerSystemProduct", "UUID"); Product = GetInfo("Win32_ComputerSystemProduct", "Name"); // 读取主板温度,不太准。标准方案是ring0通过IOPort读取CPU温度,太难在基础类库实现 var str = GetInfo("MSAcpi_ThermalZoneTemperature", "CurrentTemperature"); if (!str.IsNullOrEmpty()) { Temperature = (str.ToDouble() - 2732) / 10.0; } #endif Refresh(); }
/// <summary> /// 配置信息加载2(包含本地信息) /// </summary> /// <param name="clientConfigEntity"></param> private void AppconfigSetting_Part(ConferenceModel.ConferenceInfoWebService.ClientConfigEntity clientConfigEntity) { try { //本地个人笔记名称 Constant.LocalPersonalNoteFile = clientConfigEntity.LocalPersonalNoteFile; //ftp服务地址 Constant.ConferenceFtpWebAddressFront = clientConfigEntity.ConferenceFtpWebAddressFront; //语音文件上传目录 Constant.FtpServerceAudioName = clientConfigEntity.FtpServerceAudioName; //用户头像上传目录 Constant.FtpServercePersonImgName = clientConfigEntity.FtpServercePersonImgName; //智慧树新节点默认名称 Constant.TreeItemEmptyName = clientConfigEntity.TreeItemEmptyName; //录播文件存放地址 Constant.RecordFolderName = clientConfigEntity.RecordFolderName; //录播文件扩展名 Constant.RecordExtention = clientConfigEntity.RecordExtention; //上传的录制视频名称 Constant.ReacordUploadFileName = clientConfigEntity.ReacordUploadFileName; //触摸键盘设置区域(64) Constant.KeyboardSettingFile_64 = clientConfigEntity.KeyboardSettingFile_64; //触摸键盘设置区域(32) Constant.KeyboardSettingFile_32 = clientConfigEntity.KeyboardSettingFile_32; //ftp用户 Constant.FtpUserName = clientConfigEntity.FtpUserName; //ftp用户密码 Constant.FtpPassword = clientConfigEntity.FtpPassword; #region 本地完成(不依赖服务获取的信息) //本地ip获取 string strHostName = Dns.GetHostName(); Constant.LocalIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString(); //获取屏幕分辨率 System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.PrimaryScreen; //获取宽度 Constant.FirstRunScreenWidth = screen.Bounds.Width; //获取高度 Constant.FirstRunScreenHeight = screen.Bounds.Height; OSName osName = OS.GetVersion(); if (osName == OSName.Win7) { Constant.RouteIp = System.Configuration.ConfigurationManager.AppSettings["DnsFirst_Win7"]; } else { Constant.RouteIp = System.Configuration.ConfigurationManager.AppSettings["DnsFirst_Other"]; } #endregion } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
public OperatingSystems(OSName name) //,Texture2D icon) { Name = name; }
public static bool IsOperatingSystem(OSName osName) { return(OSName.Linux == osName); }