Skip to content

Commit 52b0366

Browse files
Revert "Updated Installer"
This reverts commit 523b901.
1 parent 0ae9c31 commit 52b0366

File tree

1 file changed

+103
-32
lines changed

1 file changed

+103
-32
lines changed

Installer/Install.cs

Lines changed: 103 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public static void DownloadMain()
4141
Option[] options = Options();
4242
try
4343
{
44-
string releaseTag = $"{EZCode.EzCode.Version}";
44+
string type = "";
45+
try { type = EZCode.EzCode.Version.Split("_")[1]; } catch { }
46+
string realTag = $"{EZCode.EzCode.Version}";
47+
string releaseTag = type != "" ? $"v{realTag}_{type.ToLower()}" : $"v{realTag}";
48+
string releaseTitle = type != "" ? $"v{realTag}_{type}" : $"v{realTag}";
4549

4650
foreach (var option in options)
4751
{
@@ -50,28 +54,14 @@ public static void DownloadMain()
5054
{
5155
case 0: // Install main
5256
installcore();
53-
install("Installer", "Installer", "Installer.exe", false);
54-
install("EZCode_Player", "EZCode Player", "EZCodePlayer.exe", true);
55-
Program.SetUpFile(Path.Combine(filepath, $"Installer {releaseTag}", "EZCodePlayer.exe"), Path.Combine(appdataDir, "EZCode", "EZCode_Logo.ico"));
56-
57-
//installer();
58-
//ezcodeplayer();
59-
57+
installer();
58+
ezcodeplayer();
6059
break;
6160
case 1: // Install SLN
62-
install("Sln_Builder", "SLN Builder", "EZ_SLN_Builder.exe", true);
63-
64-
//slnbuilder();
61+
slnbuilder();
6562
break;
6663
case 2: // Install IDE
67-
install("EZ_IDE", "EZ IDE", "EZ_IDE.exe", true);
68-
69-
//ez_ide();
70-
break;
71-
case 3: // Install Language Converter
72-
install("Language_Converter", "Language Converter", "LanguageConverter.exe", true);
73-
74-
//lang_converter();
64+
ez_ide();
7565
break;
7666
}
7767
}
@@ -82,13 +72,13 @@ void installcore() // Install Source Start
8272

8373
Directory.CreateDirectory(tempDirectory);
8474

85-
string installFile = releaseTag + ".zip";
75+
string installFile = releaseTitle + ".zip";
8676

87-
string downloadUrl = $"{githubRepoUrl}/archive/refs/tags/v{releaseTag}.zip";
77+
string downloadUrl = $"{githubRepoUrl}/archive/refs/tags/{releaseTag}.zip";
8878

8979
WebInstaller(installFile, downloadUrl, tempDirectory, true);
9080

91-
string[] d = Directory.GetDirectories(Path.Combine(tempDirectory, $"EZCode-{releaseTag}"));
81+
string[] d = Directory.GetDirectories(Path.Combine(tempDirectory, $"EZCode-{(type != "" ? $"{realTag}_{type.ToLower()}" : realTag)}"));
9282
for (int i = 0; i < d.Length; i++)
9383
{
9484
DirectoryInfo info = new DirectoryInfo(d[i]);
@@ -103,21 +93,21 @@ void installcore() // Install Source Start
10393
Directory.Delete(tempDirectory, true);
10494
}
10595

106-
void install(string name, string shortcutname, string appname, bool shortcut) // Install
96+
void installer() // Installer
10797
{
108-
Working($"\n\nInstalling {name} From {githubRepoUrl}.git... This may take a second.");
98+
Working($"\n\nInstalling Installer From {githubRepoUrl}.git... This may take a second.");
10999

110100
Directory.CreateDirectory(tempDirectory);
111101

112-
string installFile = $"{name}_v{releaseTag}.zip";
102+
string installFile = $"Installer_v{realTag}.zip";
113103

114-
string downloadUrl = $"{githubRepoUrl}/releases/download/v{releaseTag}/{installFile}";
104+
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
115105

116-
string decompressDirectory = Path.Combine(filepath, $"{name} {releaseTag}");
106+
string decompressDirectory = Path.Combine(filepath, $"Installer {releaseTitle}");
117107

118108
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
119109

120-
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, name));
110+
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"Installer"));
121111
Directory.CreateDirectory(decompressDirectory);
122112
for (int i = 0; i < d.Length; i++)
123113
{
@@ -127,11 +117,93 @@ void install(string name, string shortcutname, string appname, bool shortcut) //
127117
}
128118
Directory.Delete(tempDirectory, true);
129119

