Can anyone help me to translate this to C# please?
Any help would be appreciated. -
Public Class Form1
-
-
Delegate Sub SetCloseCallback(ByVal closeform)
-
Private Sub SetClose(ByVal closeform)
-
-
If Me.InvokeRequired Then
-
Dim d As New SetCloseCallback(AddressOf SetClose)
-
Me.Invoke(d, New Object() {closeform})
-
Else
-
Me.Close()
-
End If
-
-
End Sub
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
'Start the worker to perform the operation
-
worker.RunWorkerAsync()
-
End Sub
-
-
Private Sub worker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles worker.DoWork
-
-
Dim wc As New WebClient()
-
Dim blah As Object = Nothing
-
Dim p As Process
-
Dim app As String = GetSetting("ACv2022", "Main", "AppName")
-
-
If app = "" Then app = "EvoSoft AC v2.exe"
-
-
For Each p In Process.GetProcesses
-
If p.MainWindowTitle.Equals("EvoSoft Anti-cheat") Then
-
p.Kill()
-
End If
-
Next
-
-
'Waiting for the client to close
-
Thread.Sleep(1000)
-
-
Try
-
'Remove old client
-
If File.Exists(Environment.CurrentDirectory & "\" & app) Then
-
File.Delete(Environment.CurrentDirectory & "\" & app)
-
End If
-
-
'Download new client
-
wc.DownloadFile("http://www.evosoft-acp.com/updater/client.exe", Environment.CurrentDirectory & "\" & app)
-
-
Process.Start(Environment.CurrentDirectory & "\" & app)
-
-
Catch ex As Exception
-
-
MessageBox.Show("An unknown error occured, please update the EvoSoft client manually.")
-
SetClose(blah)
-
-
End Try
-
-
SetClose(blah)
-
-
End Sub
-
-
End Class
-
Check out this free online tool: Convert C# to VB.NET & vice versa. It doesn't always work 100% but it's pretty good and you just have to do a bit of cleanup (for things like addhandler or lambda expressions).
It produced the following -
using System;
-
using System.Collections;
-
using System.Collections.Generic;
-
using System.Data;
-
using System.Diagnostics;
-
public class Form1
-
{
-
-
public delegate void SetCloseCallback(closeform);
-
private void SetClose(closeform)
-
{
-
-
if (this.InvokeRequired) {
-
SetCloseCallback d = new SetCloseCallback(SetClose);
-
this.Invoke(d, new object[] { closeform });
-
} else {
-
this.Close();
-
}
-
-
}
-
-
private void Form1_Load(System.Object sender, System.EventArgs e)
-
{
-
//Start the worker to perform the operation
-
worker.RunWorkerAsync();
-
}
-
-
private void worker_DoWork(System.Object sender, System.ComponentModel.DoWorkEventArgs e)
-
{
-
-
WebClient wc = new WebClient();
-
object blah = null;
-
Process p = null;
-
string app = Interaction.GetSetting("ACv2022", "Main", "AppName");
-
-
if (string.IsNullOrEmpty(app))
-
app = "EvoSoft AC v2.exe";
-
-
foreach (Process p_loopVariable in Process.GetProcesses()) {
-
p = p_loopVariable;
-
if (p.MainWindowTitle.Equals("EvoSoft Anti-cheat")) {
-
p.Kill();
-
}
-
}
-
-
//Waiting for the client to close
-
Thread.Sleep(1000);
-
-
try {
-
//Remove old client
-
if (File.Exists(Environment.CurrentDirectory + "\\" + app)) {
-
File.Delete(Environment.CurrentDirectory + "\\" + app);
-
}
-
-
//Download new client
-
wc.DownloadFile("http://www.evosoft-acp.com/updater/client.exe", Environment.CurrentDirectory + "\\" + app);
-
-
Process.Start(Environment.CurrentDirectory + "\\" + app);
-
-
} catch (Exception ex) {
-
-
MessageBox.Show("An unknown error occured, please update the EvoSoft client manually.");
-
SetClose(blah);
-
-
}
-
-
SetClose(blah);
-
-
}
-
public Form1()
-
{
-
Load += Form1_Load;
-
}
-
-
}
-Frinny
2 2219
Check out this free online tool: Convert C# to VB.NET & vice versa. It doesn't always work 100% but it's pretty good and you just have to do a bit of cleanup (for things like addhandler or lambda expressions).
It produced the following -
using System;
-
using System.Collections;
-
using System.Collections.Generic;
-
using System.Data;
-
using System.Diagnostics;
-
public class Form1
-
{
-
-
public delegate void SetCloseCallback(closeform);
-
private void SetClose(closeform)
-
{
-
-
if (this.InvokeRequired) {
-
SetCloseCallback d = new SetCloseCallback(SetClose);
-
this.Invoke(d, new object[] { closeform });
-
} else {
-
this.Close();
-
}
-
-
}
-
-
private void Form1_Load(System.Object sender, System.EventArgs e)
-
{
-
//Start the worker to perform the operation
-
worker.RunWorkerAsync();
-
}
-
-
private void worker_DoWork(System.Object sender, System.ComponentModel.DoWorkEventArgs e)
-
{
-
-
WebClient wc = new WebClient();
-
object blah = null;
-
Process p = null;
-
string app = Interaction.GetSetting("ACv2022", "Main", "AppName");
-
-
if (string.IsNullOrEmpty(app))
-
app = "EvoSoft AC v2.exe";
-
-
foreach (Process p_loopVariable in Process.GetProcesses()) {
-
p = p_loopVariable;
-
if (p.MainWindowTitle.Equals("EvoSoft Anti-cheat")) {
-
p.Kill();
-
}
-
}
-
-
//Waiting for the client to close
-
Thread.Sleep(1000);
-
-
try {
-
//Remove old client
-
if (File.Exists(Environment.CurrentDirectory + "\\" + app)) {
-
File.Delete(Environment.CurrentDirectory + "\\" + app);
-
}
-
-
//Download new client
-
wc.DownloadFile("http://www.evosoft-acp.com/updater/client.exe", Environment.CurrentDirectory + "\\" + app);
-
-
Process.Start(Environment.CurrentDirectory + "\\" + app);
-
-
} catch (Exception ex) {
-
-
MessageBox.Show("An unknown error occured, please update the EvoSoft client manually.");
-
SetClose(blah);
-
-
}
-
-
SetClose(blah);
-
-
}
-
public Form1()
-
{
-
Load += Form1_Load;
-
}
-
-
}
-Frinny
oke thanks for all the help Frinavale
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Numberwhun |
last post by:
Hello everyone! I am trying to learn java and have run into kind of a
snag. Here is the code that I have so far:
------ <begin_code> ----------
import javax.swing.*;
import...
|
by: Huang Lin |
last post by:
I want to query tables in different Database,such as Oracle,Db2,Sql Server£¬
etc.Give me some ideals,Please!
|
by: free2cric |
last post by:
Hi,
I attanded an interview on C++
Question asked were and my answers to them..
1. In a CPP program what does memory leak occure?
-- i said.. In a constructor , the pointer variables were...
|
by: Lues |
last post by:
Hi,
I'm trying to protect some data in tables with encription (you know why,
don't you ;))
I must confess that I'm not very expirienced in writing code, especially
encription code.
Can any...
|
by: albert_reade |
last post by:
Hello I was wondering if someone could please help me understand what I
need to do in order to get this project to work. I just need some hints
or a push in the right direction to get this to work,...
|
by: shapper |
last post by:
Hello,
I am creating a centered web site with various div's inside the main
(pBase) div.
Somehow, I am getting a gap on the top of my browser window both in IE
and Firefox.
I tried...
|
by: =?Utf-8?B?RW1tYSBIb3Bl?= |
last post by:
Hi All,
I need some advice please. I have very good knowledge of MS Access, Excel
etc, reasonable knowledge of VBA and some very basic knowledge of VB6 and
virtually non-existant knowledge of...
|
by: karafire2003 |
last post by:
I've been tasked to do 2 questions. I think i got the majority of it done, but i'm having trouble.
Question #1:
Write a C program that accepts as input from the keyboard a floating point number, an...
|
by: swanside |
last post by:
Hello all.
I am in the need of some help please.
I have an SQL statement that works on a MySQL Database, but I need to get it to work on an Access Database.
The statement is,
SELECT...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |