/**
* Obtains the operating system information of the client. Currently, only Windows 7, WINXP, win2003, Win2000, Mac, WINNT, Linux, mac68k, and Win9x are matched.
* @ Param useragent request. getheader ("User-Agent") Return Value
* @ Return
*/
Public static string getclientos (string useragent)
{
String cos = "unknow OS ";
Pattern P = pattern. Compile (". * (Windows NT 6 \. 1 ).*");
Matcher M = P. matcher (useragent );
If (M. Find ())
{
Cos = "win 7 ";
Return cos;
}
P = pattern. Compile (". * (Windows NT 5 \. 1 | Windows XP ).*");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "WINXP ";
Return cos;
}
P = pattern. Compile (". * (Windows NT 5 \. 2 ).*");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "win2003 ";
Return cos;
}
P = pattern. Compile (". * (Win2000 | Windows 2000 | Windows NT 5 \. 0 ).*");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "Win2000 ";
Return cos;
}
P = pattern. Compile (". * (MAC | Apple | macos8 ).*");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "Mac ";
Return cos;
}
P = pattern. Compile (". * (winnt | Windows NT ).*");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "winnt ";
Return cos;
}
P = pattern. Compile (". * Linux .*");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "Linux ";
Return cos;
}
P = pattern. Compile (". * (68k | 68000 ).*");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "mac68k ";
Return cos;
}
P = pattern. compile (". * (9x 4.90 | win9 (5 | 8) | Windows 9 (5 | 8) | 95/NT | Win32 | 32bit ). *");
M = P. matcher (useragent );
If (M. Find ())
{
Cos = "Win9x ";
Return cos;
}
Return cos;
}