[GUIDE]Making a New Launcher

06/06/2010 17:29 DePredaTe#1
Alright, this is my first tutorial on ElitePvpers and I wanted to show people how to make there own launcher that simply opens Conquer.exe and closes the program.

Yes it's very simple and takes like, 2 seconds to do something this easy but I am contributing.


So lets open C# Express (I have 2010, some of you might have 2008 but its basically the same)

Now lets create a Windows Form Application
[Only registered and activated users can see links. Click Here To Register...]

Now after this we are going to double click on Program.cs
You should get a simple start up code that basically runs a blank form.
[Only registered and activated users can see links. Click Here To Register...]


Now highlight everything, and click the backspace key! Yes, you are deleting all of it!

Now, this code MIGHT have extra stuff in it that isn't needed. But i know the code compiles with no errors. The reason why it might have some extra stuff is because I made a launcher for a server and gave it to them, still had the source so I decided to release a guide for it. So i ripped apart the source so it wouldn't look anything like it and this is what I got.

It a VERY simple code and I wouldn't suggest using it for a server lol.
If you do use it for a server you need to edit it and make it look alot better.

This is my first tutorial so, please don't flame.

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using Chat = System.Net;
using System.Collections;
using System.Runtime;







public class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

    }




    #region Navigation

    private void buttonPlay_Click(object sender, EventArgs e)
    {
        System.Diagnostics.Process.Start("Conquer.exe");
        Application.Exit();

    }

    private void buttonExit_Click(object sender, EventArgs e)
    {
        Application.Exit();

    }


    #endregion

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
        this.buttonPlay = new System.Windows.Forms.Button();
        this.buttonExit = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // buttonPlay
        // 
        this.buttonPlay.Location = new System.Drawing.Point(2, 504);
        this.buttonPlay.Name = "buttonPlay";
        this.buttonPlay.Text = "Play";
        this.buttonPlay.Size = new System.Drawing.Size(128, 58);
        this.buttonPlay.TabIndex = 1;
        this.buttonPlay.UseVisualStyleBackColor = true;
        this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click);
        // 
        // buttonExit
        // 
        this.buttonExit.Location = new System.Drawing.Point(449, 504);
        this.buttonExit.Name = "buttonExit";
        this.buttonExit.Text = "Exit";
        this.buttonExit.Size = new System.Drawing.Size(128, 58);
        this.buttonExit.TabIndex = 2;
        this.buttonExit.UseVisualStyleBackColor = true;
        this.buttonExit.Click += new System.EventHandler(this.buttonExit_Click);
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
        this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
        this.ClientSize = new System.Drawing.Size(579, 562);
        this.ControlBox = false;
        this.Controls.Add(this.buttonExit);
        this.Controls.Add(this.buttonPlay);
        this.MaximizeBox = false;
        this.MaximumSize = new System.Drawing.Size(595, 578);
        this.MinimumSize = new System.Drawing.Size(595, 578);
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.ResumeLayout(false);

    }

    private Button buttonExit;
    private System.Windows.Forms.Button buttonPlay;


    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }

}
End Result should look like this:

[Only registered and activated users can see links. Click Here To Register...]
06/06/2010 19:48 DePredaTe#2
28 views, no replies?
is it that bad? XD
06/06/2010 20:07 sawickas#3
How add own image butons etc yuo only put black screan xD but thanks xD
06/06/2010 20:12 DePredaTe#4
Those are both things that are VERY easy to do. i just gave you the basics, the start, and the exit buttons. its not difficult to add the background and the image buttons.


EDIT:

I'll show you how to add the button backgrounds:

First, right click on Program.cs and hit designer mode.
Scroll down to the bottom and there are the buttons.
Click once on one of the buttons and go look at the Properties window. Scroll through it until you find Image. Click on it and then you should see three little dots beside it like this "..." click on the dots and click Import. then find your image!
Repeat steps for the other button!


This is how you add a background:

Right click Program.cs and hit designer mode.
Click the black area (it should be black) and go to the Properties window.
Scroll up/down until you see BackgroundImage, you might need to look carefully and drag some stuff over because the word Image is kind of hidden in mine.
Click the three little dots "..." and click Import and go find your image!


NOTE: <B> WHEN YOU RELEASE THE PROGRAM YOUR IMAGES WILL HAVE TO HAVE A FOLDER, FOR MY IMAGES I ADD THEM INTO DATA/MAIN OF MY CONQUER FOLDER, YOU SHOULD DO THE SAME OR ELSE YOUR PROGRAM WILL CRASH!!!!!!


If you followed the instructions, and used a little bit of common sense, this should work. :D
06/06/2010 21:32 dragon89928#5
Kamote released a really nice starter too. It even includes an auto patcher. It has some bugs but they're easy to fix. I'm not saying yours is bad I'm just saying there's not much use in a starter without a patcher when you can just run the exe file by itself (assuming you made it do this)
06/06/2010 21:45 DePredaTe#6
Haha, yes; kind of.
I have an autopatcher that I made from scratch from C#, which this, actually ran the autopatcher. but I do not want to release the auto patcher yet cause for 1, it would be complicated cause i have it running on a C# server rather than a web server. its difficult to explain
06/06/2010 21:48 Huseby#7
Well this is not really related to private servers, could be used for normal co tho.
But since it could be very useful for private server, im leaving behind a little permanent redirect.

#Moved
06/06/2010 22:11 DePredaTe#8
Alright, sorry. and thank you.