Skip to content

Commit 523b901

Browse files
Updated Installer
1 parent 1dc09e5 commit 523b901

1 file changed

Lines changed: 32 additions & 103 deletions

File tree

Installer/Install.cs

Lines changed: 32 additions & 103 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,21 +103,21 @@ void installcore() // Install Source Start
93103
Directory.Delete(tempDirectory, true);
94104
}
95105

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

100110
Directory.CreateDirectory(tempDirectory);
101111

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

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

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

108118
WebInstaller($"{installFile}.zip", downloadUrl, tempDirectory, true);
109119

110-
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, $"Installer"));
120+
string[] d = Directory.GetFiles(Path.Combine(tempDirectory, name));
111121
Directory.CreateDirectory(decompressDirectory);
112122
for (int i = 0; i < d.Length; i++)
113123
{
@@ -117,93 +127,11 @@ void installer() // Installer
117127
}
118128
Directory.Delete(tempDirectory, true);
119129

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++)
130+
if (shortcut)
141131
{
142-
FileInfo info = new FileInfo(d[i]);
143-
string t_decompress = Path.Combine(decompressDirectory, info.Name);
144-
File.Move(d[i], t_decompress, true);
132+
Program.CreateShortcut(shortcutname, Path.Combine(decompressDirectory, appname));
133+
Program.CreateStartMenuShortcut("EZCode", shortcutname, Path.Combine(decompressDirectory, appname));
145134
}
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"));
207135
}
208136
}
209137
catch (Exception ex)
@@ -224,6 +152,7 @@ static Option[] Options()
224152
new Option("EZCode Core and Player", 0, true),
225153
new Option("EZ_IDE (Development platform for EZCode)", 2, true),
226154
new Option("EZCode SLN (Microsoft Visual Studio Project) Builder", 1, false),
155+
new Option("EZCode Language Converter (BETA)", 3, false),
227156
};
228157

229158
int index = 0;

0 commit comments

Comments
 (0)