19 using Lucene.Net.Support;
22 namespace Lucene.Net.Util
33 public static readonly System.String JAVA_VERSION =
AppSettings.
Get(
"java.version",
"");
35 public static readonly
bool JAVA_1_1 = JAVA_VERSION.StartsWith(
"1.1.");
37 public static readonly
bool JAVA_1_2 = JAVA_VERSION.StartsWith(
"1.2.");
39 public static readonly
bool JAVA_1_3 = JAVA_VERSION.StartsWith(
"1.3.");
42 public static readonly System.String OS_NAME = GetEnvironmentVariable(
"OS",
"Windows_NT") ??
"Linux";
44 public static readonly
bool LINUX = OS_NAME.StartsWith(
"Linux");
46 public static readonly
bool WINDOWS = OS_NAME.StartsWith(
"Windows");
48 public static readonly
bool SUN_OS = OS_NAME.StartsWith(
"SunOS");
50 public static readonly System.String OS_ARCH = GetEnvironmentVariable(
"PROCESSOR_ARCHITECTURE",
"x86");
51 public static readonly System.String OS_VERSION = GetEnvironmentVariable(
"OS_VERSION",
"?");
52 public static readonly System.String JAVA_VENDOR =
AppSettings.
Get(
"java.vendor",
"");
61 private static System.String Ident(System.String s)
66 public static readonly System.String LUCENE_MAIN_VERSION = Ident(
"3.0.3");
68 public static System.String LUCENE_VERSION=
"8.8.8.8";
75 else if (IntPtr.Size == 4)
82 LUCENE_VERSION = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
84 catch (System.Security.SecurityException)
90 #region MEDIUM-TRUST Support
91 static string GetEnvironmentVariable(
string variable,
string defaultValueOnSecurityException)
95 if (variable ==
"OS_VERSION")
return System.Environment.OSVersion.ToString();
97 return System.Environment.GetEnvironmentVariable(variable);
99 catch (System.Security.SecurityException)
101 return defaultValueOnSecurityException;