可以来帮我解决这个错误吗?我是脚本新手 [英] Can comeone fix this errors for me? I am new in scripting

查看:69
本文介绍了可以来帮我解决这个错误吗?我是脚本新手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我解决这个错误吗?

这是代码:

命名空间Balkan_Elite_Launcher_BETA 
{
public partial class Form1:Form
}
public Form1()
{
InitializeComponent();
}

private void Start_Click(object sender,EventArgs e)
{
private void Form1_Load(object sender,EventArgs e)
{
string myRegistryKey = Registry.CurrentUser.OpenSubKey(@Software\\ SAMP)。GetValue(gta_sa_exe)。ToString();
myRegistryKey = myRegistryKey.Substring(0,myRegistryKey.LastIndexOf(@\)+ 1);
label1.Text = myRegistryKey +samp.exe;
textBox1.Text = Registry.CurrentUser.OpenSubKey(@Software\SAMP,true)。GetValue(PlayerName)。ToString();
if(!File.Exists(myRegistryKey +gta_sa.exe))
{
MessageBox.Show(Nije moguce pronaci GTA.exe u GTA folderu!\ n+ myRegistryKey +\ nPorvjerite da li ste odabrali pravi folder,ako jeste pokusajte ponovno instalirati GTA SA。,Greska,MessageBoxButtons.OK,MessageBoxIcon.Hand);
base.Close();
Application.Exit();
}
else if(!File.Exists(myRegistryKey +samp.exe))
{
MessageBox.Show(Nije moguce pronaci samp.exe u GTA folderu: \ n+ myRegistryKey +\ nPokusajte ponovno instalirati samp ili Balkan Elite Launcher。,Greska,MessageBoxButtons.OK,MessageBoxIcon.Hand);
base.Close();
Application.Exit();
}
}

private void Pokreni_Click(对象发送者,EventArgs e)
{
string ServerIP =188.165.40.163:7777;
string SPHash =NbGWjfVeFdkDzjCym67lRw ==; // Tu pisete pw za svoj server
string GTAPath = Registry.CurrentUser.OpenSubKey(@Software\\ SAMP)。GetValue(gta_sa_exe)。ToString();
GTAPath = GTAPath.Substring(0,GTAPath.LastIndexOf(@\)+ 1);
else
{
Registry.CurrentUser.OpenSubKey(@Software\SAMP,true).SetValue(PlayerName,textBox1.Text);
Process.Start(GTAPath +samp.exe,ServerIP + SPHash);
}
}
}





如果你能告诉我我需要做什么。我是脚本新手。

错误:

1:{预期行:12

2:预期的班级,代表,枚举,界面或struct Line:14

3.预期的类,委托,枚举,接口或结构行:19

4.预期的类,委托,枚举,接口或结构行:21

5.预期课程,代表,枚举,界面或结构线路:41



我尝试过:



我用谷歌搜索了它,花了我一个小时但我没找到它。

解决方案

< blockquote>查看代码和错误消息。

如果双击错误消息,Visual Studio将直接带您到该行。看一下这个消息,它通常会很清楚地告诉你问题是什么,或者给你一个很好的线索!

从第一个开始:

 {预计行:12 

几乎可以肯定,这三者中间:

  public   partial   class  Form1:Form 
}
public Form1()

类定义需要一个开放的大括号,而不是一个紧密的大括号:

< pre lang =c#> public partial class Form1:Form
{
public Form1()

这可能会摆脱一些其他人也是如此,但只是继续做同样的事情。



BTW:这不是脚本 - 它是编码。 脚本完全是另一回事。


Quote:

错误:

1:{预期行:12



替换

<前lang =c#> 私人 void Start_Click( object sender,EventArgs e)
{
private void Form1_Load( object sender,EventArgs e)
{



with

  private   void  Start_Click( object  sender,EventArgs e)
{
}
private void Form1_Load( object sender,EventArgs e)
{


Hi, can someone fix this errors for me?
Here is code:

namespace Balkan_Elite_Launcher_BETA
{
    public partial class Form1 : Form
    }
        public Form1()
        {
            InitializeComponent();
        }

        private void Start_Click(object sender, EventArgs e)
        {
             private void Form1_Load(object sender, EventArgs e)
        {
        string myRegistryKey = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP").GetValue("gta_sa_exe").ToString();
        myRegistryKey = myRegistryKey.Substring(0, myRegistryKey.LastIndexOf(@"\") + 1);
        label1.Text = myRegistryKey + "samp.exe";
        textBox1.Text = Registry.CurrentUser.OpenSubKey(@"Software\SAMP", true).GetValue("PlayerName").ToString();
        if (!File.Exists(myRegistryKey + "gta_sa.exe"))
        {
            MessageBox.Show("Nije moguce pronaci GTA.exe u GTA folderu!\n" + myRegistryKey + "\nPorvjerite da li ste odabrali pravi folder, ako jeste pokusajte ponovno instalirati GTA SA.", "Greska", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            base.Close();
            Application.Exit();
        }
        else if (!File.Exists(myRegistryKey + "samp.exe"))
        {
            MessageBox.Show("Nije moguce pronaci samp.exe u GTA folderu:\n" + myRegistryKey + "\nPokusajte ponovno instalirati samp ili Balkan Elite Launcher.", "Greska", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            base.Close();
            Application.Exit();
        }
    }
 
    private void Pokreni_Click(object sender, EventArgs e)
    {
        string ServerIP = "188.165.40.163:7777 ";
        string SPHash = "NbGWjfVeFdkDzjCym67lRw=="; //Tu pisete pw za svoj server
        string GTAPath = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP").GetValue("gta_sa_exe").ToString();
        GTAPath = GTAPath.Substring(0, GTAPath.LastIndexOf(@"\") + 1);
        else
        {
            Registry.CurrentUser.OpenSubKey(@"Software\SAMP", true).SetValue("PlayerName", textBox1.Text);
            Process.Start(GTAPath + "samp.exe", ServerIP + SPHash);
        }
    }
        }



If you can tell me what i need to do. Im new in scripting.
Errors:
1: { expected Line: 12
2: Expected class, delegate, enum, interface, or struct Line: 14
3. Expected class, delegate, enum, interface, or struct Line: 19
4. Expected class, delegate, enum, interface, or struct Line: 21
5. Expected class, delegate, enum, interface, or struct Line: 41

What I have tried:

I googled it and it took me an hour but i didnt find it.

解决方案

Look at your code, and at the error messages.
If you double click on an error message, Visual Studio will take you directly to the line. Look at the message, and it normally tells you fairly clearly what the problem is, or gives you a pretty good clue!
Start with the first:

{ expected Line: 12

Almost certainly that's the middle of these three:

public partial class Form1 : Form
}
    public Form1()

Class definitions need an open curly bracket, not a close curly bracket:

public partial class Form1 : Form
{
    public Form1()

That will probably get rid of some others as well, but just continue doing the same thing.

BTW: It's not "scripting" - it's coding. "Scripting" is another thing altogether.


Quote:

Errors:
1: { expected Line: 12


Replace

private void Start_Click(object sender, EventArgs e)
{
     private void Form1_Load(object sender, EventArgs e)
{


with

private void Start_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{


这篇关于可以来帮我解决这个错误吗?我是脚本新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