.net framework in Jade

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

.net framework in Jade

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:27 pm

by Didier >> Tue, 21 Apr 2009 9:05:52 GMT

Hi:
In VS2008, we can use the following logic to get the last HardDisk Id ============================================================================================= using System;
using System.Management;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write( "Hard Disk Id:" + this.GetDiskID() );
}

public string GetDiskID()
{
try
{
//get hard disk Id
String HDid = "";
ManagementClass mc = new ManagementClass("Win32_DiskDrive");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
HDid = (string)mo.Properties["Model"].Value;
}
moc = null;
mc = null;
return HDid;
}
catch
{
return "unknow";
}
finally
{
}
}
} ================================================================================================ After import the System.Management component into Jade.
How to get the HardDisk Id in Jade ?

Is possible get hard disk id using the imported component jade class ?

If can, please show me the example in jade.

Appreciate for any help.

Didier
2009.4.21

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: .net framework in Jade

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:27 pm

by Didier >> Thu, 23 Apr 2009 4:01:07 GMT

Hi:
this option written in jade with imported .net component as following: ==================================================================================== vars
hdId : String ;
mc : ManagementClass ;
moc : ManagementObjectCollection ;

mp : ManagementPath ;
mo : ManagementObject ;
moe : ManagementObjectEnumerator ;
name1 : StringUtf8 ;begin

hdId := "";
create mc ;
create mp ;
create moc ;
name1 := "Model" ;
mp.path := "Win32_DiskDrive" ;
mc.path_2 := mp ;

moc := mc.getInstances();

moe := moc.getEnumerator() ;
while moe.moveNext() do
mo := moe.current.ManagementObject ;
write mo.getPropertyValue_1( name1 ) ;
endwhile ;
epilog
delete mo ;
delete mp ;
delete moc ;
delete mc ;
end; =========================================================================== Attation: the mo.getPropertyValue_1 must modify as following
change return value form JadeDotNetType to Any. -------------------------------------------------------------------------- getPropertyValue_1(propertyName:StringUtf8):Any updating;
//begin


return jadeDotNetMethod('GetPropertyValue', propertyName);//.JadeDotNetType;

end;

---------------------------------------------------------------------------


Return to “General Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 12 guests