Over Active
به انجمن برنامه نویسی آور اکتیو خوش آمدید
برای لاگین یا رجیستر اقدام کنید.


Programming ~ C# ~ VB ~ C++ ~ DELPHI ~ JAVA ~ ANDROID ~ HTML ~ CSS
 
HomeSearchMemberlistUsergroupsRegisterLog in
Latest topics
» Update Bombus PVT Flood
by Guest 2014-04-06, 09:43

» Advertiser_v0_2_Bote_Tabligh
by Guest 2013-11-12, 04:11

» amozshe c# kar ba adbord by khatar...+18@N.C
by Guest 2013-09-20, 22:24

» 18 Team Id Remover Coded by khatar...+18@n.c
by Guest 2013-09-17, 17:19

» new soft Status ¢нαηgєя Coded by khatar...+18@n.c
by Guest 2013-09-16, 11:12

» salam har ki нα¢к andro dare ke kar bde lotfan bezare
by Guest 2013-09-15, 21:20

» ترفند جدید تماس گرفتن با نرم افزار بمبوس
by Guest 2013-09-14, 13:40

» Ger Room Users + New Hacked Android and Java v 1.0
by Guest 2013-09-14, 13:39

» WLC & JOK BOT LORDBUZZ BY k0r@N.C
by Guest 2013-09-14, 13:34

» emil har ki balade biad to
by Guest 2013-09-14, 13:32

» خریدی ایدی
by Guest 2013-09-11, 08:44

» LordBuzz TeaM Info ¢нαηgєя
by Guest 2013-09-01, 13:05

» Bot room jadid
by Guest 2013-09-01, 13:03

» empery flooder coded by amin-emperator bax red team
by Guest 2013-08-28, 06:49

» BomBotMod Plus+ [new, jokes, pa na pa , Wlc pm, pc & Mob soft ]
by Guest 2013-08-25, 09:03

» Full bot by wildbuzz Team
by Guest 2013-08-25, 08:46

» هك موبايل و كنترل خط و سوزاندن موبايل قربانى
by Guest 2013-08-23, 02:42

» مرورگری جدید و سریع بر پایه کروم, Torch Browser 25.0.0.3777
by Guest 2013-08-23, 02:35

» jokbot bY wildbuzz team
by Guest 2013-08-22, 20:41

» WildBuzz TeaM Info ¢нαηgєя
by Guest 2013-08-22, 20:38

Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Top posters
amin-emperator (106)
 
DARK (31)
 
Top posting users this week
Most Viewed Topics
empery flooder coded by amin-emperator bax red team
cod va xml nimbuzz
New Hacked Nimbuzz Android and Java Users
LordBuzz TeaM Info ¢нαηgєя
FreebuzZ PURSUIT Flooder New Version (2.0) | Bugs Fixed | Add + Pv + Room + Dc + Remote | New Options
BomBotMod Plus+ [new, jokes, pa na pa , Wlc pm, pc & Mob soft ]
RED TEAM ID CHECKER AND PASSWORD ¢нαηgєя V1.0 chand kare :D
Bot room jadid
soft yad Avari password faramosh shode
خریدی ایدی
Search
 
 

Display results as :
 
Rechercher Advanced Search

Share | 
 

  نکته های مفید سی شارپ

View previous topic View next topic Go down 
AuthorMessage
Guest
Guest



PostSubject: نکته های مفید سی شارپ   2013-06-23, 11:46

(CPU Id) بدست آوردن شماره سریال پراسسور 


 پروژه بیفزایید و سپس References رو به  System.Management ابتدا





Code:
using System.Management;


Code:
public string GetCPUId()[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
{[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
string cpuInfo = String.Empty;[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
//create an instance of the Managemnet class with the[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
//Win32_Processor class[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
ManagementClass mgmt = new ManagementClass("Win32_Processor");[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
//create a ManagementObjectCollection to loop through[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
ManagementObjectCollection objCol = mgmt.GetInstances();[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
//start our loop for all processors found[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
foreach (ManagementObject obj in objCol)[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
{[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
if (cpuInfo == String.Empty)[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
{[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
// only return cpuInfo from first CPU[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
cpuInfo = obj.Properties["ProcessorId"].Value.ToString();[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
}[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
}[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
return cpuInfo;[color=#000000][font=Tahoma, Calibri, Verdana, Geneva, sans-serif][i][/i][/font][/color]
}

DeSerialize کردن باینری آبجکت از فایل




PHP کد 



Code:
using System.IO; 
using System.Runtime.Serialization; 
using System.Runtime.Serialization.Formatters.Binary;  


PHP کد 



Code:
public object DeSerializeObject(string filename) 

    object o; 
    Stream stream = File.Open(filename, FileMode.Open); 
    BinaryFormatter bFormatter = new BinaryFormatter(); 
    o = 
       (ObjectToSerialize)bFormatter.Deserialize(stream); 
    stream.Close(); 
    return o; 
}  


 بدست آوردن میزان فضای خالی یک درایو


 using System.Management  پروژه بیفزایید و سپس  References  رو به  System.Management ابتدا





Code:
public double GetHDDFreeSpace(string drive) 

    //check to see if the user provided a drive letter 
    //if not default it to "C" 
    if (drive == "" || drive == null) 
    { 
        drive = "C"; 
    } 
    //create our ManagementObject, passing it the drive letter to the 
    //DevideID using WQL 
    ManagementObject disk = new ManagementObject("Win32_LogicalDisk.DeviceID=\"" + drive + ":\""); 
    //bind our management object 
    disk.Get(); 
    //return the free space amount 
    return Convert.ToDouble(disk["FreeSpace"]); 


Back to top Go down
 
نکته های مفید سی شارپ
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Over Active :: Programming :: C#.NET-
Jump to: