-
Notifications
You must be signed in to change notification settings - Fork 35
/
Program.cs
86 lines (76 loc) · 2.83 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCForge)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.osedu.org/licenses/ECL-2.0
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.IO;
using System.Net;
using System.Threading;
namespace Starter
{
class Program
{
// Attempt to read the location from the DLL, if available.
public static string DLLLocation
{
get
{
return "http://www.mcforge.net/MCForge_.dll";
}
}
static void Main(string[] args)
{
int tries = 0;
retry:
if (tries > 4)
{
Console.WriteLine("I'm afraid I can't download the file for some reason!");
Console.WriteLine("Go to " + DLLLocation + " yourself and download it, please");
Console.WriteLine("Place it inside my folder, near me, and restart me.");
Console.WriteLine("If you have any issues, get the files from the www.mcforge.net download page and try again.");
Console.WriteLine("Press any key to close me...");
Console.ReadLine();
goto exit;
}
if (File.Exists("MCForge_.dll"))
{
openServer(args);
}
else
{
tries++;
Console.WriteLine("This is try number " + tries);
Console.WriteLine("You do not have the required DLL!");
Console.WriteLine("I'll download it for you. Just wait.");
Console.WriteLine("Downloading from " + DLLLocation);
WebClient Client = new WebClient();
Client.DownloadFile(DLLLocation, "MCForge_.dll");
Client.Dispose();
Console.WriteLine("Finished downloading! Let's try this again, shall we.");
for (int i = 0; i < 5; i++)
{
Thread.Sleep(100);
Console.Write(".");
}
Console.WriteLine("Go!");
Console.WriteLine();
goto retry;
}
exit: Console.WriteLine("Bye!");
}
static void openServer(string[] args)
{
MCForge_.Gui.Program.Main(args);
}
}
}