130-
if (shortcut)
120+
Program.CreateShortcut("EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
121+
Program.CreateStartMenuShortcut("EZCode", "EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
122+
}
123+
124+
void ezcodeplayer() // Install EZCode Main
125+
{
126+
Working($"\n\nInstalling Player From {githubRepoUrl}.git... This may take a second.");
127+
128+
Directory.CreateDirectory(tempDirectory);
129+
130+
string installFile = $"EZCode_Player_v{realTag}.zip";
131+
132+
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
133+
134+
string decompressDirectory = Path.Combine(filepath, $"EZCode-Player {releaseTitle}");
135+
136+
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
137+
138+
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"EZCode_Player"));
139+
Directory.CreateDirectory(decompressDirectory);
140+
for (int i = 0; i < d.Length; i++)
131141
{
132-
Program.CreateShortcut(shortcutname, Path.Combine(decompressDirectory, appname));
133-
Program.CreateStartMenuShortcut("EZCode", shortcutname, Path.Combine(decompressDirectory, appname));
142+
FileInfo info = new FileInfo(d[i]);
143+
string t_decompress = Path.Combine(decompressDirectory, info.Name);
144+
File.Move(d[i], t_decompress, true);
134145
}
146+
Directory.Delete(tempDirectory, true);
147+
148+
Program.CreateShortcut("EZCode Player", Path.Combine(decompressDirectory, "EZCodePlayer.exe"));
149+
Program.CreateStartMenuShortcut("EZCode", "EZCode Player", Path.Combine(decompressDirectory, "EZCodePlayer.exe"));
150+
Program.SetUpFile(Path.Combine(decompressDirectory, "EZCodePlayer.exe"), Path.Combine(appdataDir, "EZCode", "EZCode_Logo.ico"));
151+
}
152+
153+
void slnbuilder() // Install Sln Builder
154+
{
155+
Working($"\n\nInstalling SLN Builder From {githubRepoUrl}.git... This may take a second.");
156+
157+
Directory.CreateDirectory(tempDirectory);
158+
159+
string installFile = $"Sln_Builder_v{realTag}.zip";
160+
161+
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
162+
163+
string decompressDirectory = Path.Combine(filepath, $"SLN_Builder {releaseTitle}");
164+
165+
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
166+
167+
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"Sln_Builder"));
168+
Directory.CreateDirectory(decompressDirectory);
169+
for (int i = 0; i < d.Length; i++)
170+
{
171+
FileInfo info = new FileInfo(d[i]);
172+
string t_decompress = Path.Combine(decompressDirectory, info.Name);
173+
File.Move(d[i], t_decompress, true);
174+
}
175+
Directory.Delete(tempDirectory, true);
176+
177+
Program.CreateShortcut("SLN Builder", Path.Combine(decompressDirectory, "EZ_SLN_Builder.exe"));
178+
Program.CreateStartMenuShortcut("EZCode", "SLN Builder", Path.Combine(decompressDirectory, "EZ_SLN_Builder.exe"));
179+
}
180+
181+
void ez_ide() // Install IDE
182+
{
183+
Working($"\n\nInstalling IDE From {githubRepoUrl}.git... This may take a second.");
184+
185+
Directory.CreateDirectory(tempDirectory);
186+
187+
string installFile = $"EZ_IDE_v{realTag}.zip";
188+
189+
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
190+
191+
string decompressDirectory = Path.Combine(filepath, $"EZ_IDE {releaseTitle}");
192+
193+
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
194+
195+
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"EZ_IDE"));
196+
Directory.CreateDirectory(decompressDirectory);
197+
for (int i = 0; i < d.Length; i++)
198+
{
199+
FileInfo info = new FileInfo(d[i]);
200+
string t_decompress = Path.Combine(decompressDirectory, info.Name);
201+
File.Move(d[i], t_decompress, true);
202+
}
203+
Directory.Delete(tempDirectory, true);
204+
205+
Program.CreateShortcut("EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
206+
Program.CreateStartMenuShortcut("EZCode", "EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
135207
}
136208

137209
void install(string name, string shortcutname, string appname, bool shortcut) // Install
@@ -211,7 +283,6 @@ static Option[] Options()
211283
new Option("EZCode Core and Player", 0, true),
212284
new Option("EZ_IDE (Development platform for EZCode)", 2, true),
213285
new Option("EZCode SLN (Microsoft Visual Studio Project) Builder", 1, false),
214-
new Option("EZCode Language Converter (BETA)", 3, false),
215286
};
216287

217288
int index = 0;

0 commit comments

Comments
 (0)