source: branch/egtra-gdiplus/Classes/System/OperatingSystem.ab@ 711

Last change on this file since 711 was 237, checked in by イグトランス (egtra), 18 years ago

#_fullcompileで検出されたエラーの修正(明らかに判るもののみ)

File size: 2.1 KB
Line 
1' Classes/System/OperatingSystem.ab
2
3#ifndef __SYSYTEM_OPERATINGSYSTEM_AB__
4#define __SYSYTEM_OPERATINGSYSTEM_AB__
5
6#require <Classes/System/Version.ab>
7
8Class OperatingSystem
9 ' Inherits ICloneable', ISerializable
10Public
11 ' Constractor
12 Sub OperatingSystem(platform As PlatformID, version As Version)
13 pf = platform
14 ver = version
15 sp = ""
16 End Sub
17
18 Sub OperatingSystem(vi As OSVERSIONINFOA)
19 pf = vi.dwPlatformId As PlatformID
20 ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
21 sp = New String(vi.szCSDVersion As PCSTR)
22 End Sub
23
24 Sub OperatingSystem(vi As OSVERSIONINFOW)
25 pf = vi.dwPlatformId As PlatformID
26 ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
27 sp = New String(vi.szCSDVersion As PCSTR)
28 End Sub
29
30 ' Properties
31 Const Function Platform() As PlatformID
32 Return pf
33 End Function
34
35 Const Function Version() As Version
36 Return ver
37 End Function
38
39 Const Function ServicePack() As String
40 Return sp
41 End Function
42
43 Const Function VersionString() As String
44 Select Case pf
45 Case PlatformID.Win32S
46 VersionString = "Microsoft Win32S "
47 Case PlatformID.Win32Windows
48 VersionString = "Microsoft Windows "
49 Case PlatformID.Win32NT
50 VersionString = "Microsoft Windows NT "
51 Case PlatformID.WinCE
52 VersionString = "Microsoft Windows CE "
53 Case PlatformID.Unix
54 VersionString = "<unknown> "
55 End Select
56 VersionString = VersionString + ver.ToString
57 If String.IsNullOrEmpty(sp) <> False Then
58 VersionString = VersionString + " " + sp
59 End If
60 End Function
61
62 ' Methods
63 Override Function ToString() As String
64 Return VersionString
65 End Function
66
67 Override Function GetHashCode() As Long
68 Return pf.GetHashCode Xor ver.GetHashCode Xor sp.GetHashCode
69 End Function
70
71Private
72 pf As PlatformID
73 ver As Version
74 sp As String
75End Class
76
77Enum PlatformID
78 Win32S = VER_PLATFORM_WIN32s '0
79 Win32Windows = VER_PLATFORM_WIN32_WINDOWS '1
80 Win32NT = VER_PLATFORM_WIN32_NT '2
81 WinCE = VER_PLATFORM_WIN32_CE '3
82 Unix = 4
83End Enum
84
85#endif '__SYSYTEM_OPERATINGSYSTEM_AB__
Note: See TracBrowser for help on using the repository browser.