Skip to content
This repository was archived by the owner on Dec 13, 2020. It is now read-only.

Commit b543e36

Browse files
author
BombMask
committed
Change Version thing again
1 parent b66ec7e commit b543e36

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

UnityMultiLauncher/Models/Utility.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static string UnityProjectSettings(Uri project, string key)
3434

3535
}
3636

37-
public static Version UnityProjectVersion(Uri project)
37+
public static (Version version, string buildType) UnityProjectVersion(Uri project)
3838
{
3939
var filename = System.IO.Path.Combine(project.LocalPath, @"ProjectSettings\ProjectVersion.txt");
4040
if (System.IO.File.Exists(filename))
@@ -44,16 +44,19 @@ public static Version UnityProjectVersion(Uri project)
4444
try
4545
{
4646
//return Version.Parse(Convert.ToInt32(match.Groups[1].Value), Convert.ToInt32(match.Groups[2].Value), Convert.ToInt32(match.Groups[3].Value), Convert.ToInt32(match.Groups[5].Value));
47-
return Version.Parse(match.ToString().Replace('f','.'));
48-
}
47+
var v = Version.Parse(match.ToString().Replace('f','.').Replace('p','.'));
48+
49+
if (match.ToString().Contains("p")) { return (v, "p"); }
50+
else{ return (v, "f"); }
51+
}
4952
catch (Exception E)
5053
{
5154
E.Data["ProjectText"] = data.ToString();
5255
E.Data["Matches"] = match.ToString();
5356
throw;
5457
}
5558
}
56-
return null;
59+
return (null,null);
5760
}
5861

5962
public static Uri GetUnityExecutableFromVersion(Version version)

UnityMultiLauncher/ViewModels/UnityViewModel.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected void LaunchProject(Uri projectLocation, Uri unityExe = null)
7979
var projectVersion = Util.UnityProjectVersion(projectLocation);
8080
if (unityExe == null)
8181
{
82-
unityExe = Util.GetUnityExecutableFromVersion(projectVersion);
82+
unityExe = Util.GetUnityExecutableFromVersion(projectVersion.version);
8383
}
8484
if (unityExe != null)
8585
{
@@ -92,7 +92,7 @@ protected void LaunchProject(Uri projectLocation, Uri unityExe = null)
9292
var dialogSettings = new MetroDialogSettings { AnimateHide = false };
9393
MainWindow.cwin.ShowMessageAsync(
9494
"Unity Not Found",
95-
$"The Unity Version For This Project Is Not Installed \n({$"Unity {projectVersion.Major}.{projectVersion.Minor}.{projectVersion.Build}"})",
95+
$"The Unity Version For This Project Is Not Installed \n({$"Unity {projectVersion.version.Major}.{projectVersion.version.Minor}.{projectVersion.version.Build}"})",
9696
MessageDialogStyle.Affirmative,
9797
dialogSettings
9898
).ContinueWith(
@@ -131,7 +131,7 @@ protected void SelectUnityVersionDialog(Uri project, MetroDialogSettings dialogS
131131
var cd = MainWindow.cwin.TryFindResource("CustomLaunchDialog");
132132
MainWindow.cwin.ShowMetroDialogAsync(cd as CustomDialog, dialogSettings);
133133
SelectedProject = project;
134-
SelectedVersion = Util.GetUnityExecutableFromVersion(Util.UnityProjectVersion(project));
134+
SelectedVersion = Util.GetUnityExecutableFromVersion(Util.UnityProjectVersion(project).version);
135135
}
136136

137137
protected void FileSelectDialog()
@@ -208,11 +208,11 @@ public IEnumerable<Tuple<Uri, string, string>> UnityProjectLocations
208208
if (System.IO.Directory.Exists(project.LocalPath) && System.IO.Directory.Exists(System.IO.Path.Combine(project.LocalPath, "Assets")))
209209
{
210210
var projectVersion = Util.UnityProjectVersion(project);
211-
if (projectVersion != null)
211+
if (projectVersion.version != null)
212212
yield return Tuple.Create(
213213
project,
214214
project.LocalPath.Substring(project.LocalPath.LastIndexOf('\\') + 1),
215-
$"{projectVersion.Major}.{projectVersion.Minor}.{projectVersion.Build}f{projectVersion.Revision}"
215+
$"{projectVersion.version.Major}.{projectVersion.version.Minor}.{projectVersion.version.Build}{projectVersion.buildType}{projectVersion.version.Revision}"
216216
);
217217
}
218218
}

0 commit comments

Comments
 (0)