Skip to content

Commit 421f2ba

Browse files
Update Installer_
1 parent 52b0366 commit 421f2ba

File tree

1 file changed

+15
-155
lines changed

1 file changed

+15
-155
lines changed

Installer/Install.cs

Lines changed: 15 additions & 155 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,18 @@ 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"));
5956
break;
6057
case 1: // Install SLN
61-
slnbuilder();
58+
install("Sln_Builder", "SLN Builder", "EZ_SLN_Builder.exe", true);
6259
break;
6360
case 2: // Install IDE
64-
ez_ide();
61+
install("EZ_IDE", "EZ IDE", "EZ_IDE.exe", true);
62+
break;
63+
case 3: // Install Language Converter
64+
install("Language_Converter", "Language Converter", "LanguageConverter.exe", true);
6565
break;
6666
}
6767
}
@@ -72,17 +72,17 @@ void installcore() // Install Source Start
7272

7373
Directory.CreateDirectory(tempDirectory);
7474

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

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

7979
WebInstaller(installFile, downloadUrl, tempDirectory, true);
8080

81-
string[] d = Directory.GetDirectories(Path.Combine(tempDirectory, $"EZCode-{(type != "" ? $"{realTag}_{type.ToLower()}" : realTag)}"));
81+
string[] d = Directory.GetDirectories(Path.Combine(tempDirectory, $"EZCode-{releaseTag}"));
8282
for (int i = 0; i < d.Length; i++)
8383
{
8484
DirectoryInfo info = new DirectoryInfo(d[i]);
85-
string t_decompress = Path.Combine(appdataDir, info.Name);
85+
string t_decompress = Path.Combine(appdataDir, info.Name);
8686
if (info.Name.ToLower() == "ezcode" || info.Name.ToLower() == "ezcode-winforms" || info.Name.ToLower() == "packages")
8787
{
8888
if (Directory.Exists(t_decompress))
@@ -93,119 +93,6 @@ void installcore() // Install Source Start
9393
Directory.Delete(tempDirectory, true);
9494
}
9595

96-
void installer() // Installer
97-
{
98-
Working($"\n\nInstalling Installer From {githubRepoUrl}.git... This may take a second.");
99-
100-
Directory.CreateDirectory(tempDirectory);
101-
102-
string installFile = $"Installer_v{realTag}.zip";
103-
104-
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
105-
106-
string decompressDirectory = Path.Combine(filepath, $"Installer {releaseTitle}");
107-
108-
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
109-
110-
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"Installer"));
111-
Directory.CreateDirectory(decompressDirectory);
112-
for (int i = 0; i < d.Length; i++)
113-
{
114-
FileInfo info = new FileInfo(d[i]);
115-
string t_decompress = Path.Combine(decompressDirectory, info.Name);
116-
File.Move(d[i], t_decompress, true);
117-
}
118-
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"));
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++)
141-
{
142-
FileInfo info = new FileInfo(d[i]);
143-
string t_decompress = Path.Combine(decompressDirectory, info.Name);
144-
File.Move(d[i], t_decompress, true);
145-
}
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"));
207-
}
208-
20996
void install(string name, string shortcutname, string appname, bool shortcut) // Install
21097
{
21198
Working($"\n\nInstalling {name} From {githubRepoUrl}.git... This may take a second.");
@@ -236,34 +123,6 @@ void install(string name, string shortcutname, string appname, bool shortcut) //
236123
Program.CreateStartMenuShortcut("EZCode", shortcutname, Path.Combine(decompressDirectory, appname));
237124
}
238125
}
239-
240-
void lang_converter() // Install Language Converter
241-
{
242-
Working($"\n\nInstalling IDE From {githubRepoUrl}.git... This may take a second.");
243-
244-
Directory.CreateDirectory(tempDirectory);
245-
246-
string installFile = $"Language_Converter_v{releaseTag}.zip";
247-
248-
string downloadUrl = $"{githubRepoUrl}/releases/download/{releaseTag}/{installFile}";
249-
250-
string decompressDirectory = Path.Combine(filepath, $"Language_Converter {releaseTag}");
251-
252-
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
253-
254-
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"Language_Converter"));
255-
Directory.CreateDirectory(decompressDirectory);
256-
for (int i = 0; i < d.Length; i++)
257-
{
258-
FileInfo info = new FileInfo(d[i]);
259-
string t_decompress = Path.Combine(decompressDirectory, info.Name);
260-
File.Move(d[i], t_decompress, true);
261-
}
262-
Directory.Delete(tempDirectory, true);
263-
264-
Program.CreateShortcut("Language Converter", Path.Combine(decompressDirectory, "LanguageConverter.exe"));
265-
Program.CreateStartMenuShortcut("EZCode", "Language Converter", Path.Combine(decompressDirectory, "LanguageConverter.exe"));
266-
}
267126
}
268127
catch (Exception ex)
269128
{
@@ -283,6 +142,7 @@ static Option[] Options()
283142
new Option("EZCode Core and Player", 0, true),
284143
new Option("EZ_IDE (Development platform for EZCode)", 2, true),
285144
new Option("EZCode SLN (Microsoft Visual Studio Project) Builder", 1, false),
145+
new Option("EZCode Language Converter (BETA)", 3, false),
286146
};
287147

288148
int index = 0;
@@ -426,4 +286,4 @@ static async Task Working(string text)
426286
}
427287
}
428288
}
429-
}
289+
}

0 commit comments

Comments
 (0)