Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1df1105

Browse files
authored
Merge pull request#161 from eh-iart/search-git-branch-recusively
Add option to search projects parent folders to get the current git branch
2 parentsf904726 +d19848f commit1df1105

File tree

6 files changed

+272
-347
lines changed

6 files changed

+272
-347
lines changed

‎UnityLauncherPro/GetProjects.cs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class GetProjects
1515
// convert target platform name into valid buildtarget platform name, NOTE this depends on unity version, now only 2019 and later are supported
1616
publicstaticDictionary<string,string>remapPlatformNames=newDictionary<string,string>{{"StandaloneWindows64","Win64"},{"StandaloneWindows","Win"},{"Android","Android"},{"WebGL","WebGL"}};
1717

18-
publicstaticList<Project>Scan(boolgetGitBranch=false,boolgetPlasticBranch=false,boolgetArguments=false,boolshowMissingFolders=false,boolshowTargetPlatform=false,StringCollectionAllProjectPaths=null)
18+
publicstaticList<Project>Scan(boolgetGitBranch=false,boolgetPlasticBranch=false,boolgetArguments=false,boolshowMissingFolders=false,boolshowTargetPlatform=false,StringCollectionAllProjectPaths=null,boolsearchGitbranchRecursivly=false)
1919
{
2020
List<Project>projectsFound=newList<Project>();
2121

@@ -53,7 +53,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
5353
projectPath=(string)key.GetValue(valueName);
5454
}
5555

56-
varp=GetProjectInfo(projectPath,getGitBranch,getPlasticBranch,getArguments,showMissingFolders,showTargetPlatform);
56+
varp=GetProjectInfo(projectPath,getGitBranch,getPlasticBranch,getArguments,showMissingFolders,showTargetPlatform,searchGitbranchRecursivly);
5757
//Console.WriteLine(projectPath+" "+p.TargetPlatform);
5858

5959
// if want to hide project and folder path for screenshot
@@ -94,7 +94,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
9494
// if not found from registry, add to recent projects list
9595
if(found==false)
9696
{
97-
varp=GetProjectInfo(projectPath,getGitBranch,getPlasticBranch,getArguments,showMissingFolders,showTargetPlatform);
97+
varp=GetProjectInfo(projectPath,getGitBranch,getPlasticBranch,getArguments,showMissingFolders,showTargetPlatform,searchGitbranchRecursivly);
9898
if(p!=null)projectsFound.Add(p);
9999
}
100100
}
@@ -121,7 +121,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
121121
returnprojectsFound;
122122
}// Scan()
123123

