Bir düğmeye basarak geçerli tarih ve saat ile sistem geri yükleme noktası oluşturmanın bir yolunu arıyorum. Bunu yapmak için web'de arama yapmayı denedim ancak henüz bir tane bulamadım.Sistem geri yükleme noktası nasıl programlanır?
Bu kod parçacığını şu adresten buldum: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378847%28v=vs.85%29.aspx ama VB'de değil, C# de, biraz dönüştürmeyi denedim ama çevirmeyi harika bir iş yapıyorum sanmıyorum.
Dim restPoint = GetObject("winmgmts:\\.\root\default:Systemrestore")
If restPoint IsNot Nothing Then
If restPoint.CreateRestorePoint("test restore point", 0, 100) = 0 Then
MsgBox("Restore Point created successfully")
Else
MsgBox("Could not create restore point!")
End If
End If
C# için "tercüme" kolay olmalı:
'CreateRestorePoint Method of the SystemRestore Class
'Creates a restore point. Specifies the beginning and
'the ending of a set of changes so that System Restore
'can create a restore point.This method is the
'scriptable equivalent of the SRSetRestorePoint function.
Set Args = wscript.Arguments
If Args.Count() > 0 Then
RpName = Args.item(0)
Else
RpName = "Vbscript"
End If
Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
If (obj.CreateRestorePoint(RpName, 0, 100)) = 0 Then
wscript.Echo "Success"
Else
wscript.Echo "Failed"
End If
Ayrıca şu soruya da bakınız: http://stackoverflow.com/questions/32845/creating-system-restore-points-thoughts – M4N