vb.net to c#

Stalker Riddick

Početnik
Poruka
10
Treba mi neko ko bi mogao ovo da prevede u c#
ja sam pokusavao ali mi ne ide od ruke :( tnx unapred


Kod:
Imports System.IO
Imports System.Environment
Imports System.Reflection
Imports System.Runtime.InteropServices


Public Class Form1

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim installpath As String = String.Empty
        installpath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\blizzard entertainment\world of warcraft", "installpath", Nothing)
        Dim fs As New FileStream(installpath & "realmlist.wtf", FileMode.Create, FileAccess.Write)
        Dim s As New StreamWriter(fs)
        s.WriteLine("set realmlist eu.logon.worldofwarcraft.com")
        s.Close()

        Dim ss As String = startgame("HKEY_LOCAL_MACHINE\SOFTWARE\blizzard entertainment\world of warcraft", "installpath", "WoW.exe")

        If ss <> String.Empty Then
            My.Settings.wow = ss
            My.Settings.Save()
        End If
    End Sub

    Private Function startgame(ByVal RegPath As String, ByVal RegValue As String, ByVal ExeFile As String) As String
        Dim retval
        Dim installpath As String = String.Empty
        installpath = My.Computer.Registry.GetValue(RegPath, RegValue, Nothing)
        If Directory.Exists(installpath) Then

            ChDir(installpath)
            retval = Shell(ExeFile, 1)
        Else
            With OpenFileDialog1
                .InitialDirectory = GetFolderPath(Environment.SpecialFolder.ProgramFiles)
                .Title = "Please Select " & ExeFile
                .Filter = "Windows Executable *.Exe|*.exe"
                .FileName = ExeFile
                If .ShowDialog() = Windows.Forms.DialogResult.OK Then
                    Process.Start(.FileName)
                    Return .FileName
                End If

                Me.Close()


            End With


        End If

        Return String.Empty
    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Environment.GetEnvironmentVariable("temp")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim installpath As String = String.Empty
        installpath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\blizzard entertainment\world of warcraft", "installpath", Nothing)
        If Directory.Exists(installpath & "/cache") Then
            Directory.Delete(installpath & "/cache", True)
            MsgBox("Cache deleted successfully")
        Else
            MsgBox("There is no cache")
        End If
    End Sub
End Class
 

Back
Top