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

Commit 5e7cbd8

Browse files
author
Firestack
committed
URI Updteas, added program config, starting on sub version stuff
1 parent 6e95eeb commit 5e7cbd8

File tree

6 files changed

+54
-2
lines changed

6 files changed

+54
-2
lines changed

UnityMultiLauncher/Controls/Converters/UnityUriToUnityVersion.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
3131
public string ConvertInternal(Uri unity)
3232
{
3333
var versionInfo = Util.GetUnityVersionFromExecutable(unity);
34-
return string.Format("{0}.{1}.{2}", versionInfo.Item1, versionInfo.Item2, versionInfo.Item3);
34+
return "{0}.{1}.{2}".Format( versionInfo.Item1, versionInfo.Item2, versionInfo.Item3);
3535
}
3636

3737
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

UnityMultiLauncher/Models/ProgramConfig.cs

+2
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@ public Tuple<AppTheme, Accent> appStyle
5454
public string appAccent = "Blue";
5555

5656
public HashSet<Uri> unityExeLocations = new HashSet<Uri>();
57+
58+
public bool ShouldUseUnitySubVersion = false;
5759
}
5860
}

UnityMultiLauncher/Models/Utility.cs

+10
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,15 @@ public static Tuple<int, int, int, int> GetUnityVersionFromExecutable(Uri exec)
7070
var versionInfo = FileVersionInfo.GetVersionInfo(exec.LocalPath);
7171
return Tuple.Create(versionInfo.ProductMajorPart, versionInfo.ProductMinorPart, versionInfo.ProductBuildPart, 0);
7272
}
73+
74+
public static void DumpUnityVersionInfo(Uri exec)
75+
{
76+
var versionInfo = FileVersionInfo.GetVersionInfo(exec.LocalPath);
77+
System.Threading.Tasks.Task.Run(() => Newtonsoft.Json.JsonConvert.SerializeObject(versionInfo)).ContinueWith((input) => {
78+
System.IO.File.WriteAllText(versionInfo.ProductName + "_" + versionInfo.ProductVersion + ".json", input.Result);
79+
80+
})
81+
82+
; }
7383
}
7484
}

UnityMultiLauncher/ViewModels/UnityViewModel.cs

+29
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ public Uri selectedVersion
213213
}
214214
}
215215

216+
public bool SupportUnitySubversion { get; set; }
217+
216218
public ViewCommand launchUnity
217219
{
218220
get
@@ -276,5 +278,32 @@ public ViewCommand unitySelectVersionDialog
276278
return GetProperty() as ViewCommand ?? SetProperty(new ViewCommand(param => SelectUnityVersionDialog(param as Uri)));
277279
}
278280
}
281+
282+
public bool UseUnitySubVersion
283+
{
284+
get
285+
{
286+
return ProgramConfig.conf.ShouldUseUnitySubVersion;
287+
}
288+
set
289+
{
290+
ProgramConfig.conf.ShouldUseUnitySubVersion = value;
291+
ProgramConfig.conf.Save();
292+
UpdateProperty();
293+
}
294+
}
295+
296+
public void DumpUnityExeInfoFunc(object uri)
297+
{
298+
Util.DumpUnityVersionInfo(uri as Uri);
299+
}
300+
301+
public ViewCommand DumpUnityExeInfo
302+
{
303+
get
304+
{
305+
return GetProperty() as ViewCommand ?? SetProperty(new ViewCommand(DumpUnityExeInfoFunc));
306+
}
307+
}
279308
}
280309
}

UnityMultiLauncher/ViewModels/Utils/ViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ abstract public class ViewModel : INotifyPropertyChanged
88
{
99
public event PropertyChangedEventHandler PropertyChanged;
1010

11-
protected void UpdateProperty(string Name)
11+
protected void UpdateProperty([CallerMemberName] string Name = null)
1212
{
1313
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(Name));
1414
}

UnityMultiLauncher/Views/MainWindow.xaml

+11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
<Controls:MetroWindow.Resources>
2020

2121

22+
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
23+
24+
2225
<VM:UnityViewModel x:Key="unity"/>
2326

2427
<VM:UtilViewModel x:Key="util"/>
@@ -108,6 +111,8 @@
108111
<ComboBox ItemsSource="{Binding appTheme, Source={StaticResource stylevm}}" SelectedIndex="{Binding appThemeSelected, Source={StaticResource stylevm}}" />
109112
<Label Content="App Accent"/>
110113
<ComboBox ItemsSource="{Binding appAccent, Source={StaticResource stylevm}}" SelectedIndex="{Binding appAccentSelected, Source={StaticResource stylevm}}" />
114+
<Label Content="Should Use Unity Release Sub Versions"/>
115+
<CheckBox IsChecked="{Binding UseUnitySubVersion, Source={StaticResource unity}}" />
111116
</StackPanel>
112117

113118
</Controls:Flyout>
@@ -147,6 +152,12 @@
147152
Command="{Binding removeUnityVersion, Source={StaticResource unity}}"
148153
CommandParameter="{Binding Mode=OneWay}"
149154
/>
155+
<MenuItem
156+
Header="Dump Unity Info (Send to devs)"
157+
Command="{Binding DumpUnityExeInfo, Mode=OneWay, Source={StaticResource unity}}"
158+
CommandParameter="{Binding}"
159+
Visibility="{Binding UseUnitySubVersion, Converter={StaticResource BooleanToVisibilityConverter}, Source={StaticResource unity}}"
160+
/>
150161
</ContextMenu>
151162
</Button.ContextMenu>
152163
<StackPanel>

0 commit comments

Comments
 (0)