@@ -82,7 +82,59 @@ public void RemoveSecretSolution(string solutionPath)
8282
8383 public bool IsSolutionSecret ( string solutionPath )
8484 {
85- return _secretSolutions . Contains ( solutionPath ) ;
85+ if ( string . IsNullOrEmpty ( solutionPath ) )
86+ return false ;
87+
88+ // Check for exact match first
89+ if ( _secretSolutions . Contains ( solutionPath ) )
90+ return true ;
91+
92+ // Check for partial matches - if solution path starts with any of the secret paths
93+ foreach ( string secretPath in _secretSolutions )
94+ {
95+ if ( IsPathMatch ( solutionPath , secretPath ) )
96+ return true ;
97+ }
98+
99+ return false ;
100+ }
101+
102+ /// <summary>
103+ /// Checks if solution path matches secret path (exact or partial match)
104+ /// </summary>
105+ /// <param name="solutionPath">Full path to the solution</param>
106+ /// <param name="secretPath">Secret path (can be partial)</param>
107+ /// <returns>true if solution should be hidden</returns>
108+ private bool IsPathMatch ( string solutionPath , string secretPath )
109+ {
110+ if ( string . IsNullOrEmpty ( secretPath ) )
111+ return false ;
112+
113+ try
114+ {
115+ // Normalize paths for correct comparison
116+ string normalizedSecretPath = Path . GetFullPath ( secretPath ) . TrimEnd ( Path . DirectorySeparatorChar , Path . AltDirectorySeparatorChar ) ;
117+ string normalizedSolutionPath = Path . GetFullPath ( solutionPath ) ;
118+
119+ // Check if solution path starts with secret path
120+ if ( normalizedSolutionPath . StartsWith ( normalizedSecretPath , System . StringComparison . OrdinalIgnoreCase ) )
121+ {
122+ // Additional check: next character must be path separator or end of string
123+ if ( normalizedSolutionPath . Length == normalizedSecretPath . Length ||
124+ normalizedSolutionPath [ normalizedSecretPath . Length ] == Path . DirectorySeparatorChar ||
125+ normalizedSolutionPath [ normalizedSecretPath . Length ] == Path . AltDirectorySeparatorChar )
126+ {
127+ return true ;
128+ }
129+ }
130+ }
131+ catch
132+ {
133+ // In case of path errors, return false
134+ return false ;
135+ }
136+
137+ return false ;
86138 }
87139
88140 private void OnSolutionChanged ( Solution solution )
@@ -95,8 +147,8 @@ private void SyncRpcSecrecyStatus()
95147 {
96148 Microsoft . VisualStudio . Shell . ThreadHelper . ThrowIfNotOnUIThread ( ) ;
97149
98- string fullSolutionName = _lastOpenedSolution . FullName ;
99- _discordRpcController . Secret = _secretSolutions . Contains ( fullSolutionName ) ;
150+ string fullSolutionName = _lastOpenedSolution ? . FullName ;
151+ _discordRpcController . Secret = IsSolutionSecret ( fullSolutionName ) ;
100152 }
101153
102154 private void SaveSecretSolutions ( )
0 commit comments