tbchwy, I don't fully understand this. Can you explain a bit more about what that does?Jeff;651749 said:Code:foreach( ManagementObject wmi_HD in searcher.Get() ) { Drive d = new Drive( wmi_HD ); m_Drivetable.Add( d.Model, d ); }
Code:public Drive( ManagementObject hdd) { m_BytesPerSector = ( uint )hdd["BytesPerSector"] ; m_DeviceID = ( string )hdd["DeviceID"] ; m_Index = ( uint )hdd["Index"] ; m_InterfaceType = ( string )hdd["InterfaceType"] ; m_Manufacturer = ( string )hdd["Manufacturer"] ; m_MediaType = ( string )hdd["MediaType"] ; m_Model = ( string )hdd["Model"] ; m_Name = ( string )hdd["Name"] ; m_Partitions = ( uint )hdd["Partitions"] ; m_SectorsPerTrack = ( uint )hdd["SectorsPerTrack"] ; m_Signature = ( uint )hdd["Signature"] ; m_Size = ( ulong )hdd["Size"] ; m_Status = ( string )hdd["Status"]; m_TotalCylinders = ( ulong )hdd["TotalCylinders"]; m_TotalHeads = ( uint )hdd["TotalHeads"]; m_MaxSectors = ( ulong )hdd["TotalSectors"]; m_TotalTracks = ( ulong )hdd["TotalTracks"]; }
Storm33229;652177 said:tbchwy, I don't fully understand this. Can you explain a bit more about what that does?
Jeff;652196 said:It just gets info about each Hard drive on the computer nothing more nothing less, but you can use this info for things like grabbing handles on the harddrive to read the raw sectors and such
Storm33229;652206 said:do you have to use both blocks of code? or just one or the other?
Jeff;652213 said:depends on what your doing, the 1st is kinda like a hashtable, and second is aquiring its values by using its keys :/
Storm33229;652223 said:so...confusing...*dies*
Uhh. Hashtables? =/Jeff;652241 said:about what?
Storm33229;652535 said:Uhh. Hashtables? =/
Jeff;652554 said:Dictionary<key, value> ? that better for you? same concept, but not type-casted.
Storm33229;652657 said:What's casted mean? Grr.. my programming books don't tell me these things. =/
public void Method( Mobile m )
{
if( m is PlayerMobile )//Check if m is of type PlayerMobile
{
PlayerMobile pm = (PlayerMobile)m;//Cast m as a PlayerMobile
pm.MethodTwo();
}
}