Skip to content

Commit c0bc90f

Browse files
Updated Installer
1 parent 1dc09e5 commit c0bc90f

File tree

1 file changed

+95
-25
lines changed

1 file changed

+95
-25
lines changed

Installer/Install.cs

Lines changed: 95 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ public static void DownloadMain()
4141
Option[] options = Options();
4242
try
4343
{
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}";
44+
string releaseTag = $"{EZCode.EzCode.Version}";
4945

5046
foreach (var option in options)
5147
{
@@ -54,14 +50,28 @@ public static void DownloadMain()
5450
{
5551
case 0: // Install main
5652
installcore();
57-
installer();
58-
ezcodeplayer();
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+
5960
break;
6061
case 1: // Install SLN
61-
slnbuilder();
62+
install("Sln_Builder", "SLN Builder", "EZ_SLN_Builder.exe", true);
63+
64+
//slnbuilder();
6265
break;
6366
case 2: // Install IDE
64-
ez_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();
6575
break;
6676
}
6777
}
@@ -72,13 +82,13 @@ void installcore() // Install Source Start
7282

7383
Directory.CreateDirectory(tempDirectory);
7484

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

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

7989
WebInstaller(installFile, downloadUrl, tempDirectory, true);
8090

81-
string[] d = Directory.GetDirectories(Path.Combine(tempDirectory, $"EZCode-{(type != "" ? $"{realTag}_{type.ToLower()}" : realTag)}"));
91+
string[] d = Directory.GetDirectories(Path.Combine(tempDirectory, $"EZCode-{releaseTag}"));
8292
for (int i = 0; i < d.Length; i++)
8393
{
8494
DirectoryInfo info = new DirectoryInfo(d[i]);
@@ -93,17 +103,50 @@ void installcore() // Install Source Start
93103
Directory.Delete(tempDirectory, true);
94104
}
95105

106+
void install(string name, string shortcutname, string appname, bool shortcut) // Install
107+
{
108+
Working($"\n\nInstalling {name} From {githubRepoUrl}.git... This may take a second.");
109+
110+
Directory.CreateDirectory(tempDirectory);
111+
112+
string installFile = $"{name}_v{releaseTag}.zip";
113+
114+
string downloadUrl = $"{githubRepoUrl}/releases/download/v{releaseTag}/{installFile}";
115+
116+
string decompressDirectory = Path.Combine(filepath, $"{name} {releaseTag}");
117+
118+
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
119+
120+
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, name));
121+
Directory.CreateDirectory(decompressDirectory);
122+
for (int i = 0; i < d.Length; i++)
123+
{
124+
FileInfo info = new FileInfo(d[i]);
125+
string t_decompress = Path.Combine(decompressDirectory, info.Name);
126+
File.Move(d[i], t_decompress, true);
127+
}
128+
Directory.Delete(tempDirectory, true);
129+
130+
if (shortcut)
131+
{
132+
Program.CreateShortcut(shortcutname, Path.Combine(decompressDirectory, appname));
133+
Program.CreateStartMenuShortcut("EZCode", shortcutname, Path.Combine(decompressDirectory, appname));
134+
}
135+
}
136+
137+
138+
/*
96139
void installer() // Installer
97140
{
98141
Working($"\n\nInstalling Installer From {githubRepoUrl}.git... This may take a second.");
99142
100143
Directory.CreateDirectory(tempDirectory);
101144
102-
string installFile = $"Installer_v{realTag}.zip";
145+
string installFile = $"Installer_v{releaseTag}.zip";
103146
104-
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
147+
string downloadUrl = $"{githubRepoUrl}/releases/download/v{releaseTag}/{installFile}";
105148
106-
string decompressDirectory = Path.Combine(filepath, $"Installer {releaseTitle}");
149+
string decompressDirectory = Path.Combine(filepath, $"Installer {releaseTag}");
107150
108151
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
109152
@@ -116,9 +159,6 @@ void installer() // Installer
116159
File.Move(d[i], t_decompress, true);
117160
}
118161
Directory.Delete(tempDirectory, true);
119-
120-
Program.CreateShortcut("EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
121-
Program.CreateStartMenuShortcut("EZCode", "EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
122162
}
123163
124164
void ezcodeplayer() // Install EZCode Main
@@ -127,11 +167,11 @@ void ezcodeplayer() // Install EZCode Main
127167
128168
Directory.CreateDirectory(tempDirectory);
129169
130-
string installFile = $"EZCode_Player_v{realTag}.zip";
170+
string installFile = $"EZCode_Player_v{releaseTag}.zip";
131171
132172
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
133173
134-
string decompressDirectory = Path.Combine(filepath, $"EZCode-Player {releaseTitle}");
174+
string decompressDirectory = Path.Combine(filepath, $"EZCode-Player {releaseTag}");
135175
136176
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
137177
@@ -147,7 +187,6 @@ void ezcodeplayer() // Install EZCode Main
147187
148188
Program.CreateShortcut("EZCode Player", Path.Combine(decompressDirectory, "EZCodePlayer.exe"));
149189
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"));
151190
}
152191
153192
void slnbuilder() // Install Sln Builder
@@ -156,11 +195,11 @@ void slnbuilder() // Install Sln Builder
156195
157196
Directory.CreateDirectory(tempDirectory);
158197
159-
string installFile = $"Sln_Builder_v{realTag}.zip";
198+
string installFile = $"Sln_Builder_v{releaseTag}.zip";
160199
161200
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
162201
163-
string decompressDirectory = Path.Combine(filepath, $"SLN_Builder {releaseTitle}");
202+
string decompressDirectory = Path.Combine(filepath, $"SLN_Builder {releaseTag}");
164203
165204
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
166205
@@ -184,11 +223,11 @@ void ez_ide() // Install IDE
184223
185224
Directory.CreateDirectory(tempDirectory);
186225
187-
string installFile = $"EZ_IDE_v{realTag}.zip";
226+
string installFile = $"EZ_IDE_v{releaseTag}.zip";
188227
189228
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
190229
191-
string decompressDirectory = Path.Combine(filepath, $"EZ_IDE {releaseTitle}");
230+
string decompressDirectory = Path.Combine(filepath, $"EZ_IDE {releaseTag}");
192231
193232
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
194233
@@ -205,6 +244,36 @@ void ez_ide() // Install IDE
205244
Program.CreateShortcut("EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
206245
Program.CreateStartMenuShortcut("EZCode", "EZ IDE", Path.Combine(decompressDirectory, "EZ_IDE.exe"));
207246
}
247+
248+
void lang_converter() // Install Language Converter
249+
{
250+
Working($"\n\nInstalling IDE From {githubRepoUrl}.git... This may take a second.");
251+
252+
Directory.CreateDirectory(tempDirectory);
253+
254+
string installFile = $"Language_Converter_v{releaseTag}.zip";
255+
256+
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
257+
258+
string decompressDirectory = Path.Combine(filepath, $"Language_Converter {releaseTag}");
259+
260+
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
261+
262+
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"Language_Converter"));
263+
Directory.CreateDirectory(decompressDirectory);
264+
for (int i = 0; i < d.Length; i++)
265+
{
266+
FileInfo info = new FileInfo(d[i]);
267+
string t_decompress = Path.Combine(decompressDirectory, info.Name);
268+
File.Move(d[i], t_decompress, true);
269+
}
270+
Directory.Delete(tempDirectory, true);
271+
272+
Program.CreateShortcut("Language Converter", Path.Combine(decompressDirectory, "LanguageConverter.exe"));
273+
Program.CreateStartMenuShortcut("EZCode", "Language Converter", Path.Combine(decompressDirectory, "LanguageConverter.exe"));
274+
}
275+
276+
*/
208277
}
209278
catch (Exception ex)
210279
{
@@ -224,6 +293,7 @@ static Option[] Options()
224293
new Option("EZCode Core and Player", 0, true),
225294
new Option("EZ_IDE (Development platform for EZCode)", 2, true),
226295
new Option("EZCode SLN (Microsoft Visual Studio Project) Builder", 1, false),
296+
new Option("EZCode Language Converter (BETA)", 3, false),
227297
};
228298

229299
int index = 0;

0 commit comments

Comments
 (0)