Skip to content

Commit 5080404

Browse files
committed
less GC in GetSRP(), search filter: use ordinalignorecase,
1 parent 1bb82ee commit 5080404

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,16 +439,16 @@ private bool ProjectFilter(object item)
439439
bool found = true;
440440
foreach (var word in searchWords)
441441
{
442-
bool titleMatched = proj.Title.IndexOf(word, 0, StringComparison.CurrentCultureIgnoreCase) != -1;
443-
bool pathMatched = searchProjectPathAlso && proj.Path.IndexOf(word, 0, StringComparison.CurrentCultureIgnoreCase) != -1;
442+
bool titleMatched = proj.Title.IndexOf(word, 0, StringComparison.OrdinalIgnoreCase) != -1;
443+
bool pathMatched = searchProjectPathAlso && proj.Path.IndexOf(word, 0, StringComparison.OrdinalIgnoreCase) != -1;
444444
found = found && (titleMatched || pathMatched);
445445
}
446446
return found;
447447
}
448448
else // single word search
449449
{
450-
bool titleMatched = proj.Title.IndexOf(_filterString, 0, StringComparison.CurrentCultureIgnoreCase) != -1;
451-
bool pathMatched = searchProjectPathAlso && proj.Path.IndexOf(_filterString, 0, StringComparison.CurrentCultureIgnoreCase) != -1;
450+
bool titleMatched = proj.Title.IndexOf(_filterString, 0, StringComparison.OrdinalIgnoreCase) != -1;
451+
bool pathMatched = searchProjectPathAlso && proj.Path.IndexOf(_filterString, 0, StringComparison.OrdinalIgnoreCase) != -1;
452452

453453
return titleMatched || pathMatched;
454454
}

UnityLauncherPro/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[assembly: AssemblyConfiguration("")]
1313
[assembly: AssemblyCompany("UnityCoder.com")]
1414
[assembly: AssemblyProduct("UnityLauncherPro")]
15-
[assembly: AssemblyCopyright("Copyright © 2023")]
15+
[assembly: AssemblyCopyright("Copyright © 2025")]
1616
[assembly: AssemblyTrademark("")]
1717
[assembly: AssemblyCulture("")]
1818

UnityLauncherPro/Tools.cs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,34 +2603,36 @@ private static async Task<bool> DownloadFileAsync(string fileUrl, string destina
26032603

26042604
internal static string GetSRP(string projectPath)
26052605
{
2606-
// read projectsettings/graphicsettings file, look for m_SRPDefaultSettings: value
26072606
var settingsFile = Path.Combine(projectPath, "ProjectSettings", "GraphicsSettings.asset");
2608-
if (File.Exists(settingsFile) == false) return null;
2607+
if (!File.Exists(settingsFile)) return null;
26092608

2610-
var allText = File.ReadAllText(settingsFile);
2611-
var srpIndex = allText.IndexOf("m_SRPDefaultSettings:");
2612-
if (srpIndex == -1)
2613-
{
2614-
srpIndex = allText.IndexOf("m_RenderPipelineGlobalSettingsMap:"); // unity 6000.2- ?
2615-
if (srpIndex == -1) return null; // BIRP
2616-
}
2617-
2618-
// urp = UnityEngine.Rendering.Universal.UniversalRenderPipeline
2619-
// hdrp = UnityEngine.Rendering.HighDefinition.HDRenderPipeline
2609+
bool srpSectionFound = false;
26202610

2621-
if (allText.IndexOf("UnityEngine.Rendering.Universal.UniversalRenderPipeline", srpIndex) > -1)
2622-
{
2623-
return "URP";
2624-
}
2625-
else if (allText.IndexOf("UnityEngine.Rendering.HighDefinition.HDRenderPipeline", srpIndex) > -1)
2611+
using (var reader = new StreamReader(settingsFile))
26262612
{
2627-
return "HDRP";
2628-
}
2629-
else
2630-
{
2631-
return null; // BIRP
2632-
}
2613+
string line;
2614+
while ((line = reader.ReadLine()) != null)
2615+
{
2616+
if (!srpSectionFound)
2617+
{
2618+
if (line.Contains("m_SRPDefaultSettings:") || line.Contains("m_RenderPipelineGlobalSettingsMap:"))
2619+
{
2620+
srpSectionFound = true;
2621+
}
2622+
continue;
2623+
}
26332624

2625+
if (line.Contains("UniversalRenderPipeline"))
2626+
{
2627+
return "URP";
2628+
}
2629+
else if (line.Contains("HDRenderPipeline"))
2630+
{
2631+
return "HDRP";
2632+
}
2633+
}
2634+
}
2635+
return null; // BIRP or unknown
26342636
}
26352637

26362638
internal static void InstallAPK(string ApkPath)

0 commit comments

Comments
 (0)