Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (CommandCreatorDialog dialog = new CommandCreatorDialog())
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    /* 
                     * Format: 0 = CommandName, 1 = CommandAuthor
                     * 2 = CommandType, 3 = CommandVersion, 4 = CommandPermission
                     */
                    string format = "using System;\n" +
                    "using MCForge.Interface.Command;\n" +
                    "   namespace {1} {{\n" +
                    "       public class Cmd{1} : ICommand {{\n" +
                    "           public string Name {{ get {{ return \"{0}\"; }} }} \n" +
                    "           public CommandTypes Type {{ get {{ return \"{2}\"; }} }} \n" +
                    "           public int Version {{ get {{ return {3}; }} }} \n" +
                    "           public string CUD {{ get {{ return \"Unimplemented\"; }} }} \n" +
                    "           public byte Permission {{ get {{ return (byte){4}; }} }} \n" +
                    "           public void Initialize() {{ Command.AddReference(this, \"{0}\", \"shortcut\"); }} // These are the aliases/shorcuts for your command as well as the only way a player can access them.\n" +
                    "           \n" +
                    "           public void Use (Player p, string[] args) {{ \n" +
                    "           //Your code here!\n" +
                    "           }}\n" +
                    "       }}\n" +
                    "   }}\n" +
                    "}}";

                    string a = String.Format(format, dialog.cmdName.Text, dialog.cmdAuthor.Text, dialog.cmdType.Text, dialog.cmdVersion.Text, dialog.cmdPermission.Text);
                    makerText.AppendLog(ParseCode(a));
                }
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (CommandCreatorDialog dialog = new CommandCreatorDialog())
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    /*
                     * Format: 0 = CommandName, 1 = CommandAuthor
                     * 2 = CommandType, 3 = CommandVersion, 4 = CommandPermission
                     */
                    string format = "using System;\n" +
                                    "using MCForge.Interface.Command;\n" +
                                    "   namespace {1} {{\n" +
                                    "       public class Cmd{1} : ICommand {{\n" +
                                    "           public string Name {{ get {{ return \"{0}\"; }} }} \n" +
                                    "           public CommandTypes Type {{ get {{ return \"{2}\"; }} }} \n" +
                                    "           public int Version {{ get {{ return {3}; }} }} \n" +
                                    "           public string CUD {{ get {{ return \"Unimplemented\"; }} }} \n" +
                                    "           public byte Permission {{ get {{ return (byte){4}; }} }} \n" +
                                    "           public void Initialize() {{ Command.AddReference(this, \"{0}\", \"shortcut\"); }} // These are the aliases/shorcuts for your command as well as the only way a player can access them.\n" +
                                    "           \n" +
                                    "           public void Use (Player p, string[] args) {{ \n" +
                                    "           //Your code here!\n" +
                                    "           }}\n" +
                                    "       }}\n" +
                                    "   }}\n" +
                                    "}}";

                    string a = String.Format(format, dialog.cmdName.Text, dialog.cmdAuthor.Text, dialog.cmdType.Text, dialog.cmdVersion.Text, dialog.cmdPermission.Text);
                    makerText.AppendLog(ParseCode(a));
                }
            }
        }