Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -22,6 +22,7 @@
*/
using System;
using System.Reflection;
#if !FIRST_PASS
using java.lang.management;
#endif
@@ -105,6 +106,29 @@ static class Java_sun_management_MemoryImpl
static class Java_sun_management_OperatingSystemImpl
{
private static long getComputerInfo(string property){
#pragma warning disable 618
Assembly asm = Assembly.LoadWithPartialName("Microsoft.VisualBasic");
#pragma warning restore 618
if (asm != null)
{
Type type = asm.GetType("Microsoft.VisualBasic.Devices.ComputerInfo");
if (type != null)
{
try
{
ulong result = (ulong)type.GetProperty(property).GetValue(Activator.CreateInstance(type), null);
return (long)result;
}
catch (TargetInvocationException)
{
// Mono does not implement this property
}
}
}
throw new System.NotImplementedException();
}
public static long getCommittedVirtualMemorySize0(object _this)
{
throw new System.NotImplementedException();
@@ -127,12 +151,12 @@ static class Java_sun_management_OperatingSystemImpl
public static long getFreePhysicalMemorySize(object _this)
{
throw new System.NotImplementedException();
return getComputerInfo("AvailablePhysicalMemory");
}
public static long getTotalPhysicalMemorySize(object _this)
{
throw new System.NotImplementedException();
return getComputerInfo("TotalPhysicalMemory");
}
public static double getSystemCpuLoad(object _this)

File diff suppressed because it is too large Load Diff