Skip to content

Commit

Permalink
add default unity hub editors installation folder, fixes #112
Browse files Browse the repository at this point in the history
  • Loading branch information
unitycoder committed Nov 25, 2024
1 parent 1c85a01 commit 5a1d062
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 31 deletions.
3 changes: 2 additions & 1 deletion UnityLauncherPro/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,8 @@
<Label x:Name="lblFoundXInstallations" Grid.Row="0" Content="Found .. Installations" Foreground="{DynamicResource ThemeButtonForeground}" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
<!-- locations list -->
<ListBox x:Name="lstRootFolders" Grid.Row="1" Background="{DynamicResource ThemeButtonBackground}" Margin="4,0,2,0" Foreground="{DynamicResource ThemeButtonForeground}" VerticalAlignment="Top" MinHeight="65" >
<System:String>c:\Program Files</System:String>
<System:String>C:\Program Files\Unity\Hub\Editor</System:String>
<System:String>C:\Program Files</System:String>
</ListBox>
<!-- locations add/remove -->
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0" VerticalAlignment="Top" >
Expand Down
55 changes: 29 additions & 26 deletions UnityLauncherPro/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,39 +426,42 @@ private bool BuildReportFilter(object item)

void LoadSettings()
{
// debug, print filename
//Console.WriteLine(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);

// catch corrupted config file
try
{
Settings.Default.Reload();
// form size
this.Width = Properties.Settings.Default.windowWidth;
this.Height = Properties.Settings.Default.windowHeight;
this.Width = Settings.Default.windowWidth;
this.Height = Settings.Default.windowHeight;

chkMinimizeToTaskbar.IsChecked = Properties.Settings.Default.minimizeToTaskbar;
chkRegisterExplorerMenu.IsChecked = Properties.Settings.Default.registerExplorerMenu;
chkMinimizeToTaskbar.IsChecked = Settings.Default.minimizeToTaskbar;
chkRegisterExplorerMenu.IsChecked = Settings.Default.registerExplorerMenu;

// update settings window
chkQuitAfterCommandline.IsChecked = Properties.Settings.Default.closeAfterExplorer;
chkQuitAfterOpen.IsChecked = Properties.Settings.Default.closeAfterProject;
chkShowLauncherArgumentsColumn.IsChecked = Properties.Settings.Default.showArgumentsColumn;
chkShowGitBranchColumn.IsChecked = Properties.Settings.Default.showGitBranchColumn;
chkGetGitBranchRecursively.IsChecked = Properties.Settings.Default.searchGitFolderRecursivly;
chkCheckPlasticBranch.IsChecked = Properties.Settings.Default.checkPlasticBranch;
chkShowMissingFolderProjects.IsChecked = Properties.Settings.Default.showProjectsMissingFolder;
chkAllowSingleInstanceOnly.IsChecked = Properties.Settings.Default.AllowSingleInstanceOnly;
chkAskNameForQuickProject.IsChecked = Properties.Settings.Default.askNameForQuickProject;
chkEnableProjectRename.IsChecked = Properties.Settings.Default.enableProjectRename;
chkStreamerMode.IsChecked = Properties.Settings.Default.streamerMode;
chkShowPlatform.IsChecked = Properties.Settings.Default.showTargetPlatform;
chkUseCustomTheme.IsChecked = Properties.Settings.Default.useCustomTheme;
txtRootFolderForNewProjects.Text = Properties.Settings.Default.newProjectsRoot;
txtWebglRelativePath.Text = Properties.Settings.Default.webglBuildPath;
txtCustomThemeFile.Text = Properties.Settings.Default.themeFile;
useAlphaReleaseNotesSite.IsChecked = Properties.Settings.Default.useAlphaReleaseNotes;

chkEnablePlatformSelection.IsChecked = Properties.Settings.Default.enablePlatformSelection;
chkRunAutomatically.IsChecked = Properties.Settings.Default.runAutomatically;
chkRunAutomaticallyMinimized.IsChecked = Properties.Settings.Default.runAutomaticallyMinimized;
chkQuitAfterCommandline.IsChecked = Settings.Default.closeAfterExplorer;
chkQuitAfterOpen.IsChecked = Settings.Default.closeAfterProject;
chkShowLauncherArgumentsColumn.IsChecked = Settings.Default.showArgumentsColumn;
chkShowGitBranchColumn.IsChecked = Settings.Default.showGitBranchColumn;
chkGetGitBranchRecursively.IsChecked = Settings.Default.searchGitFolderRecursivly; // FIXME typo
chkCheckPlasticBranch.IsChecked = Settings.Default.checkPlasticBranch;
chkShowMissingFolderProjects.IsChecked = Settings.Default.showProjectsMissingFolder;
chkAllowSingleInstanceOnly.IsChecked = Settings.Default.AllowSingleInstanceOnly;
chkAskNameForQuickProject.IsChecked = Settings.Default.askNameForQuickProject;
chkEnableProjectRename.IsChecked = Settings.Default.enableProjectRename;
chkStreamerMode.IsChecked = Settings.Default.streamerMode;
chkShowPlatform.IsChecked = Settings.Default.showTargetPlatform;
chkUseCustomTheme.IsChecked = Settings.Default.useCustomTheme;
txtRootFolderForNewProjects.Text = Settings.Default.newProjectsRoot;
txtWebglRelativePath.Text = Settings.Default.webglBuildPath;
txtCustomThemeFile.Text = Settings.Default.themeFile;
useAlphaReleaseNotesSite.IsChecked = Settings.Default.useAlphaReleaseNotes;

chkEnablePlatformSelection.IsChecked = Settings.Default.enablePlatformSelection;
chkRunAutomatically.IsChecked = Settings.Default.runAutomatically;
chkRunAutomaticallyMinimized.IsChecked = Settings.Default.runAutomaticallyMinimized;

// update optional grid columns, hidden or visible
gridRecent.Columns[4].Visibility = (bool)chkShowLauncherArgumentsColumn.IsChecked ? Visibility.Visible : Visibility.Collapsed;
Expand All @@ -469,7 +472,7 @@ void LoadSettings()
lstRootFolders.Items.Clear();

// check if no installation root folders are added, then add default folder(s), this usually happens only on first run (or if user has not added any folders)
if (Properties.Settings.Default.rootFolders.Count == 0)
if (Settings.Default.rootFolders.Count == 0)
{
// default hub installation folder
string baseFolder = "\\Program Files\\Unity\\Hub\\Editor";
Expand Down
10 changes: 6 additions & 4 deletions UnityLauncherPro/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions UnityLauncherPro/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
<Setting Name="rootFolders" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;string&gt;C:\Program Files\Unity\Hub\Editor\&lt;/string&gt;
&lt;string&gt;C:\Program Files\&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
Expand Down

0 comments on commit 5a1d062

Please sign in to comment.