124-
staticProjectGetProjectInfo(stringprojectPath,boolgetGitBranch=false,boolgetPlasticBranch=false,boolgetArguments=false,boolshowMissingFolders=false,boolshowTargetPlatform=false)
124+
staticProjectGetProjectInfo(stringprojectPath,boolgetGitBranch=false,boolgetPlasticBranch=false,boolgetArguments=false,boolshowMissingFolders=false,boolshowTargetPlatform=false,boolsearchGitbranchRecursivly=false)
125125
{
126126
boolfolderExists=Directory.Exists(projectPath);
127127

@@ -166,7 +166,7 @@ static Project GetProjectInfo(string projectPath, bool getGitBranch = false, boo
166166
stringgitBranch="";
167167
if(getGitBranch==true)
168168
{
169-
gitBranch=folderExists?Tools.ReadGitBranchInfo(projectPath):null;
169+
gitBranch=folderExists?Tools.ReadGitBranchInfo(projectPath,searchGitbranchRecursivly):null;
170170
// check for plastic, if enabled
171171
if(getPlasticBranch==true&&gitBranch==null)
172172
{

‎UnityLauncherPro/MainWindow.xaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@
725725
<CheckBoxx:Name="chkEnablePlatformSelection"Content="Enable Platform Selection (Experimental!)"Checked="ChkEnablePlatformSelection_Checked"Unchecked="ChkEnablePlatformSelection_Checked"ToolTip="Select target platform"HorizontalAlignment="Left"/>
726726
<StackPanel Grid.Row="3"Orientation="Horizontal"Margin="0,0,0,0">
727727
<CheckBoxx:Name="chkShowGitBranchColumn"Content="Show git branch column"Checked="ChkShowGitBranchColumn_CheckedChanged"Unchecked="ChkShowGitBranchColumn_CheckedChanged"ToolTip="Shows column for project git branch info"HorizontalAlignment="Left"/>
728+
<CheckBoxx:Name="chkGetGitBranchRecursively"Content="Search Parent Folders for git branch"Checked="ChkGetGitBranchRecursively_CheckedChanged"Unchecked="ChkGetGitBranchRecursively_CheckedChanged"ToolTip="Search all parent folders recursivly and look for a git folder to get the current branch"HorizontalAlignment="Left"Margin="14,0,0,3"/>
728729
<CheckBoxx:Name="chkCheckPlasticBranch"Content="Check for Plastic branch"ToolTip="Checks for plastic branch, if .git doesnt exists"HorizontalAlignment="Left"Margin="14,0,0,3"Checked="ChkCheckPlasticBranch_Checked"Unchecked="ChkCheckPlasticBranch_Checked"/>
729730
</StackPanel>
730731
<CheckBoxx:Name="chkAskNameForQuickProject"Content="Ask name for New Project"Checked="ChkAskNameForQuickProject_Checked"Unchecked="ChkAskNameForQuickProject_Checked"ToolTip="If disabled, uses automatic quick project naming (Should be enabled, unless you want instant project creation)"HorizontalAlignment="Left"/>

‎UnityLauncherPro/MainWindow.xaml.cs‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void Start()
131131
//Properties.Settings.Default.projectPaths = null;
132132
//Properties.Settings.Default.Save();
133133

134-
projectsSource=GetProjects.Scan(getGitBranch:(bool)chkShowGitBranchColumn.IsChecked,getPlasticBranch:(bool)chkCheckPlasticBranch.IsChecked,getArguments:(bool)chkShowLauncherArgumentsColumn.IsChecked,showMissingFolders:(bool)chkShowMissingFolderProjects.IsChecked,showTargetPlatform:(bool)chkShowPlatform.IsChecked,AllProjectPaths:Properties.Settings.Default.projectPaths);
134+
projectsSource=GetProjects.Scan(getGitBranch:(bool)chkShowGitBranchColumn.IsChecked,getPlasticBranch:(bool)chkCheckPlasticBranch.IsChecked,getArguments:(bool)chkShowLauncherArgumentsColumn.IsChecked,showMissingFolders:(bool)chkShowMissingFolderProjects.IsChecked,showTargetPlatform:(bool)chkShowPlatform.IsChecked,AllProjectPaths:Properties.Settings.Default.projectPaths,searchGitbranchRecursivly:(bool)chkGetGitBranchRecursively.IsChecked);
135135

136136
Console.WriteLine("projectsSource.Count: "+projectsSource.Count);
137137

@@ -408,6 +408,7 @@ void LoadSettings()
408408
chkQuitAfterOpen.IsChecked=Properties.Settings.Default.closeAfterProject;
409409
chkShowLauncherArgumentsColumn.IsChecked=Properties.Settings.Default.showArgumentsColumn;
410410
chkShowGitBranchColumn.IsChecked=Properties.Settings.Default.showGitBranchColumn;
411+
chkGetGitBranchRecursively.IsChecked=Properties.Settings.Default.searchGitFolderRecursivly;
411412
chkCheckPlasticBranch.IsChecked=Properties.Settings.Default.checkPlasticBranch;
412413
chkShowMissingFolderProjects.IsChecked=Properties.Settings.Default.showProjectsMissingFolder;
413414
chkAllowSingleInstanceOnly.IsChecked=Properties.Settings.Default.AllowSingleInstanceOnly;
@@ -777,7 +778,7 @@ public void RefreshRecentProjects()
777778
// take currently selected project row
778779
lastSelectedProjectIndex=gridRecent.SelectedIndex;
779780
// rescan recent projects
780-
projectsSource=GetProjects.Scan(getGitBranch:(bool)chkShowGitBranchColumn.IsChecked,getPlasticBranch:(bool)chkCheckPlasticBranch.IsChecked,getArguments:(bool)chkShowLauncherArgumentsColumn.IsChecked,showMissingFolders:(bool)chkShowMissingFolderProjects.IsChecked,showTargetPlatform:(bool)chkShowPlatform.IsChecked,AllProjectPaths:Settings.Default.projectPaths);
781+
projectsSource=GetProjects.Scan(getGitBranch:(bool)chkShowGitBranchColumn.IsChecked,getPlasticBranch:(bool)chkCheckPlasticBranch.IsChecked,getArguments:(bool)chkShowLauncherArgumentsColumn.IsChecked,showMissingFolders:(bool)chkShowMissingFolderProjects.IsChecked,showTargetPlatform:(bool)chkShowPlatform.IsChecked,AllProjectPaths:Settings.Default.projectPaths,searchGitbranchRecursivly:(bool)chkGetGitBranchRecursively.IsChecked);
781782
gridRecent.ItemsSource=projectsSource;
782783

783784
// fix sorting on refresh
@@ -852,7 +853,7 @@ Project GetNewProjectData(string folder)
852853
p.Version=Tools.GetProjectVersion(folder);
853854
p.Arguments=Tools.ReadCustomProjectData(folder,launcherArgumentsFile);
854855
if((bool)chkShowPlatform.IsChecked==true)p.TargetPlatform=Tools.GetTargetPlatform(folder);
855-
if((bool)chkShowGitBranchColumn.IsChecked==true)p.GITBranch=Tools.ReadGitBranchInfo(folder);
856+
if((bool)chkShowGitBranchColumn.IsChecked==true)p.GITBranch=Tools.ReadGitBranchInfo(folder,(bool)chkGetGitBranchRecursively.IsChecked);
856857
returnp;
857858
}
858859

@@ -1587,6 +1588,17 @@ private void ChkShowGitBranchColumn_CheckedChanged(object sender, RoutedEventArg
15871588
RefreshRecentProjects();
15881589
}
15891590

1591+
privatevoidChkGetGitBranchRecursively_CheckedChanged(objectsender,RoutedEventArgse)
1592+
{
1593+
if(this.IsActive==false)
1594+
return;// dont run code on window init
1595+
1596+
Settings.Default.searchGitFolderRecursivly=(bool)chkGetGitBranchRecursively.IsChecked;
1597+
Settings.Default.Save();
1598+
RefreshRecentProjects();
1599+
}
1600+
1601+
15901602
privatevoidChkQuitAfterOpen_CheckedChanged(objectsender,RoutedEventArgse)
15911603
{
15921604
if(this.IsActive==false)return;// dont run code on window init
@@ -2930,7 +2942,7 @@ public void ProcessExitedCallBack(Project proj)
29302942
vartempProj=projectsSource[i];
29312943
tempProj.Modified=Tools.GetLastModifiedTime(proj.Path);
29322944
tempProj.Version=Tools.GetProjectVersion(proj.Path);
2933-
tempProj.GITBranch=Tools.ReadGitBranchInfo(proj.Path);
2945+
tempProj.GITBranch=Tools.ReadGitBranchInfo(proj.Path,false);
29342946
tempProj.TargetPlatform=Tools.GetTargetPlatform(proj.Path);
29352947
projectsSource[i]=tempProj;
29362948
gridRecent.Items.Refresh();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